• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] GST System issue. My unit stucking.

Level 17
Joined
Jun 2, 2009
Messages
1,193
  • BandajGST
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Bandaj // Aktif
      • (Charges remaining in (Item carried by (Triggering unit) of type Bandaj)) Greater than or equal to 1
      • BANDAGE[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set BANDAGE[(Player number of (Owner of (Triggering unit)))] = True
      • Game - Display to (All players) the text: (Name of the current trigger)
      • Item - Set charges remaining in (Item carried by (Triggering unit) of type Bandaj) to ((Charges remaining in (Item carried by (Triggering unit) of type Bandaj)) - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item carried by (Triggering unit) of type Bandaj)) Less than or equal to 0
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
        • Else - Actions
      • Set BandajSTAT[(Player number of (Owner of (Triggering unit)))] = (5.00 - ((Real((Agility of (Triggering unit) (Include bonuses)))) x 0.03))
      • Set UncleTheBest = (Triggering unit)
      • Unit - Pause UncleTheBest
      • Set GST_Trigger = BandajEnd <gen>
      • Custom script: call GST_Unit(udg_UncleTheBest, false, udg_BandajSTAT[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1])

  • BandajEnd
    • Events
    • Conditions
    • Actions
      • Set BANDAGE[(Custom value of GST_Unit1)] = False
      • Unit - Unpause GST_Unit1
      • Unit - Set life of GST_Unit1 to ((Life of GST_Unit1) + 10.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BANDAGE[(Custom value of GST_Unit1)] Equal to False
        • Then - Actions
          • Game - Display to (All players) the text: false
        • Else - Actions
          • Game - Display to (All players) the text: true

This system can detect and unpause GST_Unit1 but it cannot set false to Custom value of GST_Unit1
Or it does but after second use, this trigger not runs again. I can cast this ability anytime i want without pause.

Update: Here is the source of the problem.
BANDAGE[2] Equal to False this one never turns to False.
And if i disable this condition
BANDAGE[(Player number of (Owner of (Triggering unit)))] Equal to False it starts infinite loop. But still i don't know how to fix it.

Update 2:
  • Set BANDAGE[(Custom value of GST_Unit1)] = False
  • Set BANDAGE[(Player number of (Owner of GST_Unit1))] = False
  • Set BANDAGE[(Player number of (Owner of UncleTheBest))] = False
None of these solved the issue, in the opposite now it started to infinite loop.
 
Last edited:
Level 21
Joined
Feb 27, 2019
Messages
623
Lets see what works. First off Triggering unit, GST Unit1 and UncleTheBest are the same unit.
Explanation:
1. In the first trigger triggering unit is set to UncleTheBest
2. Then when GST_Unit runs it probably sets UncleTheBest = GST_Unit1
3. Running a trigger within another trigger retains the event responses so triggering unit can also still be used

The second thing is between using Custom value of unit vs Player number of Owner of unit as an Index. Since Player number of Owner of unit is used in the first trigger it makes sense for it to be used in the second as well because Custom value is attached to a unit while player number is set for each player. Its a difference between mui and pmi or whatever its called and they are not and cant be used indistinguishably in the general sense. You can test this by displaying the actual number Custom value of unit vs Player number of Owner of unit and unit-type in clear text.

This difference is what causes the different behaviours. First using player number then trying to use custom value will cause BANDAGE(Player number) to never return to false and be kept at true for eternity. Using Player number is more correct since its the same Index as the first trigger however there is some other error at play here.

Pausing and unpausing a unit to ignore a spell cast is not what I would do in version 1.36 but is it safe to say you are not using version 1.36?
 
Level 40
Joined
Feb 27, 2007
Messages
5,112
  • Item - Remove (Item carried by (Triggering unit) in slot (Integer A)) this removes all their items, not just Bandaj.
  • Save yourself a few function calls and use an item variable. Set YourItemVar = (Item carried by (Triggering unit) of type Bandaj) then refer to this variable every time and just remove that specific item.
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,716
Nobody is really going to know what the GST system is or does, I never bothered uploading it as a public resource.

Anyway, I'll structure your triggers in a way that should work nicely:
  • BandageStartCasting
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Bandaj // Aktif
      • (Charges remaining in (Item carried by (Triggering unit) of type Bandaj)) Greater than or equal to 1
    • Actions
      • Set Bandage_Unit = (Triggering unit)
      • Set Bandage_Item = (Item carried by Bandage_Unit of type Bandaj)
      • Item - Set charges remaining in Bandage_Item to (Charges remaining in Bandage_Item) - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in Bandage_Item) Less than or equal to 0
        • Then - Actions
          • Item - Remove Bandage_Item
        • Else - Actions
      • Set Bandage_Duration = (5.00 - ((Real((Agility of Bandage_Unit (Include bonuses)))) x 0.03))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bandage_Duration Less than 0
        • Then - Actions
          • Set Bandage_Duration = 0
        • Else - Actions
      • Set GST_Trigger = BandageFinish <gen>
      • Custom script: call GST_Unit( udg_Bandage_Unit, false, udg_Bandage_Duration + 1 )
      • Set Bandage_CV = (Custom value of Bandage_Unit)
      • Set Bandage_Timer[Bandage_CV] = (Last started timer)
We NEVER want to start a Timer with a duration less than 0 seconds. That'll cause an immediate crash.
  • BandageStopCasting
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Bandaj // Aktif
    • Actions
      • Set Bandage_CV = (Custom value of GST_Unit1)
      • Custom script: call DestroyTimer( udg_Bandage_Timer[udg_Bandage_CV] )
  • BandageFinish
    • Events
    • Conditions
    • Actions
      • Unit - Set life of GST_Unit1 to ((Life of GST_Unit1) + 10.00)
      • Unit - Order GST_Unit1 to Stop
Make sure your Bandaj // Aktif ability has a long enough channeling time, just set it to 100 seconds or something that is guaranteed longer than Bandage_Duration + 1.

New variables:
Bandage_Timer = Timer (array)
Bandage_CV = Integer
Bandage_Item = Item

I also changed the names of the variables/triggers and got rid of some. BandajSTAT does not need to be an Array.

To explain what the GST system does, this function:
  • Custom script: call GST_Unit( udg_Bandage_Unit, false, Bandage_Duration + 1 )
1) Creates a One-shot timer (false) and starts it with an interval of: Bandage_Duration + 1.
2) Saves the Timer in a Hashtable.
3) Saves the passed in Unit (Bandage_Unit) in a Hashtable, linking to the Timer.
4) Saves GST_Trigger in a Hashtable, linking to the Timer.
5) When the timer expires, the system sets different GST_ variables based on the type of GST() function you called. In this case we called GST_Unit(), which tracks one Unit, so the system will set the variable GST_Unit1 to this unit.
6) Immediately after setting the GST variables the system runs the saved GST_Trigger.
7) You can reference the appropriate GST variables in your GST_Trigger, creating what's basically "local" timers that can track "local variables" over time. It also has a way to make the timer "global" so it can be restarted.

There's a bunch of different functions for tracking different types of data: GST_Unit, GST_Integer, GST_Real, etc.

It's pretty much the same as those TimerUtils libraries everyone uses in Jass, just GUI-ified.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,193
Thank you for your help again @Uncle but i have already corrected my trigger after order GST_Unit1 stop and i was realized it removes all items not only bandaj (pyrogasm already mentioned about it) and my system is currently works without any issues. But when i release beta versions and issues starts, i will replace my trigger with this fixed version by you. By the way my map already have 100 stat limit. This is why timers never went below 2.0 (2.0 is the maximum speed for the bandage)
Solved. Thank to everyone.
 
Top