Jump to content
FlyingTarta

[Help]script to call a truck to my position, works in SP but not in MP

Recommended Posts

Hello, i just make a script to call a truck to my position via menu action, and when i test it in SP works perfectly, but when i try it in MP it donest work and i dont understund why ( i even tryed in TASDT) and in both has the same error: 

 

Error undefined variable in expresion: chof <- variable which is defined in varinit.sqf.

 

to test the script, just execVM script/sumi.sqf in a vehicle with a driver.

 

https://github.com/Flyingtarta/SupplyiesScript-/tree/master/Supplies



 

Share this post


Link to post
Share on other sites

It's a problem with initialization order.

 

Try to put a delay to your sumi.sqf script like that :

 

waitUntil {time > 5}; // delay


//select the current vehicle
_veh = _this select 0;
//make the driver as variable
_dvr = driver _veh;

//we save that variable globally
chof = [ chof , _dvr ] call BIS_fnc_arrayPush;
//chof pushBack _dvr;
//publicVariable chof;

_veh setfuel 0;
//saves the position of the vehicle.
call tarta_fnc_safepos;

[
"<t color='#FFFF00'>suministros </t>", //acction in yelow
"call tarta_fnc_desplz",         //script 1
"<t color='#FF0000'>cancelar suministros </t>", //cancel tthe call (red)
"call tarta_fnc_VolverZonaSegura" //script 2
] call tarta_fnc_addaction;


//while the driver is alive, reports its status
while { alive _dvr } do
{
  call tarta_fnc_reportesPeligro;
};

 

Share this post


Link to post
Share on other sites

hello,

try with include

#include "Supplies\varinit.sqf";

 

 

 

 

 

Share this post


Link to post
Share on other sites
12 hours ago, Hiddens said:

#inclu

 

16 hours ago, Crazy_Man said:

It's a problem with initialization order.

 

Try to put a delay to your sumi.sqf script like that :

 


waitUntil {time > 5}; // delay


//select the current vehicle
_veh = _this select 0;
//make the driver as variable
_dvr = driver _veh;

//we save that variable globally
chof = [ chof , _dvr ] call BIS_fnc_arrayPush;
//chof pushBack _dvr;
//publicVariable chof;

_veh setfuel 0;
//saves the position of the vehicle.
call tarta_fnc_safepos;

[
"<t color='#FFFF00'>suministros </t>", //acction in yelow
"call tarta_fnc_desplz",         //script 1
"<t color='#FF0000'>cancelar suministros </t>", //cancel tthe call (red)
"call tarta_fnc_VolverZonaSegura" //script 2
] call tarta_fnc_addaction;


//while the driver is alive, reports its status
while { alive _dvr } do
{
  call tarta_fnc_reportesPeligro;
};

 

 

it was that!! thank you! 

 

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

×