Jump to content
Sign in to follow this  
Guest RKSL-Rock

Detecting Decelaration and others

Recommended Posts

Guest RKSL-Rock

Ok I've done a few searchs but I'm not sure exactly wht to look for ....

Within the game engine there are the basic hard coded flight controls etc. Specificlly when you brake an airplane with the 'S' or down arrow the airbrakes open. Obvioulsy there is a flag in the code to operate it.

Is is possible that its something that could be detected and acted on in a script?

The same question goes for pitch roll and yaw?

I suppose this is a Suma question but if anyone knows somethign speak up please.

Share this post


Link to post
Share on other sites

i wanted to know the same, but in terms of making an M113 move faster over water

Share this post


Link to post
Share on other sites
i wanted to know the same, but in terms of making an M113 move faster over water.

All you have to do is detect when the unit is in the water and then simply apply a script that amplifies the velocity, like the turbo scripts found on ofpec. As for the plane stuff, you can detect the pitch and roll by using complex scripts that use the drop command to drop two particles, and on thier destruction place a marker where they used to be, and then use a script to detect the markers position above sea level, and from the difference between the two determine the angle of the plane. Yaw could be determined by calculating the direction of the planes velocity in degrees and measuring that against the planes actual heading (getdir). detecting deceleration is a bit harded, but Operation Frenchpoint has already figured it out.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock
i wanted to know the same, but in terms of making an M113 move faster over water.

All you have to do is detect when the unit is in the water and then simply apply a script that amplifies the velocity, like the turbo scripts found on ofpec. As for the plane stuff, you can detect the pitch and roll by using complex scripts that use the drop command to drop two particles, and on thier destruction place a marker where they used to be, and then use a script to detect the markers position above sea level, and from the difference between the two determine the angle of the plane. Yaw could be determined by calculating the direction of the planes velocity in degrees and measuring that against the planes actual heading (getdir). detecting deceleration is a bit harded, but Operation Frenchpoint has already figured it out.

Any idea where i can take a look at an example?

Share this post


Link to post
Share on other sites
Quote[/b] ]Dschulle wrote a get pitch/bank function

That function is over at OFPEC:

http://www.ofpec.com/editors/funcref.php?filter_func=22

You can also do the same with game logics, you can even attach them to the air brakes (or anything else thats animated) to find there angle. Probably goes for the drop method to.

http://homepages.gotadsl.co.uk/~gssoft/GameLogic.zip

But both of these are heavy functions, it could lag with a lot of stuff going on.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock

Thanks Guys, I'll have a look at these smile_o.gif

Share this post


Link to post
Share on other sites
Guest RKSL-Rock

Ok i'm completely stumped here...

The application is simple... I'd like to create a script to open some animated airbrakes when i decelarate in an aircraft - much the same as the way the hardcoded aeilerons work.

Any ideas? I'm toltally crap at scripts so help would be really appreciated.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#checkspeed

;check to see if plane is slowing

_speedthen=(speed _plane)

~1.5

_speednow=(speed _plane)

; if so and plane is on ground then open chute

?(_speednow < _speedthen) and (getpos _plane select 2)<3 :goto "dragchute"

goto "checkspeed"

This is what I made for the Drag chute on the F100 Super Sabre.

and I use the reverse for the afterburners.

its very basic but it works.

Share this post


Link to post
Share on other sites
Guest RKSL-Rock
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#checkspeed

;check to see if plane is slowing

_speedthen=(speed _plane)

~1.5

_speednow=(speed _plane)

; if so and plane is on ground then open chute

?(_speednow < _speedthen) and (getpos _plane select 2)<3 :goto "dragchute"

goto "checkspeed"

This is what I made for the Drag chute on the F100 Super Sabre.

and I use the reverse for the afterburners.

its very basic but it works.

Thanks mate - you are a star!

Share this post


Link to post
Share on other sites

I too have been looking for a way to increase the speed (in water) of a modified car (for a bond mission).

The car needs to enter the water to escape from a dangerous situation but as it hits the water it slows down to 5 from 185 which to me isn't exactly a speedy getaway.

I am no good at scripting at all and try to learn by seeing other peoples examples.

Can anyone give me any pointers please? (very basic, just like how my brain works LOL)

Parker Hale

Share this post


Link to post
Share on other sites

@RockofSL

This is how Footmunch did his swing wings for the Mig's

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_plane = _this select 0

#MainLoop

?(not alive _plane): goto "Exit"

_fraction = ((speed _plane)-330) / 500

?(fraction > l) : _fraction =1

?(fraction < 0) : _fraction =0

_plane animate ["LeftWing", _fraction]

_plane animate ["RightWing", _fraction]

_plane animate ["LeftTank", _fraction]

_plane animate ["RightTank", _fraction]

~.01

goto "MainLoop"

#Exit

exit

@Parker Hale

For the Car\Boat using setvelocity would do the job, but you need to check when it's on the water. All this in a loop is going to hit system performance, depends what you want your addon used for I guess.

But the speed bit is easy enough:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#Loop

_V=Velocity _Car

_Car SetVelocity [(_V Select 0) * 1.2,(_V Select 1) * 1.2,_V Select 2]

~0.01

goto "Loop"

Changing the value of 1.2 will vary the speed boost, values less than 1 will slow it down.

But like I said knowing when to turn this on and off will be tricky, not to mention the potential lag. Perhaps you could have a user action to turn it on, and a check to turn it off if the speed rises above a certain value, that could only be acheived on land.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#Loop

_V=Velocity _Car

_Car SetVelocity [(_V Select 0) * 1.2,(_V Select 1) * 1.2,_V Select 2]

~0.01

If ((Speed _Car)<_MaxSpeedOnWater) Then {goto "Loop"}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×