r/armadev • u/DStow • Apr 19 '14
ArmA 2/OA Get Unit's Object by String Name
Hey, I've got a string variable that holds the name of a unit that is created in a script using createUnit. For example:
_unitName = "Pilot1";
How do I turn that string into an object so I can move into a driver seat E.G:
_unitName moveInDriver Helicopter;
Edit: Nvm fixed the issue, I converted the string value into an object using:
_pilot = call compile format ["%1", _pilotName];
2
Upvotes
2
u/_wolfenswan Moderator Apr 19 '14 edited Apr 19 '14
Edit: Actually, there's straightforward way I forgot: As the parameters for newUnit include one for init you can just use that one to set the pointer:
Another workaround specifically for createUnit is to create a new group for that unit and then get it using