OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: OFPfreak on 25 Jun 2005, 06:39:14
-
Instead of setvelocity, is there any other way of boosting a vehicle? e.g. some addons have NITRO :o!!!!!!
-
i don't think there are. addons have the benefit of being able to alter the properties of the vehicle in question, and so a nitro script could be incorporated, which probably uses setvelocity itself.
-
There is also the setpos command, although this only changes the position of the vehicle, not it's velocity.
I'm not sure what other ways you would want to 'boost' a vehicle. Perhaps you mean rotation? Not possible unfortunately, but you can 'fake' it with the 'setdir' command (only along 1 axis though).
Perhaps more explaination of what you are trying to do would help?
-
I have a mustang pack with a boost action and a nitro action.
Both have the same effect. If I keep accelerating, it goes 700kph.
If I brake its goes 100kph.
I want my car to go faster above its top speed. Thats what I mean with boost. But I dont want it to jump from 100kph to 300kph in 1 second.
-
Okay, you should use a loop then, which increases the car's velocity by just a little bit each time, so it looks like a smooth acceleration:
#accel
_inc = 1
_car setvelocity [(velocity _car select 0) + _inc*cos getdir _car, (velocity _car select 1) + _inc*sin getdir _car, velocity _car select 2]
? speed _car < 300 && alive _car : goto "accel"Just change _inc to a higher number and the car will accel faster.
-
Just a thought- shouldnt your sin and cosine be the other way around?
EDIT: and the increment needs to be incremented
-
Cool thanks barron dude! Heres what I got to prevent the nitrous from being for ever:
#accel
_inc = 1
_amount = 0
_car setvelocity [(velocity _car select 0) + _inc*cos getdir _car, (velocity _car select 1) + _inc*sin getdir _car, velocity _car select 2]
_amount=_amount+1
_amount>20 : goto "exit"
? speed _car < 300 && alive _car : goto "accel"
#exit
-
Why yes, they should be. :o
You'll have to forgive me, for I just got back from a week-long vacation in sunny Oahu. My brain is a bit scrambled from all the sun and half-naked women.
-
hm wait thats actually not needed since the script stops after 300kph...
-
I could do with some brain scrambling like that :D
And it looks like OFPFreak has taken care of the increment
-
nope sorry ;(!
My car is being boosted nort-east into the air already at huge speed.
:P I added a ~0.5 but my car is still traveling north-east :(!
-
Yup, I forgot to add a delay in there. I'd suggest a ~0.1 to make it nice and smooth. Be sure to switch the sine and cosine like Fragorl said, or else the boost will go in the wrong direction.
And there should be no need to increment _inc, since it just adds a fixed amount to the cars speed each loop, making a smooth (linear) accelleration. If you want it to accel faster and faster, then increment it.
Ugh... me brain fried. Me sleep now.
-
aw don't sleep ;D!
Hopefully it works! HOPEFULLY!!!!!
-
It works! Heres what I got:
#accel
_inc = 1
_amountleft = 0
car1 setvelocity [(velocity car1 select 0) + _inc*sin getdir car1, (velocity car1 select 1) + _inc*cos getdir car1, velocity car1 select 2]
~0.25
_amountleft > 40 : goto "exit"
? speed car1 < 300 && alive car1 : goto "accel"
#exit
exit