How would i allow the code to have scientists attack animals? and other objects that they target.
Making scientist NPCs attack animals?
This should be asked in: https://umod.org/community/developers or on the uMod Dev discord
Quantum
This should be asked in: https://umod.org/community/developers or on the uMod Dev discord
This is the purpose of this forums, the Discord isn't primarily for support.
Any update on how to do this? i can target them but they will not attack them.
Merged post
Seems to not work.. they will not attack when i target them..
Merged post
Seems to not work.. they will not attack when i target them..
private object CanNpcAttack(BaseNpc npc, BaseEntity target)
{
if (target is BasePlayer || target is BaseNpc)
{
NpcAI npcAi = npc.GetComponent<NpcAI>();
if (npcAi != null && target is BaseNpc) return true;
if (npcAi != null && npcAi.owner.player == target)
return false;
}
return null;
}
private object OnNpcTarget(BaseNpc npc, BaseEntity target)
{
if (target is BasePlayer || target is BaseNpc)
{
NpcAI npcAi = npc.GetComponent<NpcAI>();
if (npcAi != null && target is BaseNpc) return true;
if (npcAi != null && npcAi.owner.player == target)
return false;
return true;
}
return null;
}
private object OnNpcPlayerTarget(NPCPlayerApex npc, BaseEntity target)
{
if (target is BasePlayer || target is BaseNpc)
{
NpcAI npcAi = npc.GetComponent<NpcAI>();
if (npcAi != null && target is BaseNpc) return true;
if (npcAi != null && npcAi.owner.player == target)
return false;
return null;
}
return null;
} Ts3hostingAny update on how to do this? i can target them but they will not attack them.
Merged post
Seems to not work.. they will not attack when i target them..private object CanNpcAttack(BaseNpc npc, BaseEntity target) { if (target is BasePlayer || target is BaseNpc) { NpcAI npcAi = npc.GetComponent<NpcAI>(); if (npcAi != null && target is BaseNpc) return true; if (npcAi != null && npcAi.owner.player == target) return false; } return null; } private object OnNpcTarget(BaseNpc npc, BaseEntity target) { if (target is BasePlayer || target is BaseNpc) { NpcAI npcAi = npc.GetComponent<NpcAI>(); if (npcAi != null && target is BaseNpc) return true; if (npcAi != null && npcAi.owner.player == target) return false; return true; } return null; } private object OnNpcPlayerTarget(NPCPlayerApex npc, BaseEntity target) { if (target is BasePlayer || target is BaseNpc) { NpcAI npcAi = npc.GetComponent<NpcAI>(); if (npcAi != null && target is BaseNpc) return true; if (npcAi != null && npcAi.owner.player == target) return false; return null; } return null; }
Because you need custom logic, not just hook abusing...
Quantum
This should be asked in: https://umod.org/community/developers or on the uMod Dev discord
Wulf
This is the purpose of this forums, the Discord isn't primarily for support.
oh wow is there realy a dev area, like before on oxide page? i realy like it for information and learn by oneself.
but as a not plugin dev i cant access this :(
Ts3hostingHow would i allow the code to have scientists attack animals? and other objects that they target.
i can only drop a example how i use it
StartAttack(AttackOperator.AttackType type, BaseCombatEntity target)npc.StartAttack(Rust.Ai.AttackOperator.AttackType.CloseRange, target);npc.StartAttack(Rust.Ai.AttackOperator.AttackType.MediumRange, target);npc.StartAttack(Rust.Ai.AttackOperator.AttackType.LongRange, target); dIMjIM
oh wow is there realy a dev area, like before on oxide page? i realy like it for information and learn by oneself.
but as a not plugin dev i cant access this :(
It isn't really used.