Blockland Forums > Modification Help
Death...
<< < (2/3) > >>
MrPickle:
I think Randy, Space Guy and Aloshi are about equal.
Space Guy:
Armor::onRemove would be when the player has been dead for a few seconds and clients can respawn before that without a "flag" to delete, then when their still-dead body dissapears it leaves a permaflag.

A better idea would be to use a package with GameConnection::onDeath:


--- Code: ---package DeathCheck
{
function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
  if(isObject(%this.player))
  {
   %flag = new Item()
   {
     datablock = flagItem;
     position = %this.player.position;
     rotation = "0 0 0 0";
   };
   %flag.schedule(7500,0,delete);
  }
  Parent::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc);
}
};
activatePackage(DeathCheck);
--- End code ---

You have to define the item "flagItem" somewhere else along with code to mount it/etc when picked up.

I actually have a CTF mode for the Team Deathmatch but it is very buggy and unreleased.
Eryehk:
so would i need to use any one aloshi's script for the "flag" popping down or  just yours.
MrPickle:
Cant you just make a check for the state.
Space Guy:
State checks would have to be in repeated, every few ms checks. With about 8 players and a check every 100 milliseconds that's a lot of extra load on the server.

You'd only need my code, plus your own defining what "flagItem" is.

datablock ItemData(flagItem)
{
   category = "Weapon";  // Mission editor category
   className = "Weapon"; // For inventory system

    // Basic Item Properties
   shapeFile = "./shapes/flag.dts";
   mass = 1;
   density = 0.2;
   elasticity = 0.2;
   friction = 0.6;
   emap = true;

   //gui stuff
   uiName = "";
   iconName = "base/client/ui/itemIcons/wand.png";
   doColorShift = true;
   colorShiftColor = "0 255 0 1.000";

    // Dynamic properties defined by the scripts
   image = "";
   canDrop = true;
};

function flagItem::onPickup(%this, %item, %obj, %amount)
{
 //Extra code depending on what happens when picked up.
 //Change the "image" variable in the item and add Parent::onPickup(%this, %flag, %obj, %amount);
 //to the code for standard pickup including deleting item, adding to inventory, etc.
}
Navigation
Message Index
Next page
Previous page

Go to full version