silente13 11 Posted May 2, 2016 Hello guys i'm trying to spawn a vehicle by a script, scroll the mouse on the NPC, that he has: this addAction["Spawn","spawn.sqf"]; If i try to spawn just a simple vehicle i can do it. But i want that if the vehicle is already exist it say me a message... spawn.sqf is this: #include <macro.h> _fnc_timedHint = { params ["_hint","_time"]; hint _hint; sleep _time; hint ""; }; if !(playerSide == west) exitWith {hintSilent "Non sei un agente di polizia!";}; if(__GETC__(life_coplevel) == 1) then { if (isnull s_1010) then { macchina = macchina - [s_1010]; life_vehicles = life_vehicles - [s_1010]; publicVariable "macchina"; publicVariable "s_1010" }; if (s_1010 in macchina) exitWith {hint "Una 10-10 è gia di pattuglia!";}; sleep 1; spawn _fnc_timedHint; s_1010 = "C_Offroad_01_F" createVehicle getMarkerPos "cop_spawnt_1"; s_1010 setVariable ["tf_hasRadio", true, true]; s_1010 setVariable ["TF_RadioType", "tf_rt1523g", true]; life_vehicles = life_vehicles + [s_1010]; macchina = macchina + [s_1010]; publicVariable "macchina"; publicVariable "s_1010"; }; This is right? Because when i do it, nothing happen... Share this post Link to post Share on other sites
jshock 513 Posted May 2, 2016 Well, the timed hint does nothing, because you need to pass in parameters to it: ["My hint text",3] spawn _fnc_timedHint;//waits 3 seconds before clearing the hint Share this post Link to post Share on other sites
silente13 11 Posted May 2, 2016 Is this ok? #include <macro.h> _fnc_timedHint = { params ["_hint","_time"]; hint _hint; sleep _time; hint ""; }; if !(playerSide == west) exitWith {hintSilent "Non sei un agente di polizia!";}; if(__GETC__(life_coplevel) == 1) then { if (isnull s_1010) then { macchina = macchina - [s_1010]; life_vehicles = life_vehicles - [s_1010]; publicVariable "macchina"; publicVariable "s_1010" }; if (s_1010 in macchina) exitWith {hint "Una 10-10 è gia di pattuglia!";}; sleep 1; ["",3] spawn _fnc_timedHint; s_1010 = "C_Offroad_01_F" createVehicle getMarkerPos "cop_spawnt_1"; s_1010 setVariable ["tf_hasRadio", true, true]; s_1010 setVariable ["TF_RadioType", "tf_rt1523g", true]; life_vehicles = life_vehicles + [s_1010]; macchina = macchina + [s_1010]; publicVariable "macchina"; publicVariable "s_1010"; }; Share this post Link to post Share on other sites
jshock 513 Posted May 2, 2016 If you don't want a hint there, which in that case, you honestly don't need to use the function at all..... Share this post Link to post Share on other sites
silente13 11 Posted May 2, 2016 If you don't want a hint there, which in that case, you honestly don't need to use the function at all..... I just want that if someone use that action, and he is a blufor, and the car do not exist, it say a message, else if the car doesn't exist spawn a car... Share this post Link to post Share on other sites
jshock 513 Posted May 2, 2016 Here's an outline of what you just described, I'll leave it to you to fill in the blanks: params ["","_caller",""]; if (side _caller == WEST) then { if (isNil "s_1010") then { //create vehicle } else { ["Vehicle already exists",3] spawn _fnc_timedHint; }; } else { ["You aren't BLUFOR!",3] spawn _fnc_timedHint; }; Share this post Link to post Share on other sites
silente13 11 Posted May 2, 2016 Ok thanks, i'll try :D Share this post Link to post Share on other sites
silente13 11 Posted May 4, 2016 Here's an outline of what you just described, I'll leave it to you to fill in the blanks: params ["","_caller",""]; if (side _caller == WEST) then { if (isNil "s_1010") then { //create vehicle } else { ["Vehicle already exists",3] spawn _fnc_timedHint; }; } else { ["You aren't BLUFOR!",3] spawn _fnc_timedHint; }; It work, but if i delete the vehicle and i try to spawn it, it says me that it exist... Share this post Link to post Share on other sites
Larrow 2822 Posted May 6, 2016 if (isNil "s_1010" || { isNull s_1010 } ) then If you delete the vehicle then the variable is not nil but instead holds a reference to a null object. Share this post Link to post Share on other sites
silente13 11 Posted May 8, 2016 if (isNil "s_1010" || { isNull s_1010 } ) then If you delete the vehicle then the variable is not nil but instead holds a reference to a null object. @larrow i try to do that, but same problem.... Share this post Link to post Share on other sites
Sokoloft 5 Posted May 9, 2016 I just recently got into this whole mission making thing myself. I've been using the VVS script and it's pretty good. Only downfall to it is that it depends on markers, and you can't change the height on markers so if you want a vehicle to spawn on an elevated position that isn't terrain good luck. VVS can be found here: http://www.armaholic.com/page.php?id=23020 As well as this person made it to were VVS will spawn at heights, but I have no idea how. :/ https://www.youtube.com/watch?v=AEe8G7DPxu4 Share this post Link to post Share on other sites
silente13 11 Posted May 11, 2016 I just recently got into this whole mission making thing myself. I've been using the VVS script and it's pretty good. Only downfall to it is that it depends on markers, and you can't change the height on markers so if you want a vehicle to spawn on an elevated position that isn't terrain good luck. VVS can be found here: http://www.armaholic.com/page.php?id=23020 As well as this person made it to were VVS will spawn at heights, but I have no idea how. :/ https://www.youtube.com/watch?v=AEe8G7DPxu4 My only problem is that i dont know how can i set the variable s_1010... Any idea? Share this post Link to post Share on other sites