Blockland Forums > Modification Help
Problem with onLeave in a trigger
Game master pro:
I'm making a trigger that kills you when you leave it, but it's not working.
This is the code for the trigger.
--- Code: ---datablock TriggerData(GameArena)
{
tickPeriodMS = 100;
};
function GameArena::onEnterTrigger(%this,%trigger,%obj)
{
//lol nothing to do here
}
function GameArena::onLeaveTrigger(%this,%trigger,%obj)
{
%obj.client.kill();
bottomprint(%obj.client,'',"\c2Do not leave the game arena",5);
}
--- End code ---
But when i stand inside the trigger, i just get my console spammed with.
--- Code: ---TriggerData::onTickTrigger - wrong number of arguments.
usage: (Trigger t)
--- End code ---
And when i leave the trigger, i get '104' bottomprinted, and then i get
--- Code: ---Unknown command kill.
Object LocalClientConnection(4852) GameConnection -> GameConnection -> NetConnection -> SimGroup -> SimSet -> SimObject
--- End code ---
Can anyone help?
Safe The Vault:
This works.
--- Code: ---datablock TriggerData(GameArena)
{
tickPeriodMS = 100;
};
function GameArena::onEnterTrigger(%this,%trigger,%obj)
{
//lol nothing to do here
}
function GameArena::onLeaveTrigger(%this,%trigger,%obj)
{
%obj.player.client.kill();
bottomprint(%obj.client,"\c2Do not leave the game arena",5);
}
--- End code ---
-=>RR<=-MasterCE:
You should add a check to see if the %obj is a player by doing if(%obj.client)
Game master pro:
--- Quote from: Safe The Vault on June 06, 2007, 10:48:36 PM ---This works.
--- Code: ---datablock TriggerData(GameArena)
{
tickPeriodMS = 100;
};
function GameArena::onEnterTrigger(%this,%trigger,%obj)
{
//lol nothing to do here
}
function GameArena::onLeaveTrigger(%this,%trigger,%obj)
{
%obj.player.client.kill();
bottomprint(%obj.client,"\c2Do not leave the game arena",5);
}
--- End code ---
--- End quote ---
I still get the
TriggerData::onTickTrigger - wrong number of arguments.
usage: (Trigger t)
spam, the bottomprint works now, but i don't get killed, it just says.
Unable to find function '' attempting to call function 'kill'
Safe The Vault:
My bad. "%obj.player.client.kill();" should be "%obj.kill();"