1. I would like to create a plugin to let the helicopter attack anyone (even unarmed and naked players).

    I was thinking about he hook CanBeTargeted .

    bool CanBeTargeted(BaseCombatEntity player, MonoBehaviour behaviour)
    {
    Puts("CanBeTargeted works!");
    }

    1. How can I get from BaseCombatEntity.AttackerInfo that it's a heli
    2. If docs says:
    • Returning true or false overrides default behavior
    ... how can I get the default behaviour to return it if it's not the helicopter

    Thanks in advance for your help to oxide newbie!
     
  2. Code:
    object CanBeTargeted(BaseCombatEntity player, MonoBehaviour behaviour)
            {
                if (!(behaviour is HelicopterTurret))
                    return null;            if (player is BasePlayer) // idk, maybe it will hook only if BCE is player and this check is useless
                    return true;            return null;
            }
     
  3. Hi wondering if we can use this to target npcs too? Like if (entity is NPCPlayerApex). I tried it and they just ignore them. The npcs are really NPCPlayerApex. (talking about BaseCombatEntity entity)
     
  4. Wulf

    Wulf Community Admin

    No, this is a different hook. The available NPC hooks are in the Docs at the top of the page.
     
  5. Code:
    object OnHelicopterTarget(HelicopterTurret turret, BaseCombatEntity entity) //for entities
            {
                if (turret == null || entity == null) return null;
                //if ((turret?._heliAI?._currentState ?? PatrolHelicopterAI.aiState.DEATH) == PatrolHelicopterAI.aiState.DEATH) return false;
               if (!entity is BasePlayer) return true; //just to see if it attacks anything else
                return null;
            }
    I tried this hook too. Am I missing something? I just tested if it will target something but it just don't, unless its a player. Tried if (entity is NPCPlayer || entity is NPCPlayerApex) return true;
     
  6. Wulf

    Wulf Community Admin

    Pretty sure most of the hooks like this are for players.
     
  7. okays thx ill just forget it then :p
     
  8. Shame. PM sent.