• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Gate System

Status
Not open for further replies.
Level 3
Joined
May 18, 2009
Messages
30
hello all, now i need a sistem for the gates, when a unit enter X region automatically moves to another location. i need this system because coding in gui every gate up to 25 is tiring. thanks to all :)
 
You could try something like this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Regions[1] = Region 000 <gen>
      • Set Regions[2] = Region 001 <gen>
      • Set Regions[3] = Region 002 <gen>
      • Set Regions[4] = Region 003 <gen>
      • Set Regions[5] = Region 004 <gen>
      • Set TargetRegions[1] = Region 005 <gen>
      • Set TargetRegions[2] = Region 006 <gen>
      • Set TargetRegions[3] = Region 007 <gen>
      • Set TargetRegions[4] = Region 008 <gen>
      • Set TargetRegions[5] = Region 009 <gen>
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Trigger - Add to Trigger1 <gen> the event (Unit - A unit enters Regions[(Integer A)])
  • Trigger1
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 5, do (Actions)
        • Loop - Actions
          • Custom script: if GetTriggeringRegion() == udg_Regions[GetForLoopIndexB()] then
          • Set WhichRegion = (Integer B)
          • Custom script: endif
      • Set TargetPoint = (Center of TargetRegions[WhichRegion])
      • Unit - Move (Triggering unit) instantly to TargetPoint
      • Custom script: call RemoveLocation (udg_TargetPoint)
TargetRegions[] and Regions[] are Region variables. WhichRegion is an Integer variable and TargetPoint a point variable. TargetRegions are the regions that will define the target location.

References you might need:
[•] http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/
[•] http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Status
Not open for further replies.
Top