I'm looking to add a certain amount of points to a variety of units upon activating certain parts of a script.
Things to know:
- 'fcp' is a global variable defined in the 'init.sqf' of the mission. This holds the value of how many points to add to the unit. For simplicity, we'll say that fcp = 5.
- 'additarea' is a pre-defined variable created in the 'init.sqf' of the mission. It is created by using the code:
Code:
additarea = "waiting";
init.sqf
Code:
fcp = 5;
additarea = "waiting";
"additarea" addPublicVariableEventHandler {{_x addScore fcp;} forEach additarea;};
us.sqf
(A player-executed, local script)
Code:
additarea = "(playerSide == "WEST") && (player distance flag1 <5)";
publicVariable "additarea";
Would that then make it so that on activation of 'us.sqf', 5 points would be added to anybody on BLUFOR who is standing within 5m of the object named 'flag1'?
If not, why not? And how would it be achieved?