Home   Help Search Login Register  

Author Topic: setvelocity? anything else?  (Read 1972 times)

0 Members and 1 Guest are viewing this topic.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
setvelocity? anything else?
« 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!!!!!!
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:setvelocity? anything else?
« Reply #1 on: 25 Jun 2005, 08:06:28 »
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.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:setvelocity? anything else?
« Reply #2 on: 25 Jun 2005, 08:51:04 »
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?
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #3 on: 25 Jun 2005, 09:01:34 »
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.
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:setvelocity? anything else?
« Reply #4 on: 25 Jun 2005, 09:05:26 »
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:

Code: [Select]
#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.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:setvelocity? anything else?
« Reply #5 on: 25 Jun 2005, 09:07:18 »
Just a thought- shouldnt your sin and cosine be the other way around?

EDIT: and the increment needs to be incremented
« Last Edit: 25 Jun 2005, 09:12:25 by Fragorl »

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #6 on: 25 Jun 2005, 09:11:55 »
Cool thanks barron dude! Heres what I got to prevent the nitrous from being for ever:

Code: [Select]
#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
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:setvelocity? anything else?
« Reply #7 on: 25 Jun 2005, 09:12:33 »
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.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #8 on: 25 Jun 2005, 09:12:43 »
hm wait thats actually not needed since the script stops after 300kph...
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:setvelocity? anything else?
« Reply #9 on: 25 Jun 2005, 09:14:01 »
I could do with some brain scrambling like that :D

And it looks like OFPFreak has taken care of the increment

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #10 on: 25 Jun 2005, 09:19:51 »
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 :(!
« Last Edit: 25 Jun 2005, 09:21:25 by OFPfreak »
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:setvelocity? anything else?
« Reply #11 on: 25 Jun 2005, 09:35:28 »
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.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #12 on: 25 Jun 2005, 09:39:01 »
aw don't sleep ;D!
Hopefully it works! HOPEFULLY!!!!!
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:setvelocity? anything else?
« Reply #13 on: 25 Jun 2005, 09:42:38 »
It works! Heres what I got:

Code: [Select]
#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
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage