Trigger

Status
Not open for further replies.
Level 2
Joined
Jul 25, 2006
Messages
10
The best way i know how is to set a local unit variable to the unit that enters the region, this does use a small amount of JASS but i will comment it as much as i can.
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters KillRect <gen>
    • Conditions
    • Actions
      • Custom script: local unit EnteredU = GetTriggerUnit()
      • Wait 10.00 seconds
      • Custom script: if RectContainsUnit(gg_rct_KillRect, GetTriggerUnit()) == true then
      • Custom script: call KillUnit(EnteredU)
      • Custom script: endif
      • Custom script : set EnteredU = null
"local unit EnteredU = GetTriggerUnit()" sets a local variable to the entering unit. It must be a local to avoid any overwriting that may occur if this trigger is rerun.

The line " if RectContainsUnit(gg_rct_KillRect, GetTriggerUnit()) == true then" checks if the unit is still within the "kill rect".

And the final lines do the following ;
> Kill the entering unit.
> Ends the "If" condition
> Clears up any potential leaks.

You must edit the line
JASS:
 if RectContainsUnit(gg_rct_KillRect, GetTriggerUnit()) == true then
for your regoin.

You must change "KillRect" to your killing regoin name [it is case sensative].
EG change it to ;

JASS:
if RectContainsUnit(gg_rct_RectThatKills, GetTriggerUnit()) == true then

I hope ive been helpful, if you have any problems just post and il see what i can do.
 
Level 2
Joined
Jul 25, 2006
Messages
10
Ok, sorry i couldn't be any help to you.


##edit##
I think there is in fact an easy GUI way, simply because i was being over cautious with the unit being overwritten. However this bug may well be evident as i have not checked over on this trigger.

  • Events
    • Unit - A unit enters Region 000 <gen>
  • Conditions
  • Actions
    • Wait 10.00 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Region 000 <gen> contains (Entering unit)) Equal to True
      • Then - Actions
        • Unit - Kill (Entering unit)
      • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top