emootootoo
Top Banana
- Reaction score
- 51
edited:
alright i've updated it so now it only requires the actual stats to be saves and nothing else
but still, i'm getting 40 character codes when i save 5 items with 4 random stats each
is there any way to further shorten the code? is there some way to compress all the stat values so they don't take up as many characters?
at the moment it pushes a value between 0 and 2^7 (the variation of the random stat) for every random stat on your items
so if you have 5 items with 4 random stats each, that will mean 20 2^7 values saved
i put no more than 6 random stats on an item with this code
alright i've updated it so now it only requires the actual stats to be saves and nothing else
but still, i'm getting 40 character codes when i save 5 items with 4 random stats each
is there any way to further shorten the code? is there some way to compress all the stat values so they don't take up as many characters?
at the moment it pushes a value between 0 and 2^7 (the variation of the random stat) for every random stat on your items
so if you have 5 items with 4 random stats each, that will mean 20 2^7 values saved
JASS:
//Save random stats
set i = 0
loop
exitwhen i >= 6
set ri = 0
set m = UnitItemInSlot(u,i)
call ItemVariationToArray(m)
if m != null then
loop
exitwhen ri >= 21
if ItemVariation[ri] > 0 then
call push_progressive_int(ItemVariation[ri],2,7)
endif
set ri = ri + 1
endloop
endif
set i = i + 1
endloop
JASS:
//Load random stats
set i = item_count-1
loop
exitwhen i < 0
call ClearItemVariationArray()
set tempInt = FindRItem(GetItemTypeId(items<i>))
set ranCount = 6
if tempInt != -1 then
loop
exitwhen ranCount < 1
if ItemIndexes[tempInt][ranCount] != 0 then
set ItemVariation[ItemIndexes[tempInt][ranCount]] = pop_progressive_int(2,7)
endif
set ranCount = ranCount - 1
endloop
call ArrayToItemVariation(items<i>)
endif
set i = i - 1
endloop</i></i>
i put no more than 6 random stats on an item with this code