Home   Help Search Login Register  

Author Topic: Anti_Deserter Script (REJECTED)  (Read 2395 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Anti_Deserter Script (REJECTED)
« 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:

Code: [Select]
; /////////////\\\\\\\\\\\\\
;///////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.
« Last Edit: 11 Nov 2007, 14:53:45 by Spooner »
Campaigns are hard, I'll stick with scripting for now!

Re: Anti_Deserter Script
« Reply #1 on: 13 Sep 2007, 05:02:46 »
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.
Everything I have released for ARMA can be found here.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Anti_Deserter Script
« Reply #2 on: 07 Nov 2007, 20:44:26 »
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:
Code: (SQS) [Select]
? (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):
Code: (warn deserter trigger activation) [Select]
playsound "Warning_Deserter"; Hint "Warning.  You are leaving the Mission Zone.  Turn back or you will face Termination!"

Code: (kill deserter trigger activation) [Select]
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.
« Last Edit: 07 Nov 2007, 21:13:55 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: Anti_Deserter Script
« Reply #3 on: 09 Nov 2007, 01:50:30 »
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
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Anti_Deserter Script (REJECTED)
« Reply #4 on: 11 Nov 2007, 14:55:11 »
Since this script is not going to be improved, I might as well reject it. Good luck scripting in the future!
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)