OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Plizkin on 13 Mar 2003, 16:00:20

Title: from 120 km/h to 0 km/h
Post by: Plizkin 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.  ???
Title: Re:from 120 km/h to 0 km/h
Post by: Ace on 13 Mar 2003, 16:56:20
Try plane setvelocity [0,0,0]
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 13 Mar 2003, 18:33:44
C-130's can land on aircraft carriers? :o
Title: Re:from 120 km/h to 0 km/h
Post by: WizzyWig on 13 Mar 2003, 18:45:11
do u have a aircraft carrier if so give me a link please
Title: Re:from 120 km/h to 0 km/h
Post by: Artak 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]

Title: Re:from 120 km/h to 0 km/h
Post by: toadlife 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.
Title: Re:from 120 km/h to 0 km/h
Post by: Iwesshome 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....
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife 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"
Title: Re:from 120 km/h to 0 km/h
Post by: Iwesshome on 13 Mar 2003, 23:43:03
Dosen't sound to complicated.... well here goes.
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife 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.
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife 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"
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death 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
Title: Re:from 120 km/h to 0 km/H
Post by: Plizkin on 14 Mar 2003, 15:49:41
as much I know can C130`s land on aircraft carriers.    ;)
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin 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
Title: Re:from 120 km/h to 0 km/h
Post by: Ranger 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?
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 14 Mar 2003, 19:26:10
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?

Yeah you could probably remove that, but in my testing it seemed totally realistic. I have a demo mission that I should post. If you come down to hard and the "hook" catches you, the z velocity adjustment doesn't help - you still blow up. :P

I set my test mission up so that the hook will only activate if your altitude is 2 meters or lower.

Title: Re:from 120 km/h to 0 km/h
Post by: Sui on 14 Mar 2003, 23:18:54
LOL ;D

Large transport aircraft (such as a C-130) can't land on carriers I'm afraid (though maybe they can in OFP :))

It's not a question of runway length (as you've got arrester cables and the catapult), it's a question of landing gear strength.

All aircraft used in carrier ops have to have heavily reinforced landing gear to withstand take-offs and landings. The larger (Heavier) the aircraft, the stronger the landing gear has to be...

The forces acting on a C-130's gear if it tried to land on a carrier would be incredible ;)
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 17 Mar 2003, 14:51:45
hey toadlife,

Simulate a landinghook:

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

Simulate a catapult:

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


SCRIPT:
=======================================================

_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"
=======================================================

Sorry, this script don`t work. There is a error. I think, my computer don`t know the word "setvelocity".
=======================================================

p.s.:  So much I know, they will first relase the Aircaft carrier from the World War 2, then the American Aircaft carrier. Fuck, I`m waiting motherfuckin 7 month for it. They ever said, yeees, tomorow we`ll relase it. But the next day they said the same shit.

Okay my friends, please make a script without errors or a script with words, which my computer know ! Or I need a new config.bin (Sorry for my shitty english)  ;D
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 18 Mar 2003, 02:18:38
Sorry, this script don`t work. There is a error. I think, my computer don`t know the word "setvelocity".

It does too work. I tested that script thouroghly before I pasted it in. I can check in again.
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 18 Mar 2003, 02:43:10
Here is an example mission. You start of in an A-10 directly south of the landing strip on the tip of everon. You must touch down right at the beggining of the landing strip or the hook will not catch you.

After succesfully landing and stopping, taxi forward a bit and the same script will catapult you to 200 knots.

Little hints will tell you when the landing hook and catapult are activated.

Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 20 Mar 2003, 15:41:31
which version are you using ? I`m using v1.75 ! Could you send me your "config.bin" and "resource.bin", please ? Maybe it works then. ??? I try it, THERE IS A ERROR >:(. Belive me. If I fly in the trigger, I can just read your hint "Landing hook activated" or "Catapult activated".
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 20 Mar 2003, 15:59:01
if you tell me, how to upload pic`s, then I can show my screenshot with the error.  ;D
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death on 20 Mar 2003, 17:37:00
Quote
which version are you using ? I`m using v1.75 !

lol - why don't you upgrade to a version, where setvelocity
command is supported?

Code: [Select]
vehicle setVelocity [x, z, y]
Operand types:
    vehicle: Object
    [x, z, y]: Array
Compatibility:
    Version 1.8 required.
Type of returned value:
    Nothing
Description:
    Set velocity (speed vector) of vehicle.


especially watch this line: Version 1.8 required.

~S~ CD
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 21 Mar 2003, 06:49:56
LMAO!!!
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 21 Mar 2003, 15:00:54
could you make a mission, please ? I`m too stupid to do that   :-\
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death on 21 Mar 2003, 15:16:07
Quote
could you make a mission, please ? I`m too stupid to do that  

Does this mean you've already upgraded to a version
higher than 1.75?  ;)

~S~ CD
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 21 Mar 2003, 15:19:30
no, its 1.75 yet
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death on 21 Mar 2003, 15:51:48
Then read again reply #22

~S~ CD
Title: Re:from 120 km/h to 0 km/h
Post by: granQ on 22 Mar 2003, 13:42:50
thanks toadlife, i hope you don't mind if i use this script in a addon?

Just remove the "z" lowering and it will be almost perfect for my "crashstop". Just gonna see if i can do a nice splash effect with the drop commando.
Title: Re:from 120 km/h to 0 km/h
Post by: toadlife on 22 Mar 2003, 22:16:29
thanks toadlife, i hope you don't mind if i use this script in a addon?


Please do. You may have to tweak it a bit, as I didn't do a whole heck of alot of testing on it, but it's a good 'proof of concept' script.  :thumbsup:
Title: Re:from 120 km/h to 0 km/h
Post by: Kaboom on 23 Mar 2003, 21:12:48
A little bit off-topic, but if you think a C-130 can't land on an aircraft carrier, then you should have a look at

http://www.theaviationzone.com/factsheets/c130_forrestal.asp#videos

It contains a landing and a takeoff video of an US Navy experiment that shows that even a C-130 can land on and start from aircraft carriers. There's also some very interesting information on this site on that experiment as well.

Have fun,
-Kaboom
Title: Re:from 120 km/h to 0 km/h
Post by: Sui on 24 Mar 2003, 01:11:20
Well I never....

Looks like I was wrong... ;D
but I don't think they'd be able to operate it off a carrier regularly without replacing the landing gear at every 100 hour check! ;)
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 25 Mar 2003, 15:18:23
you see ? I`m right. 8)

But whats with the MISSION ?
I like a MISSSSSSSIIIIIOOOOOONNNNNN !
WIIIIIIITTHHHHH THE SCRIIIIIIIPTTTT !!!
please.     :P
v1.75
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 25 Mar 2003, 15:23:09
do you know, why I won`t update my OFP ?
alsoooo:
I`ve more than 511 AddOns in my AddOns folder. If I update    
my OFP, I can delete them.
If I mustnÂ't delete them, please, please give me a link for update
1.75 to 1.85, or which version you`re ever using...  :-\
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death on 25 Mar 2003, 15:26:00
Plizkin
1) You don't need to delete your addons, when upgrading
to a higher version.

2) A link to where you can get the latest patch (1.91)
you will find on the very first page at OFPEC

www.ofpec.com

~S~ CD
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 25 Mar 2003, 15:32:25
I mustn`t ?  That`s fuckin coooool  ;D
But, can I use them then, yet ?
Aaand, you promise ?

Aaand, which version are you using ?
Title: Re:from 120 km/h to 0 km/h
Post by: Chris Death on 25 Mar 2003, 16:29:36
I won't promise you anything  ;)

I can only tell you what i've read and experienced for
myself: addons aren't causing problems when it comes to
patches.

I also won't promise anything because i don't know what else
you were doing with your OFP.

But what i can promise you is:

If you make a backup-copy of your actual OperationFlashopint
folder (to somewhere else on your harddisk), you can do everything you want with your OFP because you still have
a working backup beside  ;)

~S~ CD
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 25 Mar 2003, 17:18:00
 okay, lets try v1.91, yeeeehhaaaaaaaa   8)
Title: Re:from 120 km/h to 0 km/h
Post by: Sui on 26 Mar 2003, 00:41:02
Plizkin,

Could you please stop posting crap?

A page and a half of please's is compeltely unnecessary ::)
Title: Re:from 120 km/h to 0 km/h
Post by: Plizkin on 27 Mar 2003, 15:33:09
Thank you, Chris Death and toadlife ! You make me really happy !
My next problem is: (I know, thats not the right thread, but...)

i made a music addon. I saved it as a .pbo. and put it in my AddOns folder. Furthermore i put a Description.ext there. It doesn`t work. So i put a config.cpp in it.. The problem is, i cannot use it in the editor. What do i have to do to use it in the Editor?   ???
Title: Re:from 120 km/h to 0 km/h
Post by: CBFASI on 17 May 2003, 22:10:37
Well Toadlife, your Arrestor and Catapult scripting works great...

A few requests (if its possible that is!)

The Catapult
Can it be made that when you hit the catapult trigger it asks for you to lock on, then asks for you to launch??.
It coudl say when locked to the Catapult stop you from movign even if at fullpower, so like the real things your at fullpower as you take off, when released that is.
This idea would solve a problem in that anything that hits the trigger gets catapulted, looks a bit funny if you not in a plane..

Also, an idea for the Arrestor wires..
Possibly having a larger range trigger that as you to put you hook down (I know it wont visually at this time), and the arrestors would only work if a hook was down, also if the hook is still down after you land you cannot move..
This would mean that aircarft could roll over the arrestor wires without them getting 'caught'


Oh Yes... Some piccies.

These are trials on my new (older) version of HMS Hermes, using the scripts that Toadlife has created.

Take off..
(http://www.ironfoot.net/~cbfasi/picsforums/Hrm68-01.jpg)

Landing..
(The two guys are used as ils for long range approaches, they parrellel to landing run)
(http://www.ironfoot.net/~cbfasi/picsforums/Hrm68-02.jpg)

Opps.. Low speed takeoff after effect....
(http://www.ironfoot.net/~cbfasi/picsforums/Hrm68-03.jpg)

During these trials I used the COC swimmer to ensure that even if I ditched I could return to the carrier.

Title: Re:from 120 km/h to 0 km/h
Post by: Pliskin on 19 May 2003, 15:13:33
its under the water, isn`t it ? Like the LSD.

I  know that and I fuckin hate it ! >:(  
Title: Re:from 120 km/h to 0 km/h
Post by: CBFASI on 19 May 2003, 18:13:58
The plane I used to take off is underwater.. yes (if thats what you mean)
Title: Re:from 120 km/h to 0 km/h
Post by: KevBaz on 19 May 2003, 19:49:29
A4 landing on Hermes (http://www.kevbaz.com/A4testlanding.avi)

600k approx
Title: Re:from 120 km/h to 0 km/h
Post by: Pliskin on 20 May 2003, 15:02:33
KevBaz his Carrier doesn`t sink. But, is it the same carrier ?



ps.  When you`ll relase USS Hermes ?
Title: Re:from 120 km/h to 0 km/h
Post by: KevBaz on 20 May 2003, 15:20:12
i dont get what u mean by the carrier sinking.....


also its HMS not USS as its British carrier, and erm well its our m8 www.flashpoint1982.co.uk :D
Title: Re:from 120 km/h to 0 km/h
Post by: Pliskin on 20 May 2003, 17:28:18
Sorry. I mean   HMS , and not USS .
Please don`t kill me now, let me alive.  ;)


And, I`ve got some question again:
1.) How many Planes can it Carry ?
2.) How many Soldier can it Carry ?
3.) How many Car`s can it Carry ?
4.) Can the AI`s land on it ?



DONÂ'T FORGET:  ITÂ'S     HMS

Title: Re:from 120 km/h to 0 km/h
Post by: CBFASI on 20 May 2003, 18:09:43
Hermes is out (if you hadn't already noticed...)

It uses the scripts that Toadlife has made to great affect..

http://www.ofpec.com/yabbse/index.php?board=14;action=display;threadid=9622;start=0;boardseen=1 (http://www.ofpec.com/yabbse/index.php?board=14;action=display;threadid=9622;start=0;boardseen=1)