Author Topic: What function is called when somebody is the last man standing?  (Read 3895 times)

For example, which function is called when it says "Zapk is the last man standing!".
I need to know so I can make the lava disappear for my rising lava Game Mode, it would make it a lot better.




I did it and the server crashed.
Disable everything

especially RTB

This is default as of the Speedkart update. Set minigame respawn time to something other than zero.

This is default as of the Speedkart update. Set minigame respawn time to something other than zero.
I know.
I want to use a package to make the lava disappear when somebody wins.

disable rtb and do trace(1);

This is off-topic, but I loving hate this last man standing thing. It's forgeted up every single script I've made that involves death, and we had at least 24 hours of uptime on the dueling server prior to figuring out that we can disable it by setting the respawn time to something other than 0. I don't even understand why it runs without the SpeedKart package. It's like someone releasing a script that forgets up every other script due to not being self-contained, except the person who released this is Badspot and it's a forced update for everyone that plays Blockland and won't get failbinned.

I did it and the server crashed.
Trace(1); wasn't the cause of the crash

Trace(1); wasn't the cause of the crash
It was. System_RTBHosting probably freaked out.

It was. System_RTBHosting probably freaked out.
Then it was an add-on, but by default trace(1); doesn't crash you.

Why not just package GameConnection::onDeath and then check how many players there are left in the minigame, and if one, delete the WaterPlane and WaterZone objects (deleting this removes lava, you will want to create it again later)
Code: [Select]
package lavakill
{
   function GameConnection::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
   {
      parent::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
      if(isObject(%client.minigame))
      {
         %peopleAlive = 0;
         for(%i=0;%i<%client.minigame.numMembers;%i++)
         {
            %miniPlayer = %client.minigame.member[%i];
            if(isObject(%miniPlayer.player))
            {
       %peopleAlive++;
            }
         }
         echo("There are " @ %peopleAlive @ " people alive.");
         if(%peopleAlive == 1)
         {
            if(isObject(WaterPlane))
    {
WaterPlane.delete();
WaterZone.delete();
            }
         }
      }
   }
};
activatePackage(lavaKill);

I tested it and apparently onDeath will detect deaths by lava and it seems to work.



To add the lava back later simply use:

Code: [Select]
new fxPlane(WaterPlane) {
   position = "0 0 4.5";
   rotation = "1 0 0 0";
   scale = "1 1 1";
   topTexture = "Add-Ons/Water_Lava/lava.png";
   bottomTexture = "Add-Ons/Water_Lava/lava.png";
   loopsPerUnit = "0.15";
   scrollSpeed = "0.000000 0.000000";
   color = "255 255 255 255";
   rayCastColor = "128 128 128 255";
   blend = "0";
   additiveBlend = "0";
   colorMultiply = "1";
   isSolid = "0";
      useShader = "1";
};

new PhysicalZone(WaterZone) {
   position = "-500000 500000 -95";
   rotation = "1 0 0 0";
   scale = "1e+006 1e+006 100";
   velocityMod = "1";
   gravityMod = "1";
   extraDrag = "0";
   isWater = "1";
   waterViscosity = "40";
   waterDensity = "1";
   waterColor = "0.941177 0.380392 0.066667 0.745098";
   waterType = "8";
   appliedForce = "0 0 0";
   polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};

Then add the code to properly set the lava height.
« Last Edit: August 03, 2013, 09:00:38 PM by Pacnet2012³ »

Why not just package GameConnection::onDeath and then check how many players there are left in the minigame, and if one, delete the WaterPlane and WaterZone objects (deleting this removes lava, you will want to create it again later)
Code: [Select]
package lavakill
{
   function GameConnection::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
   {
      parent::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
      if(isObject(%client.minigame))
      {
         %peopleAlive = 0;
         for(%i=0;%i<%client.minigame.numMembers;%i++)
         {
            %miniPlayer = %client.minigame.member[%i];
            if(isObject(%miniPlayer.player))
            {
       %peopleAlive++;
            }
         }
         echo("There are " @ %peopleAlive @ " people alive.");
         if(%peopleAlive == 1)
         {
            if(isObject(WaterPlane))
    {
WaterPlane.delete();
WaterZone.delete();
            }
         }
      }
   }
};
activatePackage(lavaKill);

I tested it and apparently onDeath will detect deaths by lava and it seems to work.



To add the lava back later simply use:

Code: [Select]
new fxPlane(WaterPlane) {
   position = "0 0 4.5";
   rotation = "1 0 0 0";
   scale = "1 1 1";
   topTexture = "Add-Ons/Water_Lava/lava.png";
   bottomTexture = "Add-Ons/Water_Lava/lava.png";
   loopsPerUnit = "0.15";
   scrollSpeed = "0.000000 0.000000";
   color = "255 255 255 255";
   rayCastColor = "128 128 128 255";
   blend = "0";
   additiveBlend = "0";
   colorMultiply = "1";
   isSolid = "0";
      useShader = "1";
};

new PhysicalZone(WaterZone) {
   position = "-500000 500000 -95";
   rotation = "1 0 0 0";
   scale = "1e+006 1e+006 100";
   velocityMod = "1";
   gravityMod = "1";
   extraDrag = "0";
   isWater = "1";
   waterViscosity = "40";
   waterDensity = "1";
   waterColor = "0.941177 0.380392 0.066667 0.745098";
   waterType = "8";
   appliedForce = "0 0 0";
   polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};

Then add the code to properly set the lava height.
uhhh or I can just set the lava height to 0
Thanks for the code anyway

uhhh or I can just set the lava height to 0
Thanks for the code anyway
Setting the height to 0 simply makes it at the level of the ground plane and doesn't actually make it disappear.

If not, at least you can modify the lava kill package to set the height to 0 instead of deleting the lava stuff...