Home   Help Search Login Register  

Author Topic: Creating a plane in a script  (Read 1690 times)

0 Members and 3 Guests are viewing this topic.

SimonRussi

  • Guest
Creating a plane in a script
« on: 06 Sep 2002, 15:24:42 »
Ok, i need a script that create a plane and make it flies to a place. I wrote:

_plane = "A10" createvehicle [ x pos, z pos, 0]
_pilot = "SoldierWPilot" createcehicle [x pos, z pos+10, 0]
_pilot moveindriver _plane

it works, the plane is on the ground, the pilot in it and he makes it take off (why that ??? there are no wp's....).

Then i add:
_plane setpos [x pos, z pos, 100]

the plane is now in the air and start falling on the ground (by the way, it starts falling and after a couple of seconds the game hangs and instantly quits to Windows  ??? why that?)

So, what can i do to move it in the air and start flying  to a point without make it falling?

thanks for help...

T.S.C.Plage

  • Guest
Re:Creating a plane in a script
« Reply #1 on: 06 Sep 2002, 18:18:27 »
Select "fly" at the formation of the unit (in the editor)...now it knows that it's in the air and should fly to somewhere.

Greetz
Plage
« Last Edit: 06 Sep 2002, 18:32:10 by T.S.C.Plage »

DeusRich

  • Guest
Re:Creating a plane in a script
« Reply #2 on: 06 Sep 2002, 18:25:13 »
well, as everybody knows ;) - a plane has to be travelling at a significant velocity in order to create enough lift to keep it in the air. However, in most games, they simplify this and don't program all the aerodynamics into the game engine. So, they say, well, say the speed is 50, then that gives it enough lift to tilt to 12 degrees without falling or losing speed, etc etc.

So, you wn't be able to just throw the plane in there as glider dynamics dont work - therefore you will need it to be travelling at about 70 mph/kmph (w/e it is in ofp) to stay in the air - according to the game engine. But whenever you use setpos that just places it somewhere, and any speed it has built up is diminished. And I don't think there is a command to set the velocity of an object.... 2 ways to get around this would be to:
1. change the game engine; practically impossible unless you are a game programmer, so don't even think about it.
2. set it so he flies in advance, unless he is the player, then you could have some probs....

sorry i couldn't be more help. Now if only somebody knows a setvelocity command....

T.S.C.Plage

  • Guest
Re:Creating a plane in a script
« Reply #3 on: 06 Sep 2002, 18:38:31 »
Ooops,

in a script... 8)

Let it start at an height of 800 meters. That should be enough to make it gets it's "glider dynamics".

Should look like this: ;)

800m   \
            \
              \
600m         \
                  \
                    \
400m               \
                        \
                          \
200m                    ------------------>


_________________________________________________

And maybe you should use planename action ["engin on"] in the script.
« Last Edit: 06 Sep 2002, 18:42:49 by T.S.C.Plage »

SimonRussi

  • Guest
Re:Creating a plane in a script
« Reply #4 on: 06 Sep 2002, 18:44:55 »
hmmm.... ok, so no solution  :)

gonna try the 800 mt's kinda solution then....

thank you guyz

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Creating a plane in a script
« Reply #5 on: 07 Sep 2002, 06:01:26 »
well, as everybody knows ;) - a plane has to be travelling at a significant velocity in order to create enough lift to keep it in the air. However, in most games, they simplify this and don't program all the aerodynamics into the game engine.


The OFP engine actually models flight and stall dynamics reasonably well... though not up to the standards of most flight simulators ;)
But what you said is correct... you need quite a velocity to get the aircraft flying. Creating it will make it stationary at a point... something a fixed winged aircraft doesn't like very much ;D

...But whenever you use setpos that just places it somewhere, and any speed it has built up is diminished.

Not so...
If you setpos an object it will carry any inertia it already has.
So if an aircraft is moving South at 120 knots, and you setpos it somewhere else and change it's direction to point north, it will still move South at 120 knots. It will consequently stall of course... but the point is that inertia is kept with the object in a setpos

As for coming up with a solution to the problem at hand... the only couple of things I can think of:
  • Use an already existing flying aircraft, as creating one simply will not work (unless you create it on the ground at an airport)
  • Try Creating the aircraft at an insanely high altitude... hopefully by the time it reaches a normal altitude it will have built up enough airspeed to be over the stall margin (that one is a rather large stab in the dark by the way ;D)


Good Luck...

T.S.C.Plage

  • Guest
Re:Creating a plane in a script
« Reply #6 on: 07 Sep 2002, 08:58:24 »
Hey Sui,

I've used your first solution already and if you "refuel" the plane sometimes it can be used.

Two planes are jumping between two waypoints and on radiocommand they're "beamed" to wp3...

A small problem maybe is the engine sound cause you can here some planes across a whole map.

The second, well that's what I ment. ;)

And of course you're right with the "inertia".

Greetz
Plage