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

Integer A Array Location Leak

Status
Not open for further replies.
Level 12
Joined
Jun 28, 2008
Messages
688
Alright, so I know how to remove location leaks, I know how to remove array location leaks. But what if the array used was [Integer A]?

  • Sparkfield Per
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set sprk_point = (sprk_point offset by 24.56 towards (Facing of sprk_caster) degrees)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set sprk_radius[(Integer A)] = (sprk_point offset by 87.50 towards (36.00 x (Real((Integer A)))) degrees)
          • Special Effect - Create a special effect at sprk_radius[(Integer A)] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_sprk_radius[???])
The part I need to know is the "???" in the brackets. What do I put there to remove each location after it has been produced before the next is produced?

Also, would it work if I did something like this:

  • Sparkfield Per
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set sprk_point = (sprk_point offset by 24.56 towards (Facing of sprk_caster) degrees)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set sprk_radius[(Integer A)] = (sprk_point offset by 87.50 towards (36.00 x (Real((Integer A)))) degrees)
          • Special Effect - Create a special effect at sprk_radius[(Integer A)] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_sprk_radius[1])
      • Custom script: call RemoveLocation(udg_sprk_radius[2])
      • Custom script: call RemoveLocation(udg_sprk_radius[3])
      • Custom script: call RemoveLocation(udg_sprk_radius[4])
      • Custom script: call RemoveLocation(udg_sprk_radius[5])
      • Custom script: call RemoveLocation(udg_sprk_radius[6])
      • Custom script: call RemoveLocation(udg_sprk_radius[7])
      • Custom script: call RemoveLocation(udg_sprk_radius[8])
      • Custom script: call RemoveLocation(udg_sprk_radius[9])
      • Custom script: call RemoveLocation(udg_sprk_radius[10])
More work, but it makes sense, right? Or does this not work?

Any and all help will be greatly appreciated.
 
Level 3
Joined
Sep 11, 2004
Messages
63
IntegerA is just a bj_something global integer, can't recall its name atm, but generally it's a bad idea to use a global integer as index, because the value is unpredictable when its used by multiple triggers or different instance of spell trigger.
 
Level 3
Joined
Dec 6, 2005
Messages
67
IntegerA is just a bj_something global integer, can't recall its name atm, but generally it's a bad idea to use a global integer as index, because the value is unpredictable when its used by multiple triggers or different instance of spell trigger.
Seconded, for a little project I took Wintermaul Solo v4.0 and redid the triggers intelligently lol, using for loops and what not instead of lots of copy and paste... well i had multiple for Integer A's and it cause some WIERD effects due to the variable being accessed in different triggers at the same time, in the end i made an integer array for_loop_counter and used a different array value for each counter
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Seconded, for a little project I took Wintermaul Solo v4.0 and redid the triggers intelligently lol, using for loops and what not instead of lots of copy and paste... well i had multiple for Integer A's and it cause some WIERD effects due to the variable being accessed in different triggers at the same time, in the end i made an integer array for_loop_counter and used a different array value for each counter

It's easier to use a Jass loop.

  • Custom script: local integer udg_iterator = 0// at the start of the trigger, also abusing the global-local bug so you'd be able to reference it in GUI without any problems
  • ...
  • Custom script: loop
  • Custom script: exitwhen iterator == YourLoopCount
  • - All your actions go here -
  • Custom script: set iterator = iterator + 1
  • Custom script: endloop
 
Level 12
Joined
Jun 28, 2008
Messages
688
IntegerA is just a bj_something global integer, can't recall its name atm, but generally it's a bad idea to use a global integer as index, because the value is unpredictable when its used by multiple triggers or different instance of spell trigger.

The spell I am making doesn't need to be MUI as there will only be one instance of the hero/spell at any given moment. Thank you both for your input, though.

Thanks Paladon, that's what I was looking for. I think Dr Super Good told me that a long time ago but I totally forgot what it was and I couldn't find the thread anywhere on this site, probably because it was solved.
 
Level 6
Joined
Jan 27, 2007
Messages
208
This works(?)

  • Custom script: call RemoveLocation(udg_YourVariable[GetForLoopIndexA()])
I convert my trigger to JASS and see that Integer A become this GetForLoopIndexA(), and after that, i got no error when i save my map.
 
Status
Not open for further replies.
Top