Solved CanNpcAttack broken?

Discussion in 'Rust Development' started by wazzzup, Dec 28, 2017.

  1. so, is it working? cause I can't get it
    Code:
      object CanNpcAttack(BaseNpc npc, BaseEntity target)  
      {
      PrintWarning("CanNpcAttack");
      return null;
      }
    
     
  2. I guess you use CustomAI.
    CustomAI doesn't call this hook.
     
  3. I don't know if that works, but this does.

    Code:
            object OnNpcTarget(BaseNpc npc, BaseEntity entity)
            {
                return 0f;
            }
     
  4. strange, but yesterday tried that too with no luck
     
  5. Oh? How are you testing?
    That's what I'm using in BotSpawn (with additional checks) to make animals ignore Scientists/Murderers.
     
  6. well, caught that old plugin isn't working, so simply put all that hooks in the plugin and ran into agro radius of animals - they attacking me, but hooks didn't response to console with PrintWarning
     
  7. Are you checking console as you go? Does this test plugin compile?
    Attach it or PM to me, if you want.
     
  8. Code:
            private object OnNpcTarget(BaseNpc npc, BaseEntity entity)
            {
                PrintWarning("OnNpcTarget");
                return null;
            }        private object OnNpcPlayerTarget(NPCPlayerApex npc, BaseEntity entity)
            {
                PrintWarning("OnNpcPlayerTarget");
                return null;
            }        private object CanNpcAttack(BaseNpc npc, BaseEntity target)   
            {
                PrintWarning("CanNpcAttack");
                return null;
            }
    
     
  9. I know OnNpcPlayerTarget is working fine - I've been working with it this week.

    OnNpcTarget doesn't seem to be working for me, though, as you say.
    Animal_Safe option in BotSpawn is dead on my server.

    I'll try to find out why. :)

    It could be that two plugins have the same hook with a different action - Not in a position to check it out just now but maybe you could oxide.unload * then load your test plugin on its own?
     
  10. tried that, hook is not fired
     
  11. Hmm. Maybe something's changed then.
    I'll fire up the server and check further tomorrow.
     
  12. ^^ The code around this hook has changed.
    I've notified Wulf in the original request thread.

    Thanks @wazzzup
     
  13. ok, thanks, happy holidays ))
    I was too lazy, just checked are the hooks in place and their param types