OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ace Productions on 12 Oct 2003, 03:35:20

Title: Killer trigger!
Post by: Ace Productions on 12 Oct 2003, 03:35:20
My question is similar to Kylesarnik but my trigger will cause damage to any unit entering it. I set the trigger to be activated by anybody, to be triggered repeatedly, on activation [] exec "getdam.sqs" and on deactivation Far=1.

My problem is that the units entering the trigger don't get hurt and the trigger is activated only once.

This is "getdam.sqs":

Private["_victim","_curdam","_newdam"]

_victim=thislist select 0

#Hurt
?(Far==1):GoTo "Safe"
~1.5
_curdam=damage _victim
_newdam = _curdam+0.2
_victim SetDammage _newdam
GoTo "Hurt"

#Safe
Exit

Can someone please help?  ::)
Title: Re:Killer trigger!
Post by: Unnamed on 12 Oct 2003, 03:59:44
The code looks ok, works for me. It will kill anyone in the vicinity, one at a time.

Just checking, but do you want to damage each unit one at a time? You will have to wait for each one to die, before the code moves on to the next.
Title: Re:Killer trigger!
Post by: oyman on 12 Oct 2003, 07:04:32
This should go into On Activation box of the trigger :

"_X setdammage 1" foreach thislist

try this  ;D
Title: Re:Killer trigger!
Post by: Ace Productions on 12 Oct 2003, 11:07:33
Oyman thanks for your reply but "_X setdammage 1" foreach thislist will kill anybody that enters the trigger, and my target is to hurt them slowly till they die and give them the chance to escape if they exit the trigger.  ;)
Title: Re:Killer trigger!
Post by: SilentHunter on 12 Oct 2003, 15:24:27
EASY

First create a trigger, call it "KillTrigger" without the quotes, make it activated by anyone and select repeatedly

Then create a script called "setdammage.sqs"

_SelectNo =  0
#top
?( Far == 1 ):exit
_Lista = list KillTrigger
_UnitCount = count _Lista
?(_UnitCount<1):GOTO "top"

;this will tell you what everything is doing, just take it out when you happly
hint format["_UnitCount = %1,\n_SelectNo = %2,\nUnitToKill = %3",_UnitCount,_SelectNo,UnitToKill]

?(_SelectNo > _UnitCount):_SelectNo = 0
UnitToKill = _Lista select _SelectNo
UnitToKill setDammage (getdammage UnitToKill) + 0.1
_SelectNo = _SelectNo + 1
~(1 / _UnitCount)
goto "top"

In whatever you want to start this script put the command line (this exec "setdammage.sqs") without the brackets, BUT  DON'T  PUT  IT  IN  "KILL  TRIGGER"

This script defiantly works in 1.92 I've tested it myself
If you need anymore help just send me a message
Title: Re:Killer trigger!
Post by: oyman on 12 Oct 2003, 17:18:00
uhhh
 
u can change the 1 to .08 or .5 and they will die slowy
Title: Re:Killer trigger!
Post by: Ace Productions on 12 Oct 2003, 23:15:01
God bless SilentHunter!  ;D
Exactly what I was looking for!!!

Thanks a lot mate.