Jump to content
Sign in to follow this  
SouthSaturnDelta

spawned pilots for spawned aircraft

Recommended Posts

Really getting into the whole scripting buzz now guys !

I learned how to spawn an aircraft and pilot it with a editor placed unit on the map.This works fine but how do I spawn a pilot and an aircraft and get the pilot to fly it /

Just now the spawned pilot stands about while the spawned planed falls to the ground.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">strikePilot3 = "SoldierWPilot" createunit [getMarkerPos "spawn3" ,groupAlpha ,"", 0.5, "CORPORAL"]

strikePilot3 setPos [(getPos strikePilot3 select 0),(getPos strikePilot3 select 1),(getPos strikePilot3 select 2)+1]

strikePilot3 setDir 180

strikePlane3 = "A10LGB" camCreate (getMarkerPos "spawn3")

strikePlane3 setPos [(getPos strikePlane3 select 0),(getPos strikePlane3 select 1),(getPos strikePlane3 select 2)+800]

strikePlane3 setDir 180

strikePilot3 moveInDriver strikePlane3

strikePilot3 assignAsDriver strikePlane3

strikePilot3 doMove _pos

where am I going wrong with this ?

Share this post


Link to post
Share on other sites
Quote[/b] ]strikePlane3 = "A10LGB" camCreate (getMarkerPos "spawn3")

afaik this is not correct. at least its not what you want. you need to use createUnit here too.

Quote[/b] ]Create a camera or a seagull object on the given position. Also other objects can be created this way, but vehicles created with camCreate cannot be entered. Any units created with camCreate will remain static. With difference to createVehicle, objects are created without consideration of the collision detection with surrounding objects, thus the objects are spawned exactly at the given position.camCreate is conducted immediately, the command doesn't wait for camCommit.

referece

Share this post


Link to post
Share on other sites

When creating soldiers, pilots etc. You have to add them to existing group.

In editor:

Create westsoldier and put this in his init: groupalpha=this

Create one marker and name it spawn3 (this is from where a10 should start its flight)

Create second marker and name it target3 (Its A10s target)

then create spawn.sqs file in notepad and put this in it:

_groupleader= leader groupalpha

_x=getmarkerpos "spawn3" select 0

_y=getmarkerpos "spawn3" select 1

_stx=getmarkerpos "target3" select 0

_sty=getmarkerpos "target3" select 1

strikeplane3 = "A10LGB" createvehicle [0,0,5000];

strikeplane3 setdir 180;

strikeplane3 setpos [_x,_y,100]

strikeplane3 setvelocity [0,-300,100];

"SoldierWPilot" createunit [getpos _groupleader,groupAlpha,"strikePilot3=this"];

strikePilot3 moveindriver strikeplane3

strikePilot3 assignasdriver strikeplane3

[strikeplane3] join attackgroup;

strikePilot3 commandMove [_stx,_sty]

attackgroup setbehaviour "COMBAT"

attacktgroup setcombatmode "RED"

I Tested it and It should work.  biggrin_o.gif

Share this post


Link to post
Share on other sites

Exellent -

Q you hit another prob on the head with not being able to board vehicles, I got it sussed out now.Cheers mate !

Thanks to you as well Väinämöinen, thats a good demo to get my noodel around.

Goodly, I'm off to do some more scripting.

Thanks again guys.

Top stuff !

yay.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×