Lever

Crofna

New Member
Reaction score
0
I made lever something like this (cant copy GUI coz no WE on this comp...)
When lever dies, gates will open.
But i want lever wich can open and close door.
 

Moridin

Snow Leopard
Reaction score
144
How about something like this. You have a real variable that's default is 0 (It is named Lever_Set in the triggers below). Make the lever have 999999 life (Not invulnerable, you want it to be attackable) and 99999 life regen. Then set a trigger such that:

Trigger:
  • Lever gets attacked
    • Events
      • Unit - A unit is attacked
    • Conditions
      • Unit - Unit-type of (Triggering unit) Equal to Lever
    • Actions
      • If (multiple conditions) then (then actions) else (else actions)
        • If - conditions
          • Lever_Set = 0
        • then - actions
          • Set Lever_Set = 1
        • else - actions
      • If (multiple conditions) then (then actions) else (else actions)
        • If - conditions
          • Lever_Set = 1
        • then - actions
          • Set Lever_Set = 0
        • else - actions


...and then make two more triggers with the events:

Game - Lever_Set becomes equal to 1

...for this trigger (above)^ make it open the gate in the actions.

Game - Lever_Set becomes equal to 0

...for this trigger (above)^ make it close the gate in the actions.
 

Crofna

New Member
Reaction score
0
Trigger:
  • Lever gets attacked
    • Events
      • Unit - A unit is attacked
    • Conditions
      • Unit - Unit-type of (Triggering unit) Equal to Lever
    • Actions
      • If (multiple conditions) then (then actions) else (else actions)
        • If - conditions
          • Lever_Set = 0
        • then - actions
          • Set Lever_Set = 1
        • else - actions
      • If (multiple conditions) then (then actions) else (else actions)
        • If - conditions
          • Lever_Set = 1
        • then - actions
          • Set Lever_Set = 0
        • else - actions


Action part...
 

Joccaren

You can change this now in User CP.
Reaction score
54
Hes using Integer Variables and If/Then/Elses

You can create variable in the variable window (Click the golden 'X' in your trigger editor)

You can set variables to a value by using the 'set variable' action.

If/Then/Else I think you can do. If not, ask and I'll tell you.
 

Crofna

New Member
Reaction score
0
Trigger:
  • Lever
    • Events
      • Unit - Lever 0537 <gen> Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lever
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions


Now what? What type of variable i need?
 

Crofna

New Member
Reaction score
0
Cool, now i made

Trigger:
  • Lever
    • Events
      • Unit - Lever 0537 <gen> Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lever
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Lever_Set Equal to 0
        • Then - Actions
          • Set Lever_Set = 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Lever_Set Equal to 1
        • Then - Actions
          • Set Lever_Set = 0
        • Else - Actions


What now?
 

Joccaren

You can change this now in User CP.
Reaction score
54
Create two triggers.

One activates when the Integer Variable becomes 0 and then opens the door.

Two activates when the Integer Variable becomes 1 and then closes the door.
 

Moridin

Snow Leopard
Reaction score
144
Joccaren you need Real variables...not integer.

Basically theres an event "a real variable becomes ____" and you need to trigger that so that the gate opens and closes.

As for "what now?":

1) Create a trigger something like:

Trigger:
  • Trigger
    • Events
      • Game - Lever_Set becomes Equal to 1
    • Conditions
    • Actions
      • <open the gate....I'm not sure how to do this as I haven't fiddled with gates>


2) Create another trigger like:

Trigger:
  • Trigger
    • Events
      • Game - Lever_Set becomes Equal to 1
    • Conditions
    • Actions
      • <close the gate....I'm not sure how to do this as I haven't fiddled with gates>
 

Joccaren

You can change this now in User CP.
Reaction score
54
Joccaren you need Real variables...not integer.

Why? In your WC3 tags here you used Integer. The only difference between the two is that reals can be 0.01, 0.02 ect and Integers can not. If he really wanted to, he could use a boolean for the same affect.
 

Moridin

Snow Leopard
Reaction score
144
Woops...didn't realise the wc3 tags part...it was freehand and I'm used to integers.

He needs real for the event. I'm not sure...but I don't think there's an event to do with an integer becoming a certain value.

Edit: btw, I understand the difference between reals and integers thanks :p.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Well, it would be easier to use reals but there are also these two things:

1. (Conversion (Integer to Real))
2. (Run (Trigger 2) Ignoring Conditions)
 

Crofna

New Member
Reaction score
0
Guyz, guyz...
Now you confused me! If I make integer variable I cant open/close door. If i make real i cant set

Trigger:
  • Lever 1
    • Events
      • Unit - Lever 0537 <gen> Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lever
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Value Equal to 0
        • Then - Actions
          • Set Variable = 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Value Equal to 1
        • Then - Actions
          • Set Variable = 0
        • Else - Actions
 

Moridin

Snow Leopard
Reaction score
144
Lol. I apologise crofna :p.

Actually to make it much simpler....all you have to do is slightly modify that one trigger:

Trigger:
  • Lever 1
    • Events
      • Unit - Lever 0537 <gen> Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lever
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Value Equal to 0
        • Then - Actions
          • Set Variable = 1
          • <Door opening actions here>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Value Equal to 1
        • Then - Actions
          • Set Variable = 0
          • <Door closing actions here>
        • Else - Actions
 

Joccaren

You can change this now in User CP.
Reaction score
54
Lolz, should have seen that sooner

Also, in your first If/Then Else, add this action:

Trigger:
  • Animation - Play (Lever)'s (Death) animation


and this to your second I/T/E:

Trigger:
  • Animation - Play (Lever)'s (Stand) animation
 

Moridin

Snow Leopard
Reaction score
144
Crofna, for each door you will probably need a new variable. Also make sure that the condition checks for the right lever and the actions open the right door.

@Joccaren: We all make mistakes :p lol. I didn't see that either.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top