Forum Jump :

Author Message


Posts: 5
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-04-07 14:20        
     
Hey Armaholics!

So i want to spawn a unit midgame. I got a dialog with a button action: execvm script.sqf... It the system runs the script and creates a unit e.g:

unit_r3 = "O_Soldier_F" createUnit [[1699.98, 5120.07, 0.00143957], group_r3, "this setdir 30;"];

I tried to put "newUnit = this; this setdir 30;" , "newUnit = this; this setdir 30;" etc.
Nothing seems to work as the "newUnit" contains "ANY". Now as the position is hardcoded and it only spawns in that position i tried the nearestObject command, return value: Nul-Object.
So i need the name to run the setdir and deleteVehicle command.
Thanks in advance!


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#2 Posted at 2015-04-07 18:38        
     
unit_r3 = "O_Soldier_F" createUnit [[1699.98, 5120.07, 0.00143957], group_r3, "this setdir 30"];
should work fine but your unit is not supposed to stay in this direction. That's AI life!

newUnit will not contain "any" if placed inside your third parameter, that means inside your code string:

unit_r3 = "O_Soldier_F" createUnit [[1699.98, 5120.07, 0.00143957], group_r3,"newUnit = this; this setdir 30"];
hint format ["%1",newUnit] returns a O Alfa... :2 . Works fine!

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 5
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-04-08 01:16        
     
Thanks alot!

I think it might've been the "unit_r3 =" that screwed me up...or i made another mistake...well works now!