Author Topic: Jetpack system - needs scripter  (Read 6551 times)

shouldn't the jet be an item instead?
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.

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).
« Last Edit: February 23, 2013, 09:46:30 AM by Daenth »

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: [Select]
datablock PlayerData(PlayerFuelJetLimited : PlayerFuelJet){
uiName = "Limited Fuel-Jet Player";
rechargeRate = 0;
jetEmitter = "";
jetGroundEmitter = "";};

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.
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.

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);
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).
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
« Last Edit: February 23, 2013, 12:35:26 PM by Demian »

Can someone send me a working version that I can try out on my own serveR?


anyone up for something more original?
Horrable.
Edited for less offensive way of saying your "jetpack" sucks.
« Last Edit: February 24, 2013, 01:46:18 AM by superdupercoolguy »

Can someone send me a working version that I can try out on my own serveR?
There is no working version yet.


Well how's the script?
In the process of figuring out why the state system isn't cooperating with the image.

In the process of figuring out why the state system isn't cooperating with the image.
If you are using stateTransitionOnAmmo[] and/or stateTransitionOnLoaded[], be sure to set the image ammo/loaded when it gets mounted to the right value.
I had some trouble with this last week and figured out that i forgot to set the ammo value when it got mounted.

On top of that, when you use a transitionOnTimeout, it can really become an annoyance.
If you really can't figure out what is going wrong, you can of course use echo'ing in every state.
Though that tends to spam the console. :P


anyone up for something more original?
Holy forget Lego Universe.
I LOVE that game!


Holy forget Lego Universe.
I LOVE that game!

Loved*

I'm still disappoint...

Yeah. This died because you can't mount images to other images. In other words no jetpack flames.

Yeah. This died because you can't mount images to other images. In other words no jetpack flames.
you can mount images and reposition them...