Jump to content
Sign in to follow this  
leysard

Problem passing data with execVM

Recommended Posts

I'm trying to pass some values from on sqf file to another. I can't find my mistake.

Here's the initial file

heliGrp = createGroup west;
heli1 = "B_Heli_Light_01_F" createVehicle ([21704,7571]);
heli1 setVehicleVarName "heli_1";
heliGrp addVehicle heli_1;
null = ["heliGrp","heli1"] execVM "Scripts\fillVehicle.sqf";

Then here is the fillVehicle.sqf script. It does not spawn the unit and get into the heli

sleep 1;
_heliGrp = _this select 0;
_heliname = _this select 1;
sleep 1;

FS1 = "B_Soldier_A_F" createUnit [[18405,6724], _heliGrp, "FS_1 = this",0.5, "LIEUTENANT"];
FS_1 moveInDriver _heliname;	

Share this post


Link to post
Share on other sites

Ok, so im assuming that your trying to pass heliGrp and heli1 as variables not stings. Now assuming this is the case then why are you assigning the global variables (heliGrp,heli1) to local variables (_heliGrp,_heliname)? If you actually want to use global variables then there really is no need for passing anything via execvm. Nevertheless, this is how you could fix it.

Init:

_heliGrp = creategroup west; 
_heli1 = "B_Heli_Light_01_F" createvehicle [21704,7571]; 
_heli1 setvehiclevarname "heli_1"; 
_heliGrp addvehicle _heli_1; 
sleep 1;
[_heliGrp,_heli1] execvm "Scripts\fillVehicle.sqf";

fillVehicle:

_heliGrp = _this select 0; 
_heliname = _this select 1; 
sleep 1; 

_FS = "B_Soldier_A_F" createunit [[18405,6724],_heliGrp,"_FS1 = this",0.5,"LIEUTENANT"]; 
_FS1 moveindriver _heliname;  

Edited by dcthehole
[PHP] not [CODE]

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×