How can I get the BasePlayer object from an event that doesnt have it? like
OnHelicopterAttacked
How can I get the BasePlayer from a event
Discussion in 'Rust Development' started by DerpyLV, Jul 18, 2018.
-
I dont really think that helicopter can attack someone(CH47), its scientists
Looked up in CH47HelicopterAIController
Code:public override void MounteeTookDamage(BasePlayer mountee, HitInfo info) { this.InitiateAnger(); }
Code:public void InitiateAnger() { // ISSUE: method pointer this.CancelInvoke(new Action((object) this, __methodptr(UnHostile))); // ISSUE: method pointer this.Invoke(new Action((object) this, __methodptr(UnHostile)), 120f); foreach (BaseVehicle.MountPointInfo mountPoint in this.mountPoints) { if ((UnityEngine.Object) mountPoint.mountable != (UnityEngine.Object) null) { BasePlayer mounted = mountPoint.mountable.GetMounted(); if ((bool) ((UnityEngine.Object) mounted)) { NPCPlayerApex npcPlayerApex = mounted as NPCPlayerApex; if ((bool) ((UnityEngine.Object) npcPlayerApex)) { npcPlayerApex.Stats.Hostility = 1f; npcPlayerApex.Stats.Defensiveness = 1f; } } } } }
Attached Files:
Last edited by a moderator: Jul 19, 2018 -
-
-
Code:
object OnHelicopterAttacked(CH47HelicopterAIController heli) { var attacker = heli.lastAttacker; //(BaseEntity) var attackerplayer = attacker.ToPlayer(); // If you want get player, dont forget check NRE return null; }
Code:heli.LastAttackedDir //(Vector 3) heli.lastAttackedTime //(float)