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:
... how can I get the default behaviour to return it if it's not the helicopter
- Returning true or false overrides default behavior
Thanks in advance for your help to oxide newbie!
CanBeTargeted by helicopter
Discussion in 'Rust Development' started by Fruhling, Jan 8, 2018.
-
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; } -
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)
-
Wulf Community Admin
No, this is a different hook. The available NPC hooks are in the Docs at the top of the page. -
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;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; } -
Wulf Community Admin
Pretty sure most of the hooks like this are for players. -
okays thx ill just forget it then
-
Shame. PM sent.
