AddSpecialEffectTarget() and Invisibility

Status
Not open for further replies.
It will leak. They have their own functions for destroying them. I think it's negligible, but it's a bad practice.
You must store the effect and destroy after use.

Ok, and one last thing, promise. We know that unit Id's are represented by 4 chars strings like 'e003' but they are integers resulted from a string hash, i presume, from that string. So lets say that 'e003' = 10000, if i do a loop from 'e003' to lets say 'e007', incrementing by 1 each step, the results will be 'e003', 'e004', 'e005', 'e006' and 'e007'?
 
For looping through object ids, BJObjectId or NextPrevObjectId will come in handy. Do note that going from 'e003' to 'e007' will not necessarily be the same as incrementing 10000 by 1 to 10004. Gaps may appear in between, where an integer id is not equal to any 4 char code within the range provided. How increment for object ids actually works is explained in Easiest way to preload objects.
 
Last edited:
For looping through object ids, BJObjectId or NextPrevObjectId will come in handy. Do note that going from 'e003' to 'e007' will not necessarily be the same as incrementing 10000 by 1 to 10004. Gaps may appear in between, where an integer id is not equal to any 4 char code within the range provided. How increment for object ids actually works is explained in Easiest way to preload objects.

I did a loop that is incremented by 1 and it actually works like i described.

JASS:
set i = 'e003'
loop
    exitwhen i > 'e007'
        call UnitApplyTimedLife(CreateUnit(neutral, i, x + GetRandomInt(0, 75), y + GetRandomInt(0, 75), 0), 'BTLF', 20)
    set i = i + 1
endloop

'e003' to 'e007' are units in my editor and it correctly creates them.
 
We know that unit Id's are represented by 4 chars strings like 'e003' but they are integers resulted from a string hash, i presume, from that string.
Just wanted to point out that fourcc IDs are not hashed. A hash function maps arbitrary-sized data to fixed-size, but the fourcc ID is already fixed-size, since it needs to be exactly 4 characters long. Instead, the ID is converted to an integer by taking the numerical value of each character with a radix of 256, so it's similar to hexadecimal numbers.
 
Status
Not open for further replies.
Back
Top