• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

open and close gate triggers

Status
Not open for further replies.
Level 2
Joined
Feb 23, 2006
Messages
6
ok i already posted something about this but i havent got any responses to my question ...so plain and simple i need to make a way for someone inside a castle open a gat and for someone outside castle not be able to please help me
 
Level 4
Joined
Feb 12, 2006
Messages
99
You could make a trigger with doodad death of a lever trigger the gate opening, and then revive the lever. (That's how levers work)
 
Level 1
Joined
Mar 11, 2006
Messages
4
If you still are having problems or can't get it to work here is the trigger. BTW you will need to create an array varible.
------------------------------------------------------
Events: Lever dies

Conditions: (None)

Actions:
If:
Gateopen[1] = False

Then:
Open Gate
Set Gateopen[1] = True
Resurect Lever

Else:
Close Gate
Set Gateopen[1] = False
Resurect Lever
 
Level 4
Joined
Nov 24, 2004
Messages
70
You could try this:

Code:
Gate 1
    Events
        Destructible - Lever 0090 <gen> dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                gate1 Equal to 0.00
            Then - Actions
                Destructible - Close Iron Gate (Horizontal) 0000 <gen>
                Wait 20.00 seconds
                Set gate1 = 1.00
                Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation
            Else - Actions
                Destructible - Open Iron Gate (Horizontal) 0000 <gen>
                Wait 20.00 seconds
                Set gate1 = 0.00
                Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation

BTW gate1 is a 'real' type variable.
 
Level 7
Joined
Jul 30, 2004
Messages
451
xXx_burton_xXx said:
You could try this:

Code:
Gate 1
    Events
        Destructible - Lever 0090 <gen> dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                gate1 Equal to 0.00
            Then - Actions
                Destructible - Close Iron Gate (Horizontal) 0000 <gen>
                Wait 20.00 seconds
                Set gate1 = 1.00
                Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation
            Else - Actions
                Destructible - Open Iron Gate (Horizontal) 0000 <gen>
                Wait 20.00 seconds
                Set gate1 = 0.00
                Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation

BTW gate1 is a 'real' type variable.

NEVER use a real (ie floating point) value to store a boolean value (or integer value for that matter) unless its completely necessary (and i don't see why you could simply type-cast it when you needed to), and if you are going to, use loose comparisons to check

i don't know about warcraft 3, but in real programming its possible for floating point values to change overtime because of the way they are stored in different computer architectures and the bit operations that are performed on them

but i don't know why you wrote that, you simply reiterated 1337_s0u1-XTX's solution, except you used a real instead of a boolean, and threw in a wait -- granted if theres only one door, 1337_s0u1-XTX's solution doesn't need an array

either way, don't forget to disable all the opening/closing triggers if the door is destroyed
 
Level 4
Joined
Nov 24, 2004
Messages
70
meh, well i just gave him that code so that he could see another way it CAN be done, i use this 'real variable' method and i have no problems, and i added a wait cuz i took it out of my map and i made it so that once u open a gate ur gonna have to wait 20'sec to close it. Your correct he doesn't need the wait, he doesn't have to add it its not that hard to skip a line.
 
Level 2
Joined
Feb 23, 2006
Messages
6
ya well im sorry i must be retarded iv tried so many different things, trying to follow your instructions but nuthing quite works so once again im just trying to get a unit from inside a castle to hit a trigger and open a gate and then if he hits it again the gate closes. so maybe someone just needs to tell me every little step but any help is greatly appreciated .


o and i tried setting up income but it didnt really work that well , i would like to get 500 gold every 20seconds so if your helping me with the other problem maybe you could just help me with that a little bit to.

thanks
 
Level 1
Joined
Mar 11, 2006
Messages
4
Ok I will give you step-by-step directions. (Just to let you know I am assuming that when your map starts the gate is closed)

1. Go to trigger editor and click on the varible button.

2. Create a varible called GateOpen, make it a boolean array varible, put the initial value to false.

3. Now look at my last post and put in the trigger.

Here are some of the actions/condition that are hard to find.
-----------------------------------------------
Gateopen[1] equal to false - boolean condition, change the ((trigger unit) is a structure) to the varible gateopen.
-----------------------------------------------
Set gateopen[1] equal to false/true - Set varible
-----------------------------------------------

There isn't much more I can say now, sorry.

Here is the trigger that you requested in your last post.

Events:
Time - Periodic Event
Every 20 seconds of game time

Conditions:
(None)

Actions:
Player - Add property
Add 500 to (Player goes here) current gold

----------------------------------------------
Good luck... 1337_s0u1
 
Level 4
Joined
Feb 1, 2006
Messages
107
you could always just use a region...

just put a cirlce of power of, if your more creative a building called gate tower. Then,

Event:
when unit enters (region001)
Conditions:
(here you can put player one only etc, or unit-type of unit equal to gate opener etc)
Actions:
Open gate01

Then make a similar trigger only change it to
Unit leaves region


and


close gate01


If that doesn't work then create another region either infront of the opengate region so you have to pass through it first to open the gate, and leaving the opengate region will cause it to close.
 
Level 9
Joined
Feb 19, 2006
Messages
115
how do you make a dead gate stay dead?

This is great and all, but i have one question. When you make it so a gate opens and closes, how do you make it so when it dies you cant fix it instantly by closing or opening it again? Ive been having some trouble with that. And please dont tell me how stupid i am for not using the 'destructable dies' event, because that does'nt work.
 
Level 1
Joined
Mar 11, 2006
Messages
4
This is great and all, but i have one question. When you make it so a gate opens and closes, how do you make it so when it dies you cant fix it instantly by closing or opening it again? Ive been having some trouble with that. And please dont tell me how stupid i am for not using the 'destructable dies' event, because that does'nt work.
----------------------------------------------
Events:
Destructible - (gate goes here) dies

Conditions:
(none)

Actions:
Trigger - Turn off (Trigger that opens/cloeses gates)

--------------------------------------------------

Hope that helped!
 
Status
Not open for further replies.
Top