Integer A Custom Script

Level 18
Joined
May 11, 2012
Messages
2,103
I want to know is it possible to clear point leaks like this(I very hope it is)?

here's the trigg:
  • Custom script: call RemoveLocation(udg_StormHammer_UnitsPoints[(Integer A)])
because it gives me an error when it is like this

  • Storm Hammer 2
    • Events
      • Time - StormHammer_Timer expires
    • Conditions
    • Actions
      • Set StormHammer_Integer = 90
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set StormHammer_Integer = (StormHammer_Integer + 45)
          • Set StormHammer_UnitsPoints[(Integer A)] = ((Position of StormHammer_TargetUnit) offset by 0.00 towards (Real(StormHammer_Integer)) degrees)
          • Unit - Create 1 Dummy Storm Bolt Stunner for (Owner of StormHammer_TrigUnit) at StormHammer_UnitsPoints[(Integer A)] facing (90.00 x (Real((Integer A)))) degrees
          • Unit - Turn collision for StormHammer_Units[(Integer A)] Off
          • Set StormHammer_Units[(Integer A)] = (Last created unit)
          • Unit - Add Dummy Storm Bolt (Arced Hammers) to (Last created unit)
          • Unit - Set level of Dummy Storm Bolt (Arced Hammers) for (Last created unit) to (Level of Storm Hammer for StormHammer_TrigUnit)
          • Unit - Add a 1.00 second Generic expiration timer to StormHammer_Units[(Integer A)]
          • Custom script: call RemoveLocation(udg_StormHammer_UnitsPoints[(Integer A)])
      • Set StormHammer_Integer = 90
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set StormHammer_Integer = (StormHammer_Integer + 45)
          • Set StormHammer_EnemyUnitsPoints[(Integer A)] = ((Position of StormHammer_TargetUnit) offset by 450.00 towards (Real(StormHammer_Integer)) degrees)
          • Unit - Create 1 Dummy Storm Bolt Enemy for Player 12 (Brown) at StormHammer_EnemyUnitsPoints[(Integer A)] facing (Facing of StormHammer_Units[(Integer A)]) degrees
          • Unit - Turn collision for StormHammer_EnemyUnits[(Integer A)] Off
          • Set StormHammer_EnemyUnits[(Integer A)] = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to StormHammer_EnemyUnits[(Integer A)]
          • Custom script: call RemoveLocation(udg_StormHammer_EnemyUnitsPoints[(Integer A)])
      • Set StormHammer_Integer = 0
      • -------- --------------------- --------------------- Second Shit --------------------- --------------------- --------
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Unit - Order StormHammer_Units[(Integer A)] to Human Mountain King - Storm Bolt StormHammer_EnemyUnits[(Integer A)]
      • Wait 0.90 seconds
      • Set StormHammer_Integer = 90
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set StormHammer_Integer = (StormHammer_Integer + 45)
          • Set StormHammer_UnitsPoints[(Integer A)] = ((Position of StormHammer_TargetUnit) offset by 0.00 towards (Real(StormHammer_Integer)) degrees)
          • Unit - Create 1 Dummy Storm Bolt Stunner for (Owner of StormHammer_TrigUnit) at StormHammer_UnitsPoints[(Integer A)] facing (90.00 x (Real((Integer A)))) degrees
          • Set StormHammer_Units[(Integer A)] = (Last created unit)
          • Unit - Add Dummy Storm Bolt (Storm Hammer) to (Last created unit)
          • Unit - Set level of Dummy Storm Bolt (Storm Hammer) for (Last created unit) to (Level of Storm Hammer for StormHammer_TrigUnit)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Add a 1.00 second Generic expiration timer to StormHammer_Units[(Integer A)]
      • Set StormHammer_Integer = 0
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
In many cases, please use Custom Variable, please.
If you're making a game and uses many Integer A/B Variable, there would be a collision between them if used at the same time, hey, Prevention is better than Cure.

That depends on the trigger itself and since WC3 is a single thread, instant actions will be fine unless a wait is used but other than that you are correct; a custom made variable are better.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Im sorry but I have to agree with Starquizer that unless a wait inside a loop, that global will not bug coz it's instant
cast and there's no such thing about running at the same time, else, the spell's section will be full of bugs since many
GUI spells uses the global lastcreatedUnit/effect. etc...

Plus most of my jass spells has bj_lastCreatedGroup but there's no way it will bug if the group is not saved for latter use...

But anyway, creating a unique global for an index is better as said above...
 
Have you experienced it? coz I personally experienced it dude when I was working with an old map of mine... no waits only two successive integer B loops, and it failed... take note successive, not nested... when I changed it to custom integer, it worked without problems... and basing from some threads, some other people also seems to have at least experienced it once...
 
Level 11
Joined
Jul 11, 2010
Messages
422
I guess you were using an action that fires another event.

Example :
  • Trigger1
    • Events
      • Unit - A unit casts an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6 do
        • Game - Display (string(Integer A)) to (All players)
        • Item - Create a Blades of Attack at Position(0, 0)
        • Unit - Add (last created item) to (triggering unit)
  • Trigger2
    • Events
      • Unit - A unit acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 10 to 12 do
        • Game - Display (string(Integer A)) to (All players)
The output would be something like :
1
10
11
12

That's because GUI uses a global variable for its loops. I would impute that bug to GUI instead of Integer A/B.
 
Top