# [Trigger]Region trigger problem

Status
Not open for further replies.

#### lnfernal

Level 8
I'm currently having trouble with creating a sort of a trap. Every 8 second, a + like cross will appear randomly in the map. After 3 seconds, this cross will become red and any unit that touches this cross will die. So I did this:

The | white region is Cross 1b. The - one is Cross 2b.

The - red region is Cross 1. The | red region is Cross 2.

And I used theese triggers. But it doesn't work, it neither displayed the Lol message.

• Periodic 8
• Events
• Time - Every 8.00 seconds of game time
• Conditions
• Actions
• Set Random_Point[19] = (Random point in Cross 1 <gen>)
• Set Random_Point[20] = (Random point in Cross 2 <gen>)
• Region - Center Cross 1b <gen> on Random_Point[19]
• Region - Center Cross 2b <gen> on Random_Point[20]
• Set Random_Point[16] = (Center of Cross 1b <gen>)
• Set Random_Point[13] = (Center of Cross 2b <gen>)
• Set Random_Point[18] = (Random_Point[16] offset by 1600.00 towards 180.00 degrees)
• Set Random_Point[17] = (Random_Point[16] offset by 1600.00 towards 0.00 degrees)
• Set Random_Point[14] = (Random_Point[13] offset by 1600.00 towards 90.00 degrees)
• Set Random_Point[15] = (Random_Point[13] offset by 1600.00 towards 270.00 degrees)
• Unit - Create 1 Lasor for Neutral Hostile at Random_Point[18] facing Default building facing degrees
• Set LightningUnit[1] = (Last created unit)
• Unit - Create 1 Lasor for Neutral Hostile at Random_Point[17] facing Default building facing degrees
• Set LightningUnit[2] = (Last created unit)
• Unit - Create 1 Lasor for Neutral Hostile at Random_Point[15] facing Default building facing degrees
• Set LightningUnit[3] = (Last created unit)
• Unit - Create 1 Lasor for Neutral Hostile at Random_Point[14] facing Default building facing degrees
• Set LightningUnit[4] = (Last created unit)
• Lightning - Create a Chain Lightning - Primary lightning effect from source Random_Point[18] to target Random_Point[17]
• Set Lightning[1] = (Last created lightning effect)
• Lightning - Create a Chain Lightning - Primary lightning effect from source Random_Point[14] to target Random_Point[15]
• Set Lightning[2] = (Last created lightning effect)
• Wait 3.00 seconds
• Lightning - Destroy Lightning[1]
• Lightning - Destroy Lightning[2]
• Lightning - Create a Finger of Death lightning effect from source Random_Point[18] to target Random_Point[17]
• Set Lightning[1] = (Last created lightning effect)
• Lightning - Create a Finger of Death lightning effect from source Random_Point[14] to target Random_Point[15]
• Set Lightning[2] = (Last created lightning effect)
• For each (Integer A) from 13 to 20, do (Actions)
• Loop - Actions
• Custom script: call RemoveLocation(udg_Random_Point[bj_forLoopAIndexEnd])
• Set LightningBoolean = True
• Wait 4.50 seconds
• Lightning - Destroy Lightning[1]
• Lightning - Destroy Lightning[2]
• Set LightningBoolean = False
• For each (Integer A) from 1 to 4, do (Actions)
• Loop - Actions
• Unit - Kill LightningUnit[(Integer A)]
• Lightning Enter
• Events
• Unit - A unit enters Cross 1b <gen>
• Unit - A unit enters Cross 2b <gen>
• Conditions
• (Unit-type of (Triggering unit)) Equal to of 8
• LightningBoolean Equal to True
• Actions
• Game - Display to (All players) the text: lol
• Unit - Kill (Triggering unit)

This works fine. It creates the cross randomly around the map. But it doesn't kill me.

#### Eleandor

Level 21
Region - Center Cross 1b <gen> on Random_Point[19]
Region - Center Cross 2b <gen> on Random_Point[20]

GUI uses "Region" for both rectangle and region variables, which is the cause of much confusion. Regions aren't rectangles. The "Region - center region" action centers a RECTANGLE, while the "Unit enters region" event does use REGIONS, and not RECTANGLES. So if you move the rectangle, the corresponding region you use in the events doesn't move with you.

A possible fix is to remove the event and create a periodic timer (say, each 0.33 seconds) and check, for each unit in the map, if he's in any of the 2 cross rectangles. (There's a boolean condition: unit in region)

#### Child_0f_Bodom

Level 16
(Unit-type of (Triggering unit)) Equal to of 8
LightningBoolean Equal to True

This seems really strange, especially (Unit-type of (Triggering unit)) Equal to of 8.

#### lnfernal

Level 8
Hm thanks I'll try that out.

especially (Unit-type of (Triggering unit)) Equal to of 8.

of 8 is the name of my hero.

Edit: Yeah it worked.

#### Reaper2008

Level 12
Why, so it looks like: John Doe - Level 1 of 8 ?

Loop checks seem to be the best way, but 0.3 is too fast, try 0.8 .

#### lnfernal

Level 8
No, it's a minigame with 8 levels. So for example in level 2 it says Level 2 of 8.

Status
Not open for further replies.

Replies
26
Views
992
Replies
7
Views
566
Replies
6
Views
501
Replies
1
Views
366
[Trigger] Help!
Replies
5
Views
587