Author Topic: Safe Triggers  (Read 1251 times)

Can Some One Tell Me Why This Doesnt Protect You When Your In It My Goals To Make A Safe Zone For Retail Like The One In RtB Heres The Code

Code: [Select]
////////TRAP BRICK: Safe\\\\\\\\
datablock ItemData(TrapSafeItem)
{
category = "Item";  // Mission editor category

equipment = true;

//its already a member of item namespace so dont break it
//className = "Item"; // For inventory system

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

//gui stuff
uiName = "Trap Brick: Safe";
iconName = "";
doColorShift = true;
colorShiftColor = "0.000 0.200 0.640 1.000";

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

function SafeTrigger::onEnterTrigger(%this,%trigger,%obj)
{

if($Pref::Server::Weapons == 1)
{
%obj.client.safe = 1;
messageClient(%obj.client,"","\c5You are now in the safe zone");
}
}

function SafeTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
if($Pref::Server::Weapons == 1)
{
%obj.client.safe = 0;
messageClient(%obj.client,"","\c5You are now in the warzone");
}
}

Badspot

  • Administrator
because client.safe doesn't do anything?

you need some moar of this

Code: [Select]
package SafeZone {
function serverCmdSelf Delete(%client)
{
    if(%client.safe) return;
    else { Parent::servercmdSelf Delete(%client); }
}
};
   

that would just allow you to ctrl-K wouldnt it?

it would allow the Self Delete function (Control + k) to return, meaning end, so nothing happens, if %client.safe is true. Which it is if they're in the trigger.
If not, it parents the function, running it normally.

hmm it doesnt protect me from others this is the script

Code: [Select]
////////TRAP BRICK: Safe\\\\\\\\
datablock ItemData(TrapSafeItem)
{
category = "Item";  // Mission editor category

equipment = true;

//its already a member of item namespace so dont break it
//className = "Item"; // For inventory system

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

//gui stuff
uiName = "Trap Brick: Safe";
iconName = "";
doColorShift = true;
colorShiftColor = "0.000 0.200 0.640 1.000";

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

function SafeTrigger::onEnterTrigger(%this,%trigger,%obj)
{

if($Pref::Server::Weapons == 0)
{
%obj.client.safe = 1;
messageClient(%obj.client,"","\c5You are now in the safe zone");
}
}

function SafeTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
if($Pref::Server::Weapons == 1)
{
%obj.client.safe = 0;
messageClient(%obj.client,"","\c5You are now in the warzone");
}
}

package SafeZone {
function serverCmdSelf Delete(%client)
{
    if(%client.safe) return;
    else { Parent::servercmdSelf Delete(%client); }
}
};
 

Have you tried actually spawning the trigger? I don't see how the item will do anything, also get rid of the if($Pref::Server::Weapon) checks as they probably don't do anything.

Also, you need to put

activatepackage(SafeZone);

at the end. I always forget about that.

Self Delete doesnt control weapon damage to my knowledge.

Wow, think about what you're asking.  "Why doesn't my code protect you from death when I've included no code that protects from projectile damage?".  Also, it'd be more appropriate to make it %client.Player.safe = 1.  That way, the %client isn't still save should he respawn outside the safe area.