Home   Help Search Login Register  

Author Topic: making createunit'd units get in createvehicle'd stationary guns  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

KyleEasterly

  • Guest
Hi, I'm back... AGAIN, with another question for the SAME MP MAP...


AIEEEEEEEEEEEEEE

So, I am working on dynamically creating the units in the "intense combat areas" (major bases, cities) when a west player gets within 1500m of it. I have the actual trigger part down. I have the creating of the units (BAS Government Soldiers. I have the creating of the vehicles (BAS Government ZU-23s). I just can't get said soldiers to get in said ZU-23s as gunner/commander. Here's the code I'm using:

trigger calls this file, "spawn_lbase.sqs", no arguments passed to it, uses pre-placed markers on the map (will probably switch to gamelogics so that players don't know the exact positions of these units beforehand)
Code: [Select]
; spawn_lbase.sqs
; spawns units at the base in zone L
; SERVER ONLY
? (!local Server) : exit

_thenewpos = getMarkerPos "newtrigpos"

l1 = group l1_0

;_tempveh setDir 315


_tempveh = "BAS_GZU23" createVehicle getMarkerPos "pm_l1_2"
_tempveh setDir 45
~0.5
"BAS_GovernmentSoldier" createUnit [getPos _tempveh, l1, "_tempobj = this", 0.75]
[_tempobj] join grpNull
_tempobj assignAsCommander _tempveh
"BAS_GovernmentSoldier" createUnit [getPos _tempveh, l1, "_tempobj = this", 0.75]
[_tempobj] join grpNull
_tempobj assignAsGunner _tempveh

;_tempveh setDir 135
;_tempveh setDir 225

; "_x setMarkerPos _theNewPos" forEach ["pm_l1_1", "pm_l1_2", "pm_l1_3", "pm_l1_4"]
deleteVehicle l1_0


seen here:
pre-placed gamelogic Server for determining server-side or client-side
pre-placed unit l1_0
pre-placed markers pm_l1_1 to pm_l1_4 (only using #2 for making the vehicle... simple copy-pasting or maybe even some kinda loop with an array to place more, but I must get it right here first)

what happens for me with this, running it in preview mode from the mp mission editor (not from the Mission Editor in the root menu, but in the multiplayer menu), the gun gets made, the guys get made, then they just stand there. sometimes theyll move around a bit because my test guy (enemy to them) is within sight...

any help is appreciated

thanks,

-kyle

ps i think this is the third thread about the SAME MISSION in 2 or 3 days... i cant remember anymore. the first one was really stupid. the second one was with the unit arrays (but using this new way i dont even need that) then theres this one


rarrrrrrrrrrrrrrrrgh

slowworm

  • Guest
Hi Kyle!

When you assign a unit to a vehicle, you need to add
[array of units] ordergetin true
to let them embark the assigned vehicles.

In your script:

Code: [Select]
; spawn_lbase.sqs
; spawns units at the base in zone L
; SERVER ONLY
? (!local Server) : exit

_thenewpos = getMarkerPos "newtrigpos"

l1 = group l1_0

;_tempveh setDir 315


_tempveh = "BAS_GZU23" createVehicle getMarkerPos "pm_l1_2"
_tempveh setDir 45
~0.5
"BAS_GovernmentSoldier" createUnit [getPos _tempveh, l1, "_tempobj = this", 0.75]
[_tempobj] join grpNull
_tempobj assignAsCommander _tempveh
[_tempobj] orderGetIn true
"BAS_GovernmentSoldier" createUnit [getPos _tempveh, l1, "_tempobj = this", 0.75]
[_tempobj] join grpNull
_tempobj assignAsGunner _tempveh
[_tempobj] orderGetIn true

;_tempveh setDir 135
;_tempveh setDir 225

; "_x setMarkerPos _theNewPos" forEach ["pm_l1_1", "pm_l1_2", "pm_l1_3", "pm_l1_4"]
deleteVehicle l1_0

Try this!



edit:
And there is an alternative. There are four commands to teleport units directly into a vehicle:
unit moveInDriver vehicle
unit moveInGunner vehicle
unit moveInCommander vehicle
unit moveInCargo vehicle


where unit is the name of a unit and vehicle is the name of a vehicle.
If the player(s) can't see them entering the vehicle, I would prefer teleport.


If it doesn't work now, you possibly have to add some delay after each soldier's creation.

cu slowworm
« Last Edit: 29 Jan 2004, 11:20:06 by slowworm »