OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Terox on 18 Mar 2003, 14:42:05
-
as the title states, i want to create a protection zone, where nobody can fire any weapons or inflict any damage
The reason for this zone, is i have a respawn location in close proximity to the playing area where it is almost impossible for enemy choppers not to fly over, therefore i dont want to use the standard killzone and outer warning tiggers
In addition, i would also like this zone to protect anybody within it from any weapons fire outside the protected area
Thanks in advance for any help offered
-
Would it be ok for you if anyone who starts firing inside the
no fire zone gets killed?
If yes then:
create two triggers:
Trigger1:
No fire zone:
activation: anybody/present/repeatedly
name: triggerA
condition: this
onActivation: "_x addeventhandler [{fired}, {_this select 0 setDammage 1}]" forEach thislist; hint "you have entered a no firing zone"
onDeactivation: release = true
Trigger 2:
(bigger than the no fire zone trigger)
activation: anybody/present/repeatedly
condition: release
onActivation: released = thislist - list triggerA; "_x removealleventhandlers {fired}" forEach released; hint "you have left the no fire zone"
onDeactivation: release = false
I've tried that with a chopper too, and when firing in the hot
zone it worked aswell.
:note - instead of activation by anybody, you can also limit
the activation for a specific side.
~S~ CD
-
OK, i found a problem when one unit leaves the nofire zone
area and another one still remains inside the nofire zone.
Gimme a lil bit more time and i'll fix that
:edit - OK Terox - my head starts burning now after 4 hours
playing around with eventHandlers and trigger lists (not only for your request but something else aswell), so i have to do a break now.
The method with those two present triggers is correct, but
you need to setup two more triggers to add and remove
the eventHandlers instantly.
I'm gonna continue thinking about this when i'm at work after
4 hours, and maybe my brains refreshed then already.
If you wanna try to get an earlier solution, have a look how
BIS is using inner and outer triggers (create a CTF map with
the editor wizzard and search for those inner outer triggers).
If i remember correctly you need to setup an init trigger to
start the two loop triggers, then you need to triggers (the
two loop triggers) to instantly add and remove the eventHandlers, and you will need the two triggers (inner and
outer).
(*runs into the bathroom and takes an icecold headwash now*)
;D
btw - BIS doesn't use this for adding eventHandlers, but for
setting up limited areas.
~S~ CD
-
Well Terox, if you're still interrested in the method i suggested
you, here's the working version:
How to setup a nofire-zone:
You need to 5 triggers:
Trigger 1: the nofire-zone trigger
size: as big as you want your nofire-zone (e.g: 20/20)
activation: anybody/present/once
name: triggerA
condition: this
Trigger 2: the outer nofire-zone trigger (place it at the same spot,
where the nofire-zone trigger is)
size: bigger than the nofire-zone trigger (e.g: 40/40)
activation: anybody/present/once
name: triggerB
condition this
Trigger 3: init-trigger
size: 0/0
activation: none/once
countdown: min: 0.1 / max: 0.1 / mid: 0.1
condition: true
onActivation: updlistA = true
Trigger 4: update nofire-zone trigger
size: 0/0
activation: none/repeatedly
countdown: min: 0.1 / max: 0.1 / mid: 0.1
condition: updlistA
onActivation: "_x addeventhandler [{fired}, {_this select 0 setDammage 0.95}]" forEach list triggerA; updlistB = true; updlistA = false
:important note - the countdown is required to get this whole thing to work (strange OFP editor)
Trigger 5: allow fire outer nofire-zone
size: 0/0
activation: none/repeatedly
condition: updlistB
onActivation: nofire = list triggerB - list triggerA; "_x removealleventhandlers {fired}" forEach nofire; updlistB = false; updlistA = true
:note - this method causes any unit who fires inside the area of the
nofire-zone to receive a damage of 0.95 => unit will have to crouch
from now. If you want to kill the unit, change the setdammage from 0.95
to 1
: optional onActivation: "_x addeventhandler [{fired}, {_this select 0 setDammage 0.95; hint format [{%1 was firing inside the nofire-zone}, _this select 0]}]" forEach list triggerA; updlistB = true; updlistA = false
:note - if you want to get the name of the unit displayed onto the screen, you can use optional onActivation for trigger 4, where i've added a hint format message to the eventhandler. You can also use globalchat instead of hint. But you should be aware of using this in your mission unless you want to test it only, because of a unit firing in burst or autofire mode. (hint will cause a lot of ping sounds, as globalchat will fill the chat-lines).
:additional note - if you only want units not to be able to fire,
then you will need to remove their ammo, and give it back to
them, with the allow firing trigger, but this might be a bit more
complicated and in my opinion unrealistic. If i can pull my trigger
here, who in the world could manage that i can't do it there? (except David Copperfield or so)
Ah yeah, i've also attached a little sample mission, where you
can try it out. You're leader of two AI's, and 3 ungrouped AI's
are standing around. Order one of your men inside the flag cage, order him to target a soldier and then tell him to fire (3-3).
Or order him into the cage, let him return to formation and order
him then to shot a soldier - you'll see the effect.
Or try it by yourself while shooting the ground or the clouds ;)
hope this helps
~S~ CD
-
Thanks a lot mate, thats great, if i get any probs when i implement it, and cant sort it, i will unsolve and get back to you