Blockland Forums > Suggestions & Requests
Jetpack system - needs scripter
Demian:
--- Quote from: Fob on February 23, 2013, 08:11:39 AM ---shouldn't the jet be an item instead?
--- End quote ---
You spawn the jet pack item. Pick it up and it goes into your inventory. You scroll over the item and click to mount it to your back, at the same time it disappears from your hand but not from the inventory. To take it off your simply scroll over the item in your inventory and click.
Daenth:
--- Code: ---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);
--- End code ---
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).
MARBLE MAN:
--- Quote from: Demian on February 23, 2013, 07:29:34 AM ---It's nice that MARBLE MAN showed interested but what he did was nothing like what I asked. What he did is completely useless that can be done better by changing three variables in a playertype.
His add-on is a playertype that gains vertical velocity very fast when you hold down right click. It uses the default energy system for jetting and once you run out you stop jetting. Sounds a lot like the fuel jet player. That's exactly what it is with two crucial differences: the fuel jet player recharges the energy over time, and the fuel jet jetting is much smoother and better than this. In fact his playertype feels a lot like the old v0002 playertype and it would not be surprised if parts of it were copied from there.
Here, let me recreate his add-on except with much better feeling jetting in 5 lines.
--- Code: ---datablock PlayerData(PlayerFuelJetLimited : PlayerFuelJet){
uiName = "Limited Fuel-Jet Player";
rechargeRate = 0;
jetEmitter = "";
jetGroundEmitter = "";};
--- End code ---
I did not ask for a playertype. I did not ask anyone to recreate the jetting system. All I wanted was to mount image A into slot 1 of image B when you press the jet button.
--- End quote ---
nope, the code was basically a large revision of the jedi player, and i thought you wanted jetting to be slightly changed. I apologize for not giving you exactly what you wanted, I will read over all the specifications (if they are in one place) to make it more exact next time.
Demian:
--- Quote from: Daenth on February 23, 2013, 09:40:16 AM ---
--- Quote ---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);
--- End quote ---
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).
--- End quote ---
Looks very promising but it doesn't work. I've manually tried using those commands in the console and they all return sensible values and the logic holds. I'll PM you the add-on.
Edit: Daenth is offline at the moment, here's the necessary scripts if anyone else wants to figure out why it doesn't work: http://pastebin.com/2TYcZxRH
Thé Lord Tony:
Can someone send me a working version that I can try out on my own serveR?