Island Defense
May 24, 2012, 08:23:15 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: not so new version:  3.0.6G4, 3.0.8d
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to: Make a Decent Gate Trigger  (Read 445 times)
0 Members and 1 Guest are viewing this topic.
AoW_Hun7312
Spearloc
***

Karma: +9/-16
Posts: 205


Warcraft III Map Maker


View Profile
« on: January 15, 2009, 09:22:46 PM »

How to: Make a Decent Gate Trigger
*Not for beginners with World Editor. This is assuming you know basic knowledge.




We've all seen gates in different maps. Some of them better than others. Have you ever wondered how they made it?


Step One: Creating the Variables

In order to start on our trigger, we'll need some variables.



They should be safe explanatory. The array size is how many gates you will be using.


Step Two: The Triggers

You will only need three triggers for this to work.

Code:
Initalization
    Events
        Map initialization
    Conditions
    Actions
        Set Gate[1] = Demonic Gate (Horizontal) 0000 <gen>
        Set Gate[2] = Demonic Gate (Horizontal) 0001 <gen>
        Set Gate[3] = Demonic Gate (Horizontal) 0002 <gen>
        Set Gate[4] = Demonic Gate (Horizontal) 0003 <gen>
        Set Gate[5] = Demonic Gate (Horizontal) 0004 <gen>
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Trigger - Add to Gate Dies <gen> the event (Destructible - Gate[(Integer A)] dies)

Code:
Gate Dies
    Events
    Conditions
    Actions
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Gate[(Integer A)] Equal to (Dying destructible)
                    Then - Actions
                        Set Gate[(Integer A)] = No destructible
                    Else - Actions

Code:
Open Close Gates
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Set tempPoint = (Position of Gate[(Integer A)])
                Set tempGroup = (Units within 300.00 of tempPoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A structure) Equal to False)))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Gate[(Integer A)] is alive) Equal to True
                        Gate[(Integer A)] Not equal to No destructible
                        (Number of units in tempGroup) Greater than 0
                    Then - Actions
                        Set GateLife[(Integer A)] = (Current life of Gate[(Integer A)])
                        Trigger - Turn off Gate Dies <gen>
                        Destructible - Open Gate[(Integer A)]
                        Trigger - Turn on Gate Dies <gen>
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Gate[(Integer A)] is dead) Equal to True
                                Gate[(Integer A)] Not equal to No destructible
                                (Number of units in tempGroup) Equal to 0
                            Then - Actions
                                Destructible - Close Gate[(Integer A)]
                                Destructible - Set life of Gate[(Integer A)] to GateLife[(Integer A)]
                            Else - Actions
                Custom script:   call RemoveLocation(udg_tempPoint)
                Custom script:   call DestroyGroup(udg_tempGroup)

To those of you who can't tell right off the bat what these do, I'll break it down.
  • The trigger "Initialization" sets up the trigger for us. It sets the GateVariable you made before to your Gates.
  • The trigger "Gate Dies" makes it so if a certain unit kills the gate, it stays dead.
  • The trigger "Open Close Gates" checks within 300 range of each gate if a unit is near it. If it is, it opens the gate, assuming it hasn't been killed by another unit. If there isn't, it closes the gate, again, assuming if it hasn't been killed by another unit.


The only modifications you could add to this code is if you wanted only certain units to trigger them, or if you wanted an ally of a certain player to do it.


Once your done implementing these into your map, test it out. It should work smoothly.
« Last Edit: January 15, 2009, 09:27:12 PM by AoW_Hun7312 » Logged
AoW_Hun7312
Spearloc
***

Karma: +9/-16
Posts: 205


Warcraft III Map Maker


View Profile
« Reply #1 on: January 15, 2009, 09:29:14 PM »

Ok, I've finished my little mini-guide to the World Editor. I may make more later  Roll Eyes
Logged
jadegolem
Titan Hunter
****

Karma: +11/-41
Posts: 383


I Rock, Literally


View Profile
« Reply #2 on: January 16, 2009, 10:48:11 PM »

question... why dont you post the map in a link so i can look at it without squibly triggers actions that aern't trigger texts... please?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!