• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Indexing Clarification. Need some help.

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
Hi all, i am confuse about indexing.
It uses an array with size of 1.

Lets say i use the below array as an example
a[x]

But if its size of 1, how is it able to store if x is more than 0? I thought the number of x means the current index of the array size. if x = 5 then the array size should be 6 assuming i start from 0. Am i wrong?

Please help me. Because i really don't get how indexing works. I really want to know it because it is alot more efficient than hashtables. I remember theres a tutorial somewhere, i just can't find it anymore.
 
That what you call "size" in GUI is merely a number up to what index the array gets initialized to.

When you're having an integer variable with size 49, the Editor automatically does this:

JASS:
function InitGlobals takes nothing returns nothing
    local integer i= 0
    set i=0
    loop
        exitwhen ( i > 49 )
        set udg_i[i]=0
        set i=i + 1
    endloop

endfunction
 
Interesting. I think i can start trying it out. Thanks! +rep

EDIT:
A few more questions.

1. Why do people that uses index for MUI have a trigger on the top thats looks like:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • someIntegerB Equal to 0
    • Then - Actions
      • Trigger - Turn on Some Loop Trigger <gen>
    • Else - Actions
and in the loop trigger.
There is an If condition that says
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • someIntegerB Equal to 0
    • Then - Actions
      • someIntegerA = 0
      • Trigger - Turn off This Trigger <gen>
    • Else - Actions
2. Wouldn't it turn off right away after turning on?

3. Why do i need to turn it on right at the start? What is the main purpose?

4. Indexing isn't really "MUI" right? assuming if i have 8193 unit casting the same spell at the same time which is over the index limit. Ya i know that number is almost impossible. But just want to clear up myself understanding this.
 
Last edited:
1. because you check the number of active instances and if there are none you have to turn on the trigger

2. it checks when you -1 the number of instances when the spell finish, if the instances reach 0 it will turn of the max instance which is used for the loop

3. not having a trigger running all the time

4. nope it isnt totally MUI as the limit is 8191 casts but if you have a recycle system it will find spots better

and also

who wants to cast 8191 instances at once ...

hope you got it clear :)
 
Status
Not open for further replies.
Back
Top