Chopper Survival

Helicopter survival event for EventManager

Total Downloads: 2,510 - First Release: Jan 1, 2016 - Last Update: Apr 19, 2018

5/5, 10 likes
  1. /event game ChopperSurvival
    /event open
    /event start
    /event close
    /event end
     
  2. event game <name of game case sensitive>
    event open
    event start
    event close to close new people from entering
    event end if you need to stop the event
    event cancel to stop all events and send em all home
    [DOUBLEPOST=1463345921][/DOUBLEPOST]
    I have to wonder how many people have the Chopper Mod installed, I am going to try uninstalling it.

    I think if an addition to the mod was to add like it is in the chopper mod /callheli <name of player> it would need to be random name though for each round and only people in the event.

    I'm no programmer but maybe this will help.
     
  3. Code:
    (20:31:53) | [Oxide] 20:31 [Error] Failed to call hook 'OnEntityDeath' on plugin 'ChopperSurvival v0.2.3' (NullReferenceException: )
    (20:31:53) | [Oxide] 20:31 [Debug]   at (wrapper managed-to-native) UnityEngine.Component:get_gameObject ()
      at EntityComponent`1[T].UpdateBaseEntity () [0x00000] in <filename unknown>:0
      at EntityComponent`1[T].get_baseEntity () [0x00000] in <filename unknown>:0
      at PlayerMetabolism.SendChangesToClient () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EventManager.EnableGod () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EventManager.EndEvent () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.ChopperSurvival.Winner (.BasePlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.ChopperSurvival.FindWinner () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.ChopperSurvival.NextRound () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.ChopperSurvival.OnEntityDeath (.BaseEntity entity, .HitInfo hitinfo) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.ChopperSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
     
  4. I 'believe', The "Fly-Away" problem is caused by the no called function "CheckDistance".

    the Code here to call this is:
    Code:
                void Awake()
                {
                    Helicopter = GetComponent<BaseHelicopter>();               
                    AI = Helicopter.GetComponent<PatrolHelicopterAI>();
                    Helicopter.maxCratesToSpawn = 0;
                    enabled = true;        
                    InvokeRepeating("CheckDistance", 5, 5);            }
                private void OnDestroy()
                {
                    CancelInvoke("CheckDistance");
                }
    The function itself (actually):
    Code:
    private void CheckDistance(BaseEntity entity)
                {
                    if (entity == null) return;
                    var currentPos = entity.transform.position;
                    if (Destination != null)
                    {
                        AI.SetTargetDestination(Destination + new Vector3(0.0f, 10f, 0.0f));
                        if (Vector3Ex.Distance2D(currentPos, Destination) < 60)
                        {
                            if (useRockets)
                            {
                                int num = UnityEngine.Random.Range(1, 3);
                                if (num == 2)
                                    AI.State_Strafe_Think(0);                           
                            }
                            else AI.State_Orbit_Think(40f);
                        }
                        else
                            AI.State_Move_Enter(Destination + new Vector3(0.0f, 10f, 0.0f));
                                       
                    }
                }
    As i have tested, the Invoked Function i not called, tested with a simple debug-step.
    An actual test with this function seems to work, but the timing of 5/5 For the Invoke.Repeat seems to be to short:

    Code:
    private void CheckDistance()
                {
                    Debug.Log("CheckDistance");
                    if (GetComponent<BaseEntity>() == null) return;
                    var currentPos = GetComponent<BaseEntity>().transform.position;
                    if (Destination != null)
                    {
                        AI.SetTargetDestination(Destination + new Vector3(0.0f, 10f, 0.0f));
                        if (Vector3Ex.Distance2D(currentPos, Destination) < 60)
                        {
                            if (useRockets)
                            {
                                int num = UnityEngine.Random.Range(1, 3);
                                if (num == 2)
                                    AI.State_Strafe_Think(0);                           
                            }
                            else AI.State_Orbit_Think(40f);
                        }
                        else
                            AI.State_Move_Enter(Destination + new Vector3(0.0f, 10f, 0.0f));
                                       
                    }
                }
    In Conclusion: i believe, the solution lays there, to trigger the heli in range of the arena....
     
  5. I was looking at this last night, confused as to why the choppers were flying away from me and not coming back when the CheckDistance code does tell the AI to fly back towards the arena if the heli is more than 60 units of distance away from the start position.

    Adding in debug code like you have indeed does indicate that CheckDistance is never firing.

    The only thing I can think of which i need to test still is that CheckDistance takes a parameter, i believe that InvokeRepeating does not support this method.

    So, perhaps the correct function would be:
    Code:
    private void CheckDistance()
                {
                    var entity = Helicopter; //fix?
                 
                    if (entity == null) return;
                    var currentPos = entity.transform.position;
                    if (Destination != null)
                    {
                        AI.SetTargetDestination(Destination + new Vector3(0.0f, 10f, 0.0f));
                        if (Vector3Ex.Distance2D(currentPos, Destination) < 60)
                        {
                            if (useRockets)
                            {
                                int num = UnityEngine.Random.Range(1, 3);
                                if (num == 2)
                                    AI.State_Strafe_Think(0);                          
                            }
                            else AI.State_Orbit_Think(40f);
                        }
                        else
                            AI.State_Move_Enter(Destination + new Vector3(0.0f, 10f, 0.0f));                              
                    }
                }
    
    Not tested in the slightest, but just an idea.


    -- Edit --
    just reading the post above again, it seems that the same method to try to fix this problem has been used already by the guy above me, sorry so tired today!
     
    Last edited by a moderator: May 23, 2016
  6. So what code use to get them call back properly? you both posted some codes but what use? :)
     
  7. Sorry haha, try either :) - they both do the same thing.
    I have yet to test it.
     
  8. Ok and can you just tell where exactly to put it or what to change? or if you would be so kind and pm me that file? :)
     
  9. Here ya go, seems to work for me.
     

    Attached Files:

  10. Thanks bud! :)
     
  11. I have an issue with some players on my server where this gamemode crashes their client due to a memory leak, just a heads up that it might happen to you.

    During gameplay, my client used 10.5GB of RAM, where normal gameplay uses around 3.5GB of RAM, not blaming the game mode itself, but this must trigger some sort of memory leak in Rust.
     
  12. Ok i will test it later this day and inform also ;) Thanks for the advice ;)
     
  13. [Oxide] 19:51 [Warning] CallHook 'OnEntitySpawned' on plugin 'ChopperSurvival v0.2.3' took: 4109ms
    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    computeMassAndInertia: Provided mass or density has no valid value
    PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    computeMassAndInertia: Provided mass or density has no valid value
    PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]

    mass error when heli fallen
     
  14. I can confirm, had the same mass error spamming the console...was more then a few hundres lines...
     
  15. I've been getting this for a long time.
    I detailed it earlier in the thread and let k1lly0u know privately.

    It seems to happen every time a heli is destroyed.
    There is no crash animation - The heli just disappears and the console spam above runs for a few seconds.
    The spam stops when there's an explosion, so the duration of the spam relates to how high the heli was and how long it would have taken it to crash to the ground, had there been an animation.

    Usually the 3rd or 4th heli kill will completely freeze my server.
    All players think the server is still live, but everyone appears frozen to everyone else.
     
  16. I can only assume that the Rust engine itself is still wanting the Helicopter entity to be existing upon its death - i assume the script is deleting the helis entity once it's deemed "dead", perhaps the script can be changed to reflect this.
    I'll take a look at it once my server is back online (moving DC's currently)
     
  17. Just letting you all know, I tried Chopper Survival tonight (first time since forced wipe/update) and I am not having this issue anymore.

    Spawning is completely ballsed and everyone ends up in the sea (except for initial spawn), but that's not a Chopper Survival issue.
     
  18. I have a fix, I just need to test it sometime this weekend

    Currently it initiates the standard death maneuver (spiral down to the ground) when the custom health values dip below a certain point, it doesn't actually force kill the entity or anything like that
     
  19. @k1lly0u This today spammed my console:
    Code:
    (10:32:50) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/patrolhelicopter.prefab/RotorPivot/patrol_helicopter/tail_rotor_col"
    (10:32:50) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/patrolhelicopter.prefab/RotorPivot/patrol_helicopter/main_rotor_col"
    (10:32:50) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/patrolhelicopter.prefab/RotorPivot/patrol_helicopter/engine_col"
    (10:32:50) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/patrolhelicopter.prefab/RotorPivot/patrol_helicopter"
    Code:
     computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab"
    (10:32:54) | computeMassAndInertia: Provided mass or density has no valid value
    (10:32:54) | PxRigidBodyExt::setMassAndUpdateInertia: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)
    (10:32:54) | Calling kill - but already IsDestroyed!? assets/prefabs/npc/patrol helicopter/servergibs_patrolhelicopter.prefab[0]
    It was like many many spams, just posting short (cant post whole cause too much for thread ;) ) after spam ended, server crashed and restarted it self :(

    BTW im using the plugin posted above by @AlienX
     
  20. Damn!
    This is exactly what I was getting before the wipe 02/06, but I'm not getting it now!
    As far as I'm aware, I've changed nothing other than the wipe/update.