Home   Help Search Login Register  

Author Topic: from 120 km/h to 0 km/h  (Read 9869 times)

0 Members and 1 Guest are viewing this topic.

Plizkin

  • Guest
from 120 km/h to 0 km/h
« on: 13 Mar 2003, 16:00:20 »
Hi there,
Is it possible to create a script which slows down an airplane from some speed to zero? ???

e.g.:

A C130 wants to land on an air craft carrier. The c130 is one mile from landing. It travels at 120 km/h. To not fall down it needs to catch the hook. Because there are no hooks in Operation Flashpoint it has to be scripted down from 120 km/h to 0 km/h.

Summary:
Slowing down an airplane to 0 km/h. Is that possible?

p.s.: When is the american air craft carrier completed? I am waiting for it since 7 months.  ???

Ace

  • Guest
Re:from 120 km/h to 0 km/h
« Reply #1 on: 13 Mar 2003, 16:56:20 »
Try plane setvelocity [0,0,0]

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:from 120 km/h to 0 km/h
« Reply #2 on: 13 Mar 2003, 18:33:44 »
C-130's can land on aircraft carriers? :o
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:from 120 km/h to 0 km/h
« Reply #3 on: 13 Mar 2003, 18:45:11 »
do u have a aircraft carrier if so give me a link please

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:from 120 km/h to 0 km/h
« Reply #4 on: 13 Mar 2003, 19:05:22 »
Quote
Try plane setvelocity [0,0,0]

that prolly won't work, because it does nothing. it sets no velocity.

What you'd want to do is set some negative velocity on the plane.

Fool around with this:

plane setVelocity [-200*(sin(getDir plane)),-200*(cos(getDir plane)),0]

« Last Edit: 13 Mar 2003, 19:05:43 by Artak »
Not all is lost.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:from 120 km/h to 0 km/h
« Reply #5 on: 13 Mar 2003, 21:42:42 »
Actually, I think setvelcocity [0,0,0] would work. Let us know if it does or doesn't.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Iwesshome

  • Guest
Re:from 120 km/h to 0 km/h
« Reply #6 on: 13 Mar 2003, 21:50:08 »
Now I am confused....

Quote
Actually, I think setvelcocity [0,0,0] would work. Let us know if it does or doesn't.


If my plane is traveling 120Km and I want it to go to 80km what would it that look like?

Also vise versa....

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:from 120 km/h to 0 km/h
« Reply #7 on: 13 Mar 2003, 23:12:06 »
try this:

What this will do, is set the velocity of the plane to half of its current velocity, by dividing each of its velocity vectors (or whatvere they're called) by two....

Code: [Select]
_vel = velocity plane
_velx = _vel select 0
_vely = _vel select 1
_velz = _vel select 2
plane setvelocity [(_velx / 2),(_vely / 2),(_velz / 2)]

If you wanted to double the plane's velocity you would multiply instead of divide, like so...

Code: [Select]
_vel = velocity plane
_velx = _vel select 0
_vely = _vel select 1
_velz = _vel select 2
plane setvelocity [(_velx * 2),(_vely * 2),(_velz * 2)]

Here is an example (from memory) of a peice of code I used in a "nitro boost" script for vehicles....

Code: [Select]
_vehicle = vehicle (_this select 1)

#nitroboost
_vehicle setvelocity [(velocity _vehicle select 0) * 1.1,(velocity _vehicle select 1) * 1.1,(velocity _vehicle select 2) * 1.1]
?_time > 3:exit
~0.1
goto "nitroboost"

This peice of code was started via an action and would multiply the player's vehicles velocity by 1.1 over and over for 3 seconds. I was semi realistic.


To specifically answer your question:

OK 120/80 = 1.5
So your goal velocity is 120/1.5 (80)
CHeck this out. YOU would initiate like so:

[vehicle,goalspeed,rateofchange] exec "changevel.sqs"

[airplane1,0,0.05] exec "changevel.sqs"

Code: [Select]
_vehicle = _this select 0
_goal = _this select 1
_rate = _this select 2
_speed = speed _vehicle
_ratio = _speed / _goal
?_speed > _goal:goto "slowdown"
goto "speedup"


#slowdown
_vehicle setvelocity [(velocity _vehicle select 0) / 1.05,(velocity _vehicle select 1) / 1.05,(velocity _vehicle select 2) / 1.05]
~rate
?speed _vehicle < _goal:exit
goto "slowdown"


#speedup
_vehicle setvelocity [(velocity _vehicle select 0) * 1.05,(velocity _vehicle select 1) * 1.05,(velocity _vehicle select 2) * 1.05]
~rate
?speed _vehicle > _goal:exit
goto "speedup"
« Last Edit: 13 Mar 2003, 23:53:55 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Iwesshome

  • Guest
Re:from 120 km/h to 0 km/h
« Reply #8 on: 13 Mar 2003, 23:43:03 »
Dosen't sound to complicated.... well here goes.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:from 120 km/h to 0 km/h
« Reply #9 on: 13 Mar 2003, 23:55:17 »
BTW, I found a bug in that last script I posted. I never ested it so there are probably more bugs. If you can't get it to work then Ill tst it out later.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:from 120 km/h to 0 km/h
« Reply #10 on: 14 Mar 2003, 03:48:29 »
This script will work as a landing hook simulator or a catapult simulator for Aircraft Carriers.

It is executed like so:

[vehicle,desiredspeed,rateofchange] exec "changevel.sqs"

If you wanted to simulate a landinghook for a plane named "tomcat", then you would inistialize it something like this:

[tomcat,0,0.2] exec "changevel.sqs"

If you wanted to simulate a catapult for a plane named "tomcat", then you would initialize it something like this:

[tomcat,200,0.2] exec "changevel.sqs"


Code: [Select]
_vehicle = _this select 0
_goal = _this select 1
_rate = _this select 2
_speed = speed _vehicle
?_speed > _goal:goto "slowdown"
goto "speedup"


#slowdown
_vehicle setvelocity [(velocity _vehicle select 0) / 1.05,(velocity _vehicle select 1) / 1.05,(velocity _vehicle select 2) / 1.05]
~_rate
?speed _vehicle <= _goal:exit
goto "slowdown"


#speedup
_vehicle setvelocity [(velocity _vehicle select 0) * 1.05,(velocity _vehicle select 1) * 1.05,(velocity _vehicle select 2) * 1.05]
~_rate
?speed _vehicle >= _goal:exit
goto "speedup"
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:from 120 km/h to 0 km/h
« Reply #11 on: 14 Mar 2003, 07:49:02 »
Not sure, if this info below may help aswell here

SUMA himself explained 3 new entries which came
with the 1.90 patch:

Code: [Select]
There are several new config entries for planes in 1.90 that could help addon creators, especially for planes that are much smaller or bigger than the default OFP planes:

Code Sample  
landingSpeed = 0;
flapsFrictionCoef = 0.5;
wheelSteeringSensitivity = 1.0;
 


landingSpeed

This entry tell AI autopilot what speed it should use when landing. It does not determine stall or landing speed, it is used to inform AI what the landing speed is. If zero (default) is given, landing speed is calculated as:

landingSpeed = max(maxSpeed/3, 120 km/h)

flapsFrictionCoef

This tells how much friction flaps cause when fully applied. Total airplane friction is modified as follows.

result_friction = air_friction * ( 1+ flap_state*flapsFrictionCoef)

wheelSteeringSensitivity

Use this to make airplane more or less steerable when taxiing. Bigger means value - smaller turn radius possible.

Using those entries will not cause any problem when addon is used with older OFP version, and it will improve addon in 1.90.

--------------
Ondrej Spanel, BIS Lead Programmer

And here's the link to the thread at BIS forum:

http://www.flashpoint1985.com/cgi-bin/ikonboard301/ikonboard.cgi?act=ST;f=51;t=24371

~S~ CD
« Last Edit: 14 Mar 2003, 07:52:02 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Plizkin

  • Guest
Re:from 120 km/h to 0 km/H
« Reply #12 on: 14 Mar 2003, 15:49:41 »
as much I know can C130`s land on aircraft carriers.    ;)

Plizkin

  • Guest
Re:from 120 km/h to 0 km/h
« Reply #13 on: 14 Mar 2003, 16:50:54 »
here is a link for the Aircraft carrier (Its not finished, so please, please help  :'(them !) :

http://www.angelsofchaos.com/modules.php?op=modload&name=News&file=article&sid=50&mode=thread&order=0&thold=0


p.s: Can someone tell me, how to make that fuckin damn shit Links ?  ;D

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:from 120 km/h to 0 km/h
« Reply #14 on: 14 Mar 2003, 18:06:40 »
I'm pretty certain that C-130s are too big to land on carriers, but I have no data to back up my claim.

In any event, I think you should leave out the adjustment to the z-velocity in those scripts.  Afterall, the arrester hook does not make the plane stop moving vertically, eh?
Ranger