Author Topic: Ontrigger  (Read 1133 times)

simple question, how would I go about making it so whenever a certain playertype shoots/jumps(i dont care which) his x, y, and z are added to an amount getrandom(-100,100) ?
i tried this but failed horribly.
Code: [Select]
datablock PlayerData(Playerghost : PlayerStandardArmor)
{
uiName = "Ghost Player";
};
package ghostyay
{
function Playerghost::ontrigger(%this, %obj, %triggerNum, %val)
{
%this.z+=getrandom(-100,100);
%this.y+=getrandom(-100,100);
%this.x+=getrandom(-100,100);
}
};
activatepackage(ghostyay);
anyhelp is appreciated. thank you for your time.

datablock PlayerData(Playerghost : PlayerStandardArmor)
{
uiName = "Ghost Player";
};
package ArmorOver
{
 function PlayerGhost::onTrigger(%this,%player,%slot,%trigger)
 {
  if(%slot !$= "4"){Parent::onTrigger(%this,%player,%slot,%trigger);return;}
  %player.setVelocity(getRandom(-100,100) SPC getRandom(-100,100) SPC getRandom(-100,100));
 }
};
activatePackage(ArmorOver);

--
That's when you jet, you get boosted in a random direction. Experiment with %slot !$= [number] and the -100 to 100 values.

Thank you, that was very helpful.