OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Kundich on 04 Jun 2005, 00:55:16
-
I have a script that:
_car = _veh createVehicle getMarkerPos _start
_civ = _unit createUnit [[(getPos _car select 0)+5, (getPos _car select 1)+5, (getPos _car select 2)], _grp]
Basically, it creates the units the way I want it to. The problem is, _civ neither starts in _car, nor seems able to be coaxed into moving to the driver's position. And I've thrown everything but the kitchen sink at it:
_car lock FALSE
_grp Move getPos _car
[_civ] allowGetIn TRUE
_civ assignAsDriver _car
[_civ] orderGetIn TRUE
_civ action ["getin driver",_car]
_civ moveInDriver _car
Heck, I've even written delays into the script to give _civ a chance to get his head out of his @#&%*$@!!! What in the world am I doing wrong?!!
Thanks,
ADM
-
Try leaving a pause of about 10 secs after creating the car before ordering him in.
There is often a delay after using createvehicle, where you can't get in for several seconds after creation.
Planck
-
Thanks, but it did not seem to work. I even extended the delay to sixty seconds, but no dice on the _civ in the _car.
What could be causing this little...glitch?
-
_grp needs to be a real group that already exists and _unit needs to be a known unit type. Then after creating _civ it should be removed from the group and then a moveInDriver will work
This is an extract from a script of mine:
if (_side == west) then {_man = "SoldierWPilot"}
if (_side == east) then {_man = "SoldierEPilot"}
_i = (count units _grp)
_man createUnit [getPos _ch,_grp,"",1]
_Plt = units _grp select _i
[_Plt] join grpNull
_Plt moveInDriver _ch
_man createUnit [getPos _ch,_grp,"",1]
_Gnr = units _grp select _i
[_Gnr] join _Plt
_Gnr moveInGunner _ch
-
Naming the unit in the createunit command line always works.
_group = _this select 0
_position = getmarkerpos "mymarker"
_helo = "Mi24" createVehicle _position
~1 + (random 1)
"SoldierEpilot" createunit [_position, _group, "p1=this", 1, "CAPTAIN"]
"SoldierEpilot" createunit [_position, _group, "p2=this", 1, "LIEUTENANT"]
~1 + (random 1)
p1 moveindriver _helo
p2 moveingunner _helo
_group setcombatmode "RED"
_helo move getpos blah blah .....
-
That is a neat way to give a unit a name. But the code will leave the chopper crew as members of _group.
Also - should there not be a " after = this ?
-
Yes the crew is still part of the group. That's easy to change if need be. I use dummy groups for createunit (usually) by placing a soldier on the map, group naming him and deleting him. I also give him waypoints so the created units can use them. Works like a charm!
Also - should there not be a " after = this ?
Yes that was a typo on my part...oops!