Jump to content
Paskinder Singh

Cover Compromised Script

Recommended Posts

Hi all,

I'm working on a resistance fighter mission and I'm aiming to create a lite-script so that any armed players will be treated as hostile. I'm having trouble with the segment where I have a Fired event handler which then checks if the enemy can see the shooter, and if so it permanently makes the enemy hostile. However, this part of the script doesn't appear to do anything at all. I've gone through each element of it but cannot place which part is going wrong, if anyone has the time to spot any bugs that would be greatly appreciated!

 

Here's the initPlayerLocal:

 

Quote

player setCaptive true;
hint "You appear unarmed";

player addEventHandler ["InventoryClosed", {
    if (count (weapons player) == 0) then {player setCaptive true; hint "You appear unarmed"} else {player setCaptive false; hint "You appear armed"};
}];

player addEventHandler ["Take", {
    if (count (weapons player) == 0) then {player setCaptive true; hint "You appear unarmed"} else {player setCaptive false; hint "You appear armed"};
}];

player addEventHandler ["Fired", {
    if ((side _x) == west) then {{
        if ({[objNull, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0})
            then {player setCaptive false;
                player removeEventHandler ["InventoryClosed",0];
                player removeEventHandler ["Take",0];
                hint "Your cover is compromised";
                };}
    forEach _x;
    }
}];


Thanks
 

Share this post


Link to post
Share on other sites

Your _x variables don't mean anything here.

Replace inside EH by:

{
      if ({[objNull, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0})
            exitWith {
          player setCaptive false;
          player removeEventHandler ["InventoryClosed",0];
          player removeEventHandler ["Take",0];
          hint "Your cover is compromised";
        };
    } forEach (allUnits select {side _x == west});

 

Not saying you're on the right way for your purpose...

 

  • Like 2

Share this post


Link to post
Share on other sites

Ah I see, I'm still getting the hang of the magic variable. Your amendments to the script still don't run anything. I'll have a mess around with the checkVisibility command in case that is messing it up.

Thanks for the pointers!

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

×