Home   Help Search Login Register  

Author Topic: Out-of-bounds zone script (ACCEPTED)  (Read 5022 times)

0 Members and 1 Guest are viewing this topic.

Offline norrin

  • Tutorial Writer
  • **
Out-of-bounds zone script (ACCEPTED)
« on: 22 Sep 2007, 02:39:56 »
Out-of-bounds zone script

Latest version is available from http://www.ofpec.com/ed_depot/index.php?action=details&id=442&game=ArmA&type=sc&cat=ug

Here's how it works:
When a player enters a defined zone on the map he gets an onscreen warning message:

"You are leaving the field of combat.  You have 10 seconds to return to the battlefield"

A timer starts counting down and if he hasn't left the zone in that time he will die.  If he does leave the zone the message and timer disappear and the player is unharmed.

How to make it work:
1. Copy across the boundary.sqf into your mission directory. 
2. Set up your respawn settings in your description.ext as normal.
3. Create some rectangular or ellipse shaped markers on the map.  I've given them the names "Out_of_Bounds_1" and "Out_of_Bounds_2" in the example mission in the zip file.
4. In the init.sqf you'll need a line of code activating the boundary.sqf for each zone like the following:
Code: [Select]
call {["name_of_zone"] execVM "boundary.sqf"};
So in my example mission where I have 2 zones called "Out_of_Bounds_1" and "Out_of_Bounds_2" the init.sqf looks like this:
Code: [Select]
//init.sqf

waitUntil { player == player};
 
call {["Out_of_Bounds_1"] execVM "boundary.sqf"};
call {["Out_of_Bounds_2"] execVM "boundary.sqf"};

if (true) exitWith {};
5. Fire up your mission and test it out

Tested
Version 1.08 with two players

Test mission
I've marked the two boundary zones with some wire so you can identify them more easily in game.  Also try driving the Hummer into the zones and see what happens. 

Other notes
This script is designed so that it will only work with players.  Its possible to revise it so it works with both playable AI and unplayable AI but they're going to have no idea they've entered a no go zone. I can also change it so that the player gradually loses health say 0.1 damage per sec after the timer expires.
 
« Last Edit: 04 Nov 2007, 22:53:33 by norrin »

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Out-of-bounds zone script
« Reply #1 on: 05 Oct 2007, 16:57:49 »
hi Norrin,

Useful script for multiplayer i'm sure-- some comments/suggestions

1) can you have a titletext or hint that tells the player to move forward or back etc. I think every demo should hold the player's hand even though the idea is pretty simple in this one, still say something like "walk forward to test the out of bounds zone" or something

2) I like the time countdown, maybe included a function that says which direction the player needs to go to get back ? What do you think?

Offline norrin

  • Tutorial Writer
  • **
Re: Out-of-bounds zone script
« Reply #2 on: 18 Oct 2007, 03:04:26 »
Sorry Lee only just saw this.  Thanks for the comments, I'll make the changes and post the updated script.

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Out-of-bounds zone script
« Reply #3 on: 23 Oct 2007, 18:30:06 »
Sounds good  :D

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Out-of-bounds zone script
« Reply #4 on: 24 Oct 2007, 01:30:29 »
norrin,
AFAIK one of the patches fixed the maximum loop count problem, so now all you really need for an infinite loop is:
Code: [Select]
while {TRUE} do {
};

If look at the first line of your for loop backwards you get : do _run_run.  I would rather not be reminded of that "classic" Shaun Cassidy hit.
urp!

Offline norrin

  • Tutorial Writer
  • **
Re: Out-of-bounds zone script
« Reply #5 on: 24 Oct 2007, 08:41:27 »
Thanks for the tip Mr Peanut will do.  Oh and I know what you mean I was always more of a David Cassidy fan myself.   :)  Boy we are showing our age.  :D

Offline norrin

  • Tutorial Writer
  • **
Re: Out-of-bounds zone script
« Reply #6 on: 28 Oct 2007, 11:22:25 »
Lee please find attached the updated file with the revised version of the script (version Zones_4).  I'm sorry its taking me so long to get a round to updating my scripts but I'm finding I have very little spare time at the moment. :(

Changes
The revised test mission gives the players a text message to head "due north or south to enter the out-of-bounds zones".
It also hints the player which direction he has to move to exit the zone (based upon the direction he entered).
As suggested by Mr Peanut replaced do _run _run  with while {true} do

@spooner thanks for the link to the script but unfortunately I had written up the revised function before I got your message - would have saved me some time.

Latest version is available from http://www.ofpec.com/ed_depot/index.php?action=details&id=442&game=ArmA&type=sc&cat=ug
« Last Edit: 04 Nov 2007, 22:54:08 by norrin »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Out-of-bounds zone script (ACCEPTED)
« Reply #7 on: 04 Nov 2007, 15:09:26 »
When you update a script, you should tell us in a new post, but put the new version in the original post and remove any older versions from that post. (currently, the original post links to version 3, but the last post points at version 4). Although not directly relevant, the file itself actually states that it is version 0.2, but I marked it as 4.0 when I uploaded it, since that is what you marked it as in the above post (though you could have meant 0.4; it wasn't clear).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline norrin

  • Tutorial Writer
  • **
Re: Out-of-bounds zone script (ACCEPTED)
« Reply #8 on: 04 Nov 2007, 22:56:19 »
Will do in future Spooner, sorry about that.  I've edited my previous posts to link the revised version of the script you posted in the OPFEC script database.