Home   Help Search Login Register  

Author Topic: Needed: Solution for CreateUnit to MoveInDriver CreateVehicle...  (Read 859 times)

0 Members and 1 Guest are viewing this topic.

Offline Kundich

  • Members
  • *
  • "Habit is the daily battleground of character."
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

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
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
I know a little about a lot, and a lot about a little.

Offline Kundich

  • Members
  • *
  • "Habit is the daily battleground of character."
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?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
_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:

Code: [Select]
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

« Last Edit: 04 Jun 2005, 09:47:05 by THobson »

CrashnBurn

  • Guest
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 .....
« Last Edit: 06 Jun 2005, 21:43:38 by CrashnBurn »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
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  ?
« Last Edit: 05 Jun 2005, 12:34:37 by THobson »

CrashnBurn

  • Guest
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!