Making scientist NPCs attack animals?
How would i allow the code to have scientists attack animals? and other objects that they target.
5c2da1c996ab6.png?uid=5c2da1cfb55c6 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..
        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;
       }​
Ts3hosting
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..
        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...

5c2da1c996ab6.png?uid=5c2da1cfb55c6 Quantum
This should be asked in: https://umod.org/community/developers or on the uMod Dev discord
5c2d88ae4ea06.jpg 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 :(

Ts3hosting
How 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);
5b8718c16f911.png 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.