• 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] Using countdown timers instead of expiration timer on these triggers

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
How can I apply MUI or MPI countdown timers instead of unit expiration timer on the triggers presented:
Trigger1:
  • X
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Set Loc1 = (Position of (Triggering unit))
      • Unit - Create 1 Dummy One for (Owner of (Triggering unit)) at Loc1 facing (Facing of (Triggering unit)) degrees
      • Custom script: call RemoveLocation(udg_Loc1)
      • Unit - Add a 0.31 second Generic expiration timer to (Last created unit)
Trigger2:
  • Y
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Dummy One
    • Actions
      • Set Loc1 = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Two for (Owner of (Triggering unit)) at Loc1 facing (Facing of (Triggering unit)) degrees
      • Unit - Add a 0.02 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Loc1)
Trigger3:
  • Z
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Dummy Two
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CustomInteger[(Player number of (Owner of (Triggering unit)))] Greater than or equal to 10
        • Then - Actions
          • Set CustomInteger[(Player number of (Owner of (Triggering unit)))] = 0
        • Else - Actions
          • Set Loc1 = (Position of (Triggering unit))
          • Unit - Create 1 Dummy Two for (Owner of (Triggering unit)) at Loc1 facing (Facing of (Triggering unit)) degrees
          • Custom script: call RemoveLocation(udg_Loc1)
          • Unit - Add a 0.02 second Generic expiration timer to (Last created unit)
          • Set CustomInteger[(Player number of (Owner of (Triggering unit)))] = (CustomInteger[(Player number of (Owner of (Triggering unit)))] + 1)
Here's the thing: The first trigger fires when an unit casts an ability, then an unit of type Dummy One unit is created and an expiration timer is added to it, the second trigger is fired when that unit dies, then an second type of dummy (Dummy Two) unit is created and expiration timer is added to it, after it dies the third trigger is then fired, another unit of type Dummy Two is then created and on that trigger the CustomInteger value will be set to +1 for each unit of type Dummy Two that died until the CustomInteger reaches the number of 10, after the CustomInteger reaches the value of 10 units are no longer created, therefore, stopping the actions on the third trigger, so basicaly the trigger will repeat itself until the integer reaches 10.

I wanted to use countdown timers instead of this system because of it's performance superiority over the expiration timer system, can anyone help me achieve it ?
 
Last edited:
You'll use one Peridoic-Timer for the Counting.
The other Timers are only Numbers in some Type of Stack
Something like this
  • Timer
    • Ereignisse
      • Zeit - Every 0.03 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer A) from Timer_First to (Timer_Last - 1), do (Actions)
        • Schleifen - Aktionen
          • Set Timer_Dur[(Integer A)] = (Timer_Dur[(Integer A)] - 0.03)
          • -------- End of Timer? --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditons
              • Timer_Dur[(Integer A)] <= 0.00
            • Then - Actions
              • -------- Maybe Reload? --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditons
                  • Timer_Reloads[(Integer A)] > 0
                • Then - Actions
                  • -------- Reload --------
                  • Set Timer_Dur[(Integer A)] = Timer_Reload_Dur[(Integer A)]
                  • Set Timer_Reloads[(Integer A)] = (Timer_Reloads[(Integer A)] - 1)
                • Else - Actions
                  • -------- Do Effect --------
                  • Spezialeffekt - Create a special effect at Timer_Pos[(Integer A)] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                  • Spezialeffekt - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_Timer_Pos[GetForLoopIndexA()])
                  • -------- End of Reloads --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditons
                      • (Integer A) != Timer_First
                    • Then - Actions
                      • -------- save Timer --------
                      • Set Timer_Dur[(Integer A)] = Timer_Dur[Timer_First]
                      • Set Timer_Reloads[(Integer A)] = Timer_Reloads[Timer_First]
                      • Set Timer_Reload_Dur[(Integer A)] = Timer_Reload_Dur[Timer_First]
                      • Set Timer_Pos[(Integer A)] = Timer_Pos[Timer_First]
                    • Else - Actions
                  • Set Timer_First = (Timer_First + 1)
                  • -------- End of loops --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditons
                      • Timer_First == Timer_Last
                    • Then - Actions
                      • Set Timer_First = 0
                      • Set Timer_Last = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
  • Start Timer
    • Ereignisse
      • Einheit - A unit ends casting
    • Bedingungen
      • (Ability being cast) Gleich Donnerschlag
    • Aktionen
      • Set Timer_Pos[Timer_Last] = (Position of (Triggering unit))
      • Set Timer_Reload_Dur[Timer_Last] = 0.03
      • Set Timer_Reloads[Timer_Last] = 10
      • Set Timer_Dur[Timer_Last] = 0.31
      • Set Timer_Last = (Timer_Last + 1)
      • Trigger - Turn on Timer <gen>

Maybe off topic.
If you just want to create an Delayed/Periodic effect you'll could try using Bribes - Spellsystem.
GUI Spell System v1.6.0.0
It Indexes Spellinstances of Spells you configed for it. Allowing periodic effects and other stuff pretty easy.
 

Attachments

  • Timer.w3x
    17.9 KB · Views: 42
Level 24
Joined
Aug 1, 2013
Messages
4,658
...

"performance superiority"

Yea, except that you would require to use multiple timers or stack the units if you want to improve the performance.
Currently, changing it to a periodic timer reduces the performance of the system.
Stacking the units is actually possible in GUI with very little problems, but it does restrict you to use a constant duration.
Multiple timers is the easiest solution by far as long as you use JASS... which you dont.
 
No, I say that the easiest solution would be to have multiple timers.
But there is still a good efficient solution in GUI.

I disagree on both points. The best solution is to stop click-making illegible spagetti code.

That way people with professional debugging experience will bother to read your triggers.
 
I'm sorry. Did I did something wrong ?

When you come to this point that you're trying to make MPI/MUI abilities or systems, using the GUI trigger editor starts to be questionable. You're making your map script unmaintainable and very hard to debug.

* Instead of talking about instances of systems or spell states, you have to talk about instances of individual primitives. This is an unnecessary mental burden that you can abstract away.
* Instead of writing declarative systems that order the script to behave in some way, you're forced to write reactive systems that (1) separate core logic into separate triggers that have no business being separated, and (2) prevent the refactoring of core logic that has no business being coupled.

If you're interested in making these systems for warcraft 3 you need to work in a different abstraction (not GUI) or alternatively, at a lower level (plain jass).

* If you don't care about writing systems, and you just want this trigger you have to work in some context it wasn't made for, you're better off having someone re-write it.

It isn't interesting to talk about what's possible, fastest, or easiest in GUI. It isn't interesting to fix bugs in GUI systems. It isn't interesting to answer your query.

Walk the path to enlightenment.
 
Level 11
Joined
Oct 9, 2015
Messages
721
I'll try the solution and come with a feedback, learning JASS is out of the table for me at the moment, due to the lack of time on my life and because I've achieved most of the goals on the road so far using only GUI plus I know exactly nothing about coding, so the gui interface has been very friendly to me, I'm not saying I don't want to learn more advanced coding, I'm saying I don't have the time for it at the moment.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
"I've achieved most of the goals on the road so far using only GUI plus I know exactly nothing about coding"
I've seen a cow fly plus cows cant fly.

Using GUI Triggers is half way coding already.
You apply the exact same logic and same methods to achieve what you want.
The only real thing that you will gain when using JASS is the stuff that is not (properly) included in GUI Triggers and you will be introduced to functions.

But yea, go for it in GUI ;)
 
Status
Not open for further replies.
Top