Home   Help Search Login Register  

Author Topic: createunit  (Read 697 times)

0 Members and 1 Guest are viewing this topic.

Offline TonyRanger

  • Members
  • *
  • I'm a llama!
createunit
« on: 18 May 2004, 13:22:31 »
how to create a chopper like V-80 and it's "FLYING" by using the command"createunit"

Offline nEO iNC

  • Contributing Member
  • **
Re:createunit
« Reply #1 on: 18 May 2004, 16:46:20 »
Hey TonyRanger, no problem creating the pilot, not a problem creating the v80... creating both and immediately having them flying... Hummm...

to create the v80;

heli = "v80" createvehicle getpos helistart*

*(helistart can be anything, a game logic would work well. Just name it helistart. Don't add asterisk)  

to create the pilot;

"soldierepilot" createunit [(getpos helistart), solbase,"this moveindriver heli",0.5,"private"]

You need to have an east soldier on the map called 'solbase' (no quotes) for the above to work. Also check that the 'soldierepilot' is the right name for an east pilot.

To take the pilot out of the same group as 'solbase' (so the pilot goes where you want him to), do this;

pilot = driver heli

then

[pilot] join grpnull

OK, you now have a v80 with pilot sat on the ground at 'helistart'

You now need to stick these in the air...

Maybe you could do the following;

helipos = getpos heli

then

heli setpos getpos (helipos select 2) + 500

This should put the v80 in the air 500 above the ground. Now to get those rotors spinning.

pilot move (getpos helipos)

Hopefully, the v80 should have got the rotors spinning fast enough before it hits the ground... Maybe...  

You may have to play with the height you set the heli at, I just used 500 as a good starting point.

This is just a rough idea and I'm not promising the syntax is correct, or it will work, but it's a start...

Offline nEO iNC

  • Contributing Member
  • **
Re:createunit
« Reply #2 on: 19 May 2004, 08:42:06 »
Hey TonyRanger, I had a look at this for you last night... I wrote a script that does pretty much what you want it to... It's not ideal as the part where the heli is put into 'flying' mode when created is a bit of a cheat, but it works in a way...

You need to give the script 8 things, sounds a lot but it's not really... Just makes it a bit more useful...  :)

I added a patrol bit to the end of the script just give you ideas how it could be used.

Syntax to initialize the script is;

[createpos,"helitype","pilottype",startheight,enginestarttime,targetzone,xsize,ysize] exec "createheli.sqs" (use quotes as shown)

'createpos' - this is the name of the gamelogic/barrel/man/jeep etc where you want to create the heli

'helitype' - the type of heli you want to create (kamov = v80)

'pilottype' - type of unit you want to be the pilot (soldierepilot = soviet pilot)

'startheight' - the height above the ground you want the heli to be when it is created (any number)

'enginestarttime' - this is a delay in seconds to allow the rotors to get up to speed before it can move off (15 seconds seems to be the common time)

'targetzone' - the name of the gamelogic/barrel/man/jeep etc you want to the heli to use as the center of its patrol zone

'xsize' - how big the patrol zone is in the x axis

'ysize' - how big the patrol zone is in the y axis

If someone knows of a way of having rotors at full speed when a helo is created that would be useful to know... Anyone got any ideas..?

There's a demo mission and the script included in the . zip attached.

Hope this helps...  ;)

Offline TonyRanger

  • Members
  • *
  • I'm a llama!
Re:createunit
« Reply #3 on: 19 May 2004, 15:35:02 »
thank you very much,but I use the "flying"v-80 for anti-missile script for v-80
when incoming missile setpos the v-80 which be locked on
to[1,1,5000] then create a "flying" v-80 to the last created v-80's position,2 sceond later the set the first v-80
back and delete the later one,so I need the "flying" v-80 flying in 1 second

Uldics

  • Guest
Re:createunit
« Reply #4 on: 19 May 2004, 17:42:56 »
Just create it some time before, at mission start or whatever, far away, flying and setpos when you need it.

Offline TonyRanger

  • Members
  • *
  • I'm a llama!
Re:createunit
« Reply #5 on: 20 May 2004, 14:27:20 »
yes,that the problem,If I setpos when I need it,the pilot will eject  then the chopper will drop down,this is the Bug about "setpos",and even if I let the "pilot moveindriver chopper" every 0.04 second.and If a chopper's POS has been changed it will fly in low and high in 1 second this may cause the chopper down(because of it's height is not low befoce the script run)