OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: GomerPyle on 22 Jun 2008, 00:48:06
-
Hi!
I got a problem. I am finished with my mission and everything is just as i want it. But I am running a script for helicopters. It uses gamelogics as waypoints. But everytime i run it on an dedicated server I get this msg: "mando_heliroute: vehicle must be local". The heli I use in my mission is a ai run heli. I am using a heavily modified mando_heliroute_arma script.
inside the script i found this.
if (!local _heli) exitWith {hint "mando_heliroute: vehicle must be local";};
I was told that adding:
if(local heli1)then
{
execVM"script.sqf";
};
in init.sqf would fix this. But the problem is that I cannot have this in init.sqf as I want execVM"script.sqf"; called when a trigger is activated. And putting this "if" other places than init.sqf gives me and "error missing {".
"heli.sqf"
if(local heli1)then
{
_scr = [heli1,[getPos dest1],150, false]execVM"mando_heliroute_arma.sqf"; //waypoint
_scr = [heli1,[getPos dest2],150, false]execVM"mando_heliroute_arma.sqf"; //waypoint
_scr = [heli1,[getPos dest3],75, true]execVM"mando_heliroute_arma.sqf"; //landing zone. Also position where it starts from.
heli1 setVariable ["mando_heliroute", "free"];
};
Where i want this to be put into. But gives me an error missing { when testing mission. If I put it in init.sqf my helicopter starts flying instantly. But I want it in heli.sqf so i can exec script when a condition is met. Like BLUFOR detected by OPFOR.
I hope someone got a good idea about this.
PS: keep in mind that my mission is working just fine with the code below inside my heli.sqf. It is only when i am on ded. server i get the msg about local needed.
_scr = [heli1,[getPos dest1],150, false]execVM"mando_heliroute_arma.sqf"; //waypoint
_scr = [heli1,[getPos dest2],150, false]execVM"mando_heliroute_arma.sqf"; //waypoint
_scr = [heli1,[getPos dest3],75, true]execVM"mando_heliroute_arma.sqf"; //landing zone. Also position where it starts from.
heli1 setVariable ["mando_heliroute", "free"];
-
I can't see any problems with your first example script, so I'm a wee bit confused. Still, you could try these equivalent options:
Just put this in the trigger activation line to avoid running the script anywhere but on the server:
if (local heli1) then { execVM "script.sqf"; };
or put this at the top of your working heli script (2nd example you gave) in order to exit early if on a dedicated client:
if (not local heli1) exitWith {};
-
And where are you executing "heli.sqf" ?
Because, obviously, if it is executed there where heli1 is not local, it will have no effect at all.
-
I am executing heli.sqf in the act. field of a trigger "BLUFOR" detected by "OPFOR" repeating. So every time enemy is spotted the helicopter will go to waypoints and land on last waypoint. It works really well.
-
Well, once the trigger is activated the script would be executed everywhere, also there where the chopper is local so it should work. On the other hand, consider that trigger actions are repeated only once the condition is not true anymore and then the condition is true again.
-
I think adding this to act. field of trigger works. Well i am not getting a error. Need to test it on a ded. server with friends first.
if (local heli1) then { execVM "heli.sqf"; };