Jump to content
Hattricx

Adding spawned vehicle to curator

Recommended Posts

Hi, I'm currently working on a script to create a vehicle and add it to a curator. The vehicle spawns but I cannot interact with it in zeus. Here is my script currently:
This is activated by an action:
 

_arrayObjects = getPos helipad nearEntities [["landvehicle", "air"], 7];
if (count _arrayObjects > 0) then
{hint "The spawn point is blocked";}
else
{_veh = "rhs_uh60m" createVehicle (getpos helipad);
_veh setDir 41;
[_veh] remoteExec ["scripts\addVehicle.sqf", 2];
};

This is scripts\addVehicle.sqf where zeus11 is the zeus module variable name:

if (isServer) then {
_veh = _this select 0;
zeus11 addCuratorEditableObjects [[_veh], false];
};

Thanks in advance!

Share this post


Link to post
Share on other sites

The problem is the syntax of your remote exec.

Share this post


Link to post
Share on other sites

[[_veh],"yourscript.sqf"] remoteExec ["ExecVM",2]

 

And BTW you shouldn't use ExecVM to call scripts like that but rather predefined functions it's way less resource consuming see here for how to: https://community.bistudio.com/wiki/Arma_3_Functions_Library

Share this post


Link to post
Share on other sites
9 hours ago, Mr H. said:

[[_veh],"yourscript.sqf"] remoteExec ["ExecVM",2]

 

And BTW you shouldn't use ExecVM to call scripts like that but rather predefined functions it's way less resource consuming see here for how to: https://community.bistudio.com/wiki/Arma_3_Functions_Library

That fixed it, thanks!

Would functions be beneficial if the scripts are only being called during the preparation phase of the mission or would that just be using memory for no real reason?

Share this post


Link to post
Share on other sites

Functions are always better. As a rule of thumb only execVM scripts when you use them only once. If you need suspension  you can spawn a function instead of calling it. 

  • Like 1

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

×