Home   Help Search Login Register  

Author Topic: Unit needs to be local  (Read 1351 times)

0 Members and 1 Guest are viewing this topic.

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
Unit needs to be local
« 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 {".

Code: [Select]

"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.

Code: [Select]

_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"];

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Unit needs to be local
« Reply #1 on: 22 Jun 2008, 01:00:35 »
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:
Code: [Select]
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:
Code: [Select]
if (not local heli1) exitWith {};
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Unit needs to be local
« Reply #2 on: 22 Jun 2008, 01:26:24 »
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.

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
Re: Unit needs to be local
« Reply #3 on: 22 Jun 2008, 09:44:01 »
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.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Unit needs to be local
« Reply #4 on: 22 Jun 2008, 10:13:13 »
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.

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
Re: Unit needs to be local
« Reply #5 on: 22 Jun 2008, 15:07:00 »
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.

Code: [Select]
if (local heli1) then { execVM "heli.sqf"; };