Author Topic: Directional Jetting  (Read 1317 times)

-awesomecode-
I only seem to jet normally when using that - I'm not moving in any direction apart from upwards.

Edit: Trying somthing...

That's why i said:

//assuming this is correct.
%this.addVelocity(%player.getEyeVector());

Treynolds will come in here with the sorcery math to help you out.

That's why i said:

//assuming this is correct.
%this.addVelocity(%player.getEyeVector());

Treynolds will come in here with the sorcery math to help you out.
Okay

Modified the script a little:
Code: [Select]
package directionaljet
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
parent::onTrigger(%this, %player, %slot, %val);

if(%slot == 4 && %val == 1)
{
%player.directionalJet(%player,1);
}
else
if(%slot == 4 && %val == 0)
{
%player.directionalJet(%player,0);
}
}
};
activatePackage(directionaljet);

function player::directionalJet(%this,%bool)
{
if(%bool)
{
cancel(%this.djl);

//assuming this is correct.
%this.addVelocity(%player.getEyeVector());

%this.djl = %this.schedule(1,directionalJet,%bool);
}
else
{
return 0;
}
}

Okay

Modified the script a little:
Code: [Select]
package directionaljet
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
parent::onTrigger(%this, %player, %slot, %val);

if(%slot == 4 && %val == 1)
{
%player.directionalJet(%player,1);
}
else
if(%slot == 4 && %val == 0)
{
%player.directionalJet(%player,0);
}
}
};
activatePackage(directionaljet);

function player::directionalJet(%this,%bool)
{
if(%bool)
{
cancel(%this.djl);

//assuming this is correct.
%this.addVelocity(%player.getEyeVector());

%this.djl = %this.schedule(1,directionalJet,%bool);
}
else
{
return 0;
}
}

That's wrong... because %this is the player. plus, now the %bool will be the player, and what is supposed to be the bool, won't even be in the function at all...

Several things:
- Elm's code has some unnecessary formatting, but that doesn't affect anything
- To get this code to work, you have to scale the eye vector by another number because the length of the vector is only one. I recommend 10
- your player will still have the same upwards velocity as it does when jetting normally. There are several ways to attempt to fix this, if you even want to

Try this, because I put %player.getEyeVector when it was supposed to be %this lol:



Code: [Select]
package directionaljet
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
parent::onTrigger(%this, %player, %slot, %val);

if(%slot == 4 && %val == 1)
{
%player.directionalJet(1);
}
else
if(%slot == 4 && %val == 0)
{
%player.directionalJet(0);
}
}
};
activatePackage(directionaljet);

function player::directionalJet(%this,%bool)
{
if(%bool)
{
cancel(%this.djl);

//assuming this is correct.
%this.addVelocity(%this.getEyeVector());

%this.djl = %this.schedule(1,directionalJet,%bool);
}
else
{
return 0;
}
}

Try this, because I put %player.getEyeVector when it was supposed to be %this lol:



Code: [Select]
package directionaljet
{
function Armor::onTrigger(%this, %player, %slot, %val)
{
parent::onTrigger(%this, %player, %slot, %val);

if(%slot == 4 && %val == 1)
{
%player.directionalJet(1);
}
else
if(%slot == 4 && %val == 0)
{
%player.directionalJet(0);
}
}
};
activatePackage(directionaljet);

function player::directionalJet(%this,%bool)
{
if(%bool)
{
cancel(%this.djl);

//assuming this is correct.
%this.addVelocity(%this.getEyeVector());

%this.djl = %this.schedule(1,directionalJet,%bool);
}
else
{
return 0;
}
}
Trying...

Assuming that by "scale" Treynolds meant multiply:
Code: [Select]
%this.getEyeVector()*10

Assuming that by "scale" Treynolds meant multiply:
Code: [Select]
%this.getEyeVector()*10

Code: [Select]
%this.addVelocity(vectorScale(%this.getEyeVector(),10));

It's a vector, so you have to use vectorScale(vec,scale)
« Last Edit: August 17, 2012, 01:10:49 PM by Treynolds416 »

It's a vector do you have to use vectorScale(vec,scale)
Oh, right.

It works now, but I can't turn it off by any means other than ctrl-k, which gets difficult to handle

It works now, but I can't turn it off by any means other than ctrl-k, which gets difficult to handle

Oops, where it says return 0 in the function, put cancel(%this.djl); above it.

Okay, one more thing:
How exactly do I get rid of the normal up velocity?


Edit: Never mind, it's fine. Thanks, guys!
« Last Edit: August 17, 2012, 03:39:39 PM by chrisbot6 »