• 🏆 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!

[Trigger] periodic event doesnt take variable real...??

Status
Not open for further replies.
Level 3
Joined
Jun 23, 2007
Messages
32
i need to use a variable for periodic time event..and it wont let me use a real variable..

is using a variable for periodic time event not allowed??

or what is the variable type?
 
Level 3
Joined
Jun 23, 2007
Messages
32
  • t1 spawning
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in playergroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • t1spawning[(Player number of (Picked player))] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in massattackgolems[(Player number of (Picked player))]) Less than or equal to 100
                • Then - Actions
                  • Set point = (Center of t1golemspawnregion[(Player number of (Picked player))])
                  • Unit - Create 1 t1golemtype[(Player number of (Picked player))] for (Picked player) at point facing (Random angle) degrees
                  • Unit Group - Add (Last created unit) to massattackgolems[(Player number of (Picked player))]
                  • Wait 2.00 seconds
                  • Custom script: call RemoveLocation(udg_point)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in massattackgolems[(Player number of (Picked player))]) Less than 80
                • Then - Actions
                  • Set point = (Center of t1golemspawnregion[(Player number of (Picked player))])
                  • Unit - Create 1 t1golemtype[(Player number of (Picked player))] for (Picked player) at point facing (Random angle) degrees
                  • Unit Group - Add (Last created unit) to massattackgolems[(Player number of (Picked player))]
                  • Wait 2.00 seconds
                  • Custom script: call RemoveLocation(udg_point)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in massattackgolems[(Player number of (Picked player))]) Less than 50
                • Then - Actions
                  • Set point = (Center of t1golemspawnregion[(Player number of (Picked player))])
                  • Unit - Create 1 t1golemtype[(Player number of (Picked player))] for (Picked player) at point facing (Random angle) degrees
                  • Unit Group - Add (Last created unit) to massattackgolems[(Player number of (Picked player))]
                  • Custom script: call RemoveLocation(udg_point)
                • Else - Actions
            • Else - Actions
This is not the trigger but it's why I'm trying to get a variable into:

  • Time - Every 2.00 seconds of game time
I'm trying to make a trigger that detects how many units the player owns, and then automatically makes a unit every 2 seconds depending on that.

under 50 would spawn 3 units per 6 seconds, 50-79 = 2 units per 6 seconds, 80-100 = 1 unit per 6 seconds.

Using
  • Wait 2.00 seconds
causes the posted trigger to only produce 1 unit per 6 seconds no matter what. It skips the rest of the trigger.

if you need more of an explanation for why i need a variable in periodic event i can explain....
 
Level 22
Joined
Feb 26, 2008
Messages
891
That's going to need some tweaking....

First off, you can add a variable to an event if you removed the event from the trigger, then use ANOTHER trigger with the action Trigger - Add Event. You can add the event through a trigger and it will allow a variable.
However, this does not help you. Here's why.
Event are only registered once. They are registered when the trigger is created. So, it will make the periodic time whatever the variable is right then, and it will not change with the variable.

I would suggest using a timer. That will allow you to specify a new timeout period every time you restart the timer.
 
Status
Not open for further replies.
Top