• 🏆 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] [Solved] Weird Glitch

Status
Not open for further replies.
Level 6
Joined
Jul 12, 2021
Messages
95
When I set the array size of a Timer or Integer variable to 32,768 many triggers stop working.

For example:
  • Skeletons lvl 70 7 BloodWarriors
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Skeleton Marine for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • For each (Integer A) from 1 to 7, do (Actions)
        • Loop - Actions
          • Unit - Create 1 |cffff5050Skeleton Blood Warrior|r for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • Camera - Lock camera target for Player 1 (Red) to (Last created unit), offset by (0.00, 0.00) using Default rotation
      • Wait 0.01 seconds
      • Camera - Reset camera for Player 1 (Red) to standard game-view over 0.00 seconds
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Exp Skeleton Level 100 for Player 2 (Blue) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
  • Hide Dummy
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Unit - Hide Mountain King Dummy 1659 <gen>
      • Unit - Hide Mountain King Dummy2 1662 <gen>
It's driving me crazy, it doesn't makes any sense that this happen.
Does somebody knows how can I fix this?
 
Level 6
Joined
Jul 12, 2021
Messages
95
Thank you for your replies.

What doesn't make any sense is what your triggers have anything to do with the question...
Yes, they do. That's why the glitch is weird. The triggers have absolutely anything to do with the variables.
There are many triggers that stop working that have no relation with the variables. I quickly noticed at least 6 triggers, its very likely there's more.
Max array size is 32768, including 0, so 32768 index doesn't work because of that.
The glitch happens when the array size is settled to 32768. It happens even if I do not use the variable.

When war3map.j grows too large, and also when initialization section of the map script grows too large, then things stop working
I don't know what war3map.j is, but I think that must be the cause. It can't be a problem with initialization, since I haven't changed initialization for a while.

A better question is: why are you setting array size to 32,768
I do not use an Integer variable of 32,768, I just noticed the glitch.

What I do use is Timer variables with big array sizes. That's because I use a lot of triggers like this one:
  • Countdown Timer - Start BloodPactTimer[(Custom value of (Triggering unit))] as a One-shot timer that will expire in 1.00 seconds
There are more around 1500 units in my map, so the Custom value of Triggering unit can be up to 1500.

There's something weird about Timer arrays, and that is, that the array size has to be greater than or equal to the array index. So, if the index is 1500 (like in my map) the Timer array size has to be at least 1500. I was settling the Timer variables to the maximum value, to be 100% sure that everything would work fine, but I found that weird glitch (perhaps I should call it "limitation").
If nothing can be done, then, I guess settling Timer array size to 2000 would be more than enough for my triggers, though, I may reach the limit after several triggers.


I guess this is a limitation with GUI. I know coding provides different approach with timers.
 
Last edited:

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,537
I don't know what war3map.j is, but I think that must be the cause.

It can't be a problem with initialization, since I haven't changed initialization for a while.

I know coding provides different approach with timers.

You seem to be confident about things for someone who doesn't know what war3map.j is

I recommend closing this thread since you're reporting a known issue, you don't need guidance, and you already seem to know that you're wasting your time with GUI
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,890
Thank you for your replies.


Yes, they do. That's why the glitch is weird. The triggers have absolutely anything to do with the variables.
There are many triggers that stop working that have no relation with the variables. I quickly noticed at least 6 triggers, its very likely there's more.
The triggers you posted use 0 variables. The only trigger that was relevant was the trigger on the post I'm currently replying to.
The glitch happens when the array size is settled to 32768. It happens even if I do not use the variable.


I don't know what war3map.j is, but I think that must be the cause. It can't be a problem with initialization, since I haven't changed initialization for a while.


I do not use an Integer variable of 32,768, I just noticed the glitch.
It's not a glitch, it's an intentional (but stupid) limitation.
What I do use is Timer variables with big array sizes. That's because I use a lot of triggers like this one:
  • Countdown Timer - Start BloodPactTimer[(Custom value of (Triggering unit))] as a One-shot timer that will expire in 1.00 seconds
There are more around 1500 units in my map, so the Custom value of Triggering unit can be up to 1500.
Because timer BloodPactTimer[(Custom value of (triggering unit))] is null, it doesn't even exit, you must either initialize the timer arrays to a high value (Size: 3000 in the variable dialog), like you mentioned, or manually do it: custom script: set udg_BloodPactTimer[GetUnitUserData(GetTriggerUnit())] = CreateTimer().
There's something weird about Timer arrays, and that is, that the array size has to be greater than or equal to the array index. So, if the index is 1500 (like in my map) the Timer array size has to be at least 1500. I was settling the Timer variables to the maximum value, to be 100% sure that everything would work fine, but I found that weird glitch (perhaps I should call it "limitation").
If nothing can be done, then, I guess settling Timer array size to 2000 would be more than enough for my triggers, though, I may reach the limit after several triggers.


I guess this is a limitation with GUI. I know coding provides different approach with timers.
Then I guess this shouldn't be very hard? It would require more specific triggers regarding this issue to find the what's going wrong.
 
Level 6
Joined
Jul 12, 2021
Messages
95
Thank you everyone for the replies.

You seem to be confident about things for someone who doesn't know what war3map.j is

I recommend closing this thread since you're reporting a known issue, you don't need guidance, and you already seem to know that you're wasting your time with GUI
I might be wrong. Perhaps someone else could offer a different insight. I'll close it after a while.


JASS array size -> 32768 (current)
Index requested -> 32768

Since all of the indices available include 0, that means the requested index is out of bounds, which will definitely produce glitches.
As I said before, the glitch happens when the array size is settled to 32,768. It happens even if I do not use the variable.



Wrda, my friend, I'm really grateful that you are trying to help, but I'm afraid you haven't understood the issue yet. Everything I said makes sense and all the triggers I've posted are relevant. I recommend you to carefully re-read the thread.

The triggers you posted use 0 variables.
Yes, they have 0 variables, yet, they stop working. That's why I referred to the issue as a weird glitch and also that it makes no sense.
I'll explain the issue one more time but in a different way. Prepare to get your mind blowed.

If I have the next 2 triggers everything works fine. There are many other triggers that work well, but I'm not posting them to don't make the reply too large.
  • Skeletons lvl 70 7 BloodWarriors
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Skeleton Marine for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • For each (Integer A) from 1 to 7, do (Actions)
        • Loop - Actions
          • Unit - Create 1 |cffff5050Skeleton Blood Warrior|r for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • Camera - Lock camera target for Player 1 (Red) to (Last created unit), offset by (0.00, 0.00) using Default rotation
      • Wait 0.01 seconds
      • Camera - Reset camera for Player 1 (Red) to standard game-view over 0.00 seconds
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Exp Skeleton Level 100 for Player 2 (Blue) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
  • Hide Dummy
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Unit - Hide Mountain King Dummy 1659 <gen>
      • Unit - Hide Mountain King Dummy2 1662 <gen>
Here comes the "weird glitch that makes no sense": If I create a Timer variable and set the array size to 32,768 the previous triggers stop working. It happens even if I do not use the variable in any trigger.
The previous triggers do not use any variable, yet, they stop working.
The glitch also happens if I create many Timer variables with a lower array size, like 2000.

Because timer BloodPactTimer[(Custom value of (triggering unit))] is null, it doesn't even exit...
I forgot to mention that I'm using an Unit Indexer System. This sets the custom value of every unit to an integer.



Most of the information I find about war3map.j is about map protection or game crashes. Could someone please provide more information about war3map.j? Perhaps someone else has a different insight to this issue?
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,890
As I said before, the glitch happens when the array size is settled to 32,768. It happens even if I do not use the variable.
Exactly, to 32,768. index 0 is included, so the range of arrays is 0-32,767, not 32,768. So what happens if you stop this absurd high value and establish to 2000 for example? what about 5000?
Wrda, my friend, I'm really grateful that you are trying to help, but I'm afraid you haven't understood the issue yet. Everything I said makes sense and all the triggers I've posted are relevant. I recommend you to carefully re-read the thread.


Yes, they have 0 variables, yet, they stop working. That's why I referred to the issue as a weird glitch and also that it makes no sense.
I'll explain the issue one more time but in a different way. Prepare to get your mind blowed.

If I have the next 2 triggers everything works fine. There are many other triggers that work well, but I'm not posting them to don't make the reply too large.
  • Skeletons lvl 70 7 BloodWarriors
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Skeleton Marine for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • For each (Integer A) from 1 to 7, do (Actions)
        • Loop - Actions
          • Unit - Create 1 |cffff5050Skeleton Blood Warrior|r for Player 1 (Red) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
      • Camera - Lock camera target for Player 1 (Red) to (Last created unit), offset by (0.00, 0.00) using Default rotation
      • Wait 0.01 seconds
      • Camera - Reset camera for Player 1 (Red) to standard game-view over 0.00 seconds
      • For each (Integer A) from 1 to 24, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Exp Skeleton Level 100 for Player 2 (Blue) at (Point(-800.00, -700.00)) facing (Random point in (Playable map area))
  • Hide Dummy
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Unit - Hide Mountain King Dummy 1659 <gen>
      • Unit - Hide Mountain King Dummy2 1662 <gen>
Here comes the "weird glitch that makes no sense": If I create a Timer variable and set the array size to 32,768 the previous triggers stop working. It happens even if I do not use the variable in any trigger.
The previous triggers do not use any variable, yet, they stop working.
The glitch also happens if I create many Timer variables with a lower array size, like 2000.


I forgot to mention that I'm using an Unit Indexer System. This sets the custom value of every unit to an integer.
Yes, I see. Because in the script JASS initializes your variables to their max array size, MyVariable[32768] passes the limit, the limit is between 0-32767 like I said above, so obviously it goes wrong there.
Solution: Don't make such high values.
 
Level 6
Joined
Jul 12, 2021
Messages
95
Exactly, to 32,768. index 0 is included, so the range of arrays is 0-32,767, not 32,768. So what happens if you stop this absurd high value and establish to 2000 for example? what about 5000?
If I set the array size to 32,767 the same thing happens. If I set it to 2000 everything works fine, BUT, if I create many variables and set them all to 2000 the same thing happens.

Solution: Don't make such high values.
I guess I'll need to create my triggers in a different way. 😞
 
Trying to set the array size of a timer variable in GUI actually preloads the same amount of timers in the initialization phase. Aside from going out of bounds with the array index, creating 32768 timers is bound to cause some problems with initialization, due to the op limit which limits the amount of operations a single thread can perform in JASS.

If I set the array size to 32,767 the same thing happens. If I set it to 2000 everything works fine, BUT, if I create many variables and set them all to 2000 the same thing happens.

Creating this much timer handles is bound to make the initializer thread reach the op limit and prevent some possibly crucial triggers from initializing. In other words, if a single trigger initializing is the equivalent of holding a pebble, then creating about 32767 timers is roughly equivalent to holding a boulder. If the maximum amount of pebbles you can carry is about 100000, then a boulder is bound to take up much of that, heavily reducing the amount of pebbles you can hold. Carry enough boulders, and some pebbles which are absolutely crucial cannot be held.

As a workaround, you'll have to create the timer at the moment when you need to use it, which Wrda already suggested in some form. Kinda looks like this:

  • Custom Script: if udg_<timervar>[GetUnitUserData(<unit>)] == null then
  • Custom Script: set udg_<timervar>[GetUnitUserData(<unit>)] = CreateTimer()
  • Custom Script: endif
  • Comment: --------- Do your stuff here ----------
 
Level 6
Joined
Jul 12, 2021
Messages
95
Trying to set the array size of a timer variable in GUI actually preloads the same amount of timers in the initialization phase. Aside from going out of bounds with the array index, creating 32768 timers is bound to cause some problems with initialization, due to the op limit which limits the amount of operations a single thread can perform in JASS.



Creating this much timer handles is bound to make the initializer thread reach the op limit and prevent some possibly crucial triggers from initializing. In other words, if a single trigger initializing is the equivalent of holding a pebble, then creating about 32767 timers is roughly equivalent to holding a boulder. If the maximum amount of pebbles you can carry is about 100000, then a boulder is bound to take up much of that, heavily reducing the amount of pebbles you can hold. Carry enough boulders, and some pebbles which are absolutely crucial cannot be held.

As a workaround, you'll have to create the timer at the moment when you need to use it, which Wrda already suggested in some form. Kinda looks like this:
Well, apparently I was wrong, it might be a problem with initialization.


  • Custom Script: if udg_<timervar>[GetUnitUserData(<unit>)] == null then
  • Custom Script: set udg_<timervar>[GetUnitUserData(<unit>)] = CreateTimer()
  • Custom Script: endif
  • Comment: --------- Do your stuff here ----------

Thank you for sharing those custom scripts, now I can create my triggers using timer variables of array size 1! Problem solved.


You are doing something stupid
I disagree because the thread was enriched thanks to the insight of others. Personally, I learned more.
 
Last edited:
Status
Not open for further replies.
Top