OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Surdus Priest on 09 Sep 2007, 17:44:21
-
This is a small script i made for those (including myself) who use mission boundaries to prevent the player from cheating by going around areas he/she shouldn't.
I am posting this script for testing to determine whether or not it is necessary to use it, or to create the boarders using the resources on the mission editor alone.
This is the script:
; /////////////\\\\\\\\\\\\\
;///////SURDUS PRIEST'S\\\\\\
;\\\\ANTI DESERTER SCRIPT////
; \\\\\\\\\\\\\/////////////
;----Inspired by Rellikki----
#checkplayer
?(player in warningDeserter):goto "warning"
?(player in Deserter):goto "deserter"
~0.5
goto "checkplayer"
#warning
playsound "Warning_Deserter"
Hint "Warning. You are leaving the Mission Zone. Turn back or you will face Termination!"
#checkabsence
?!(player in warningDeserter):goto "checkplayer"
goto "checkabsence"
#deserter
playsound "Deserter"
Hint "You have abandoned the Mission Zone. You will now Die a Traitor!"
~6
player setdamage 1
exit
It can work with multiple triggers with the activations: ;warningDeserter = thislist; and ;Deserter = thislist;
To see it in action; see attached mission.
-
I tried using a line almost exactly like that in a script one time in arma (version 1.05 if I remember), and it would fail if the player was in a vehicle. Check it to see if that's the case here. If it is, the fix is simply to use vehicle player instead of player.
-
A couple of issues here:
- You only update warningDeserter and Deserter arrays when the triggers are activated. This means it would be quite possible for the player to not get warned/killed if an AI has entered the zone before they enter. To operate as you wish, you need to name the triggers and use:
? (player in (list warningDeserterTrigger)) : goto "warning"
? (player in (list killDeserterTrigger)) : goto "deserter"
- You start the script from the player object init placed in the editor. This unnecessarily breaks the script in MP. You need to either:
- Start the script in init.sqs, but abandon the script if on a dedicated server.
- Start the script from the player object init, but pass through the object as a parameter (rather than using player) and exit the script if the object isn't local.
- You can only ever have one of each type of trigger in a mission, since you are using hard-coded global variables.
Alternatively though, you could avoid using a script entirely by just using a activation of "player in thisList" in both triggers and put the code in the trigger activations (or put the code in two scripts and exec the script from the appropriate activations; this has the advantage that you can have more than one of each type of trigger without repeating the code):
playsound "Warning_Deserter"; Hint "Warning. You are leaving the Mission Zone. Turn back or you will face Termination!"
playsound "Deserter"; Hint "You have abandoned the Mission Zone. You will now Die a Traitor!";~6;player setdamage 1
As another alternative, perhaps you could work with Norrin to put your sounds in his Out of Bounds script. As far as I can tell, Norrin's script is more comprehensive than yours, so you might not want to work further on this script in order to make it no better than his.
-
im way past making scripts like this. i only made this to see if it was more beneficial than making it on the editor. however its just a waste of a global and a loop.
i now script in sqf and have finished the script i have always wanted :P
-
Since this script is not going to be improved, I might as well reject it. Good luck scripting in the future!