• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Trigger] Region trigger problem

Status
Not open for further replies.
Level 8
Joined
Dec 16, 2007
Messages
252
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:

44452765.png


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.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
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)
 
Status
Not open for further replies.
Top