46
Suggestions & Requests / Re: Jetpack system - needs scripter
« on: February 23, 2013, 09:40:16 AM »Code: [Select]
package JetPackEmitter {
function Armor::onTrigger(%datablock,%player,%slot,%val)
{
//Armor::onTrigger is called whenever a player jumps, jets, crouches, etc.
//Each of these actions is assigned to a particular slot.
//The jet slot is 4 and because this function is called when a variety of actions are performed, we want to make sure the jet action triggered this function.
if(%slot == 4)
{
//%val is a boolean stating whether or not action is occurring or not.
//If %val is 1 then jets are on.
if(%val)
{
if(%player.getMountedImage(2) $= nameToID(JetpackImage))
{
%player.getMountedImage(2).mountImage(emitterImage,1);
}
}
//If %val is 0 then jets are not on.
else
{
if(%player.getMountedImage(2) $= nameToID(JetpackImage))
{
%player.getMountedImage(2).unMountImage(1);
}
}
}
return Parent::onTrigger(%datablock,%player,%slot,%val);
}
};
activatePackage(JetPackEmitter);This should be the basic code you asked for. I commented stuff so you could understand some of it as I know you were trying to understand it somewhere else.EDIT: Fixed a function. Oh and replace the JetpackImage and EmitterImage with the appropriate image names (I assume you knew that, but just checking).