Jump to content
Sign in to follow this  
TheDarkFox

Creating a new vehicle

Recommended Posts

I'm working on a beach assault mission where once you kill off the assaulting infantry, boats start showing up.

I've used createVehicle to make the new boats, but they're toally unoccupied (no commander, driver or gunner). So despite setting some waypoints, they just sit there!

Any hints? Thanks!

Script below:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_wave = _this select 0

? (_wave == 1) : goto "Wave1"

goto "End"

#Wave1

# Get North Marker Position

northPos=getMarkerPos "NorthMarker"

nx=northPos select 0

ny=northPos select 1

nz=northPos select 2

# Get South Marker Position

southPos=getMarkerPos "SouthMarker"

sx=southPos select 0

sy=southPos select 1

sz=southPos select 2

hint format ["Wave %1 Destroyed!",_wave]

# Place 4 new ships

_boat1 = "BoatE" createVehicle [nx+20,ny+20,nz]

_boat2 = "BoatE" createVehicle [nx-20,ny-20,nz]

_boat3 = "BoatE" createVehicle [sx+20,sy+20,sz]

_boat4 = "BoatE" createVehicle [sx-20,sy-20,sz]

# Populate Boat 1

_b1C = "OfficerE" createUnit [getPos _boat1,wave1Group,"",0.5,"PRIVATE"]

_b1C assignAsCommander _boat1

_b1D = "OfficerE" createUnit [getPos _boat1,wave1Group,"",0.5,"PRIVATE"]

_b1D assignAsDriver _boat1

_b1G = "OfficerE" createUnit [getPos _boat1,wave1Group,"",0.5,"PRIVATE"]

_b1G assignAsGunner _boat1

# Populate Boat 2

_b2C = "OfficerE" createUnit [getPos _boat2,wave1Group,"",0.5,"PRIVATE"]

_b2C assignAsCommander _boat2

_b2D = "OfficerE" createUnit [getPos _boat2,wave1Group,"",0.5,"PRIVATE"]

_b2D assignAsDriver _boat2

_b2G = "OfficerE" createUnit [getPos _boat2,wave1Group,"",0.5,"PRIVATE"]

_b2G assignAsGunner _boat2

# Populate Boat 3

_b3C = "OfficerE" createUnit [getPos _boat3,wave1Group,"",0.5,"PRIVATE"]

_b3C assignAsCommander _boat3

_b3D = "OfficerE" createUnit [getPos _boat3,wave1Group,"",0.5,"PRIVATE"]

_b3D assignAsDriver _boat3

_b3G = "OfficerE" createUnit [getPos _boat3,wave1Group,"",0.5,"PRIVATE"]

_b3G assignAsGunner _boat3

# Populate Boat 4

_b4C = "OfficerE" createUnit [getPos _boat4,wave1Group,"",0.5,"PRIVATE"]

_b4C assignAsCommander _boat4

_b4D = "OfficerE" createUnit [getPos _boat4,wave1Group,"",0.5,"PRIVATE"]

_b4D assignAsDriver _boat4

_b4G = "OfficerE" createUnit [getPos _boat4,wave1Group,"",0.5,"PRIVATE"]

_b4G assignAsGunner _boat4

# Move them in

_boat1 doMove getMarkerPos "Wave1_1"

_boat2 doMove getMarkerPos "Wave1_2"

_boat3 doMove getMarkerPos "Wave1_3"

_boat4 doMove getMarkerPos "Wave1_4"

_wave1=True

#End

<span id='postcolor'>

Share this post


Link to post
Share on other sites

Just assigning the crew won't do, you'll have to use the moveInX command, for example "player moveInGunner boat1". It instantly "teleports" men to position, so you don't have to mess with their positions at all.

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  

×