HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

WEU: ChangeLife function - help! pitzermike!

12-29-2007, 10:18 PM#1
El-Sevio
The change maximum life function in World Editor Unlimited has been great!

However the maximum health I am able to add is 4095 at one time

I have read the coding and understand that this is because it is adding abilities which change health (bit values 1, 2, 4, 8, 16, 32 up to the 11th spell of 2048) and starts a loop that begins at the 11th spell and descends through the rest others untill all the health has been added.)

Thus the maximum health increase is 2048+1028+... +1 = 4095


I see the function appears to do something to rectify this by returning a false boolean value for the function if the amount is above 4095, but thats as far as it goes I think




So I tried to edit the coding to loop the function that adds the abilities untill the increase amount is less than 4095:

function ChangeLife takes unit U, boolean Increase, integer Zahl returns nothing
local integer i = 1
if not Increase then
set Zahl = 0 - Zahl
endif
loop
exitwhen (Zahl > 4095)
set Zahl = (Zahl - (GetBonus(U, 2)))
call AddBonus(Zahl,U,2)
endloop
endfunction


WE syntax checker unleashes a large amount of errors on me that dont seem to be relevant

But the syntax thing in JassNewgen says "set Zahl = (Zahl - (GetBonus(U, 2)))" is bad types for the binary operator


So what am i be doing wrong??!
12-31-2007, 08:42 AM#2
Pyrogasm
You understand rudimentary JASS, I take it... so this would be a much better solution to changing the life of a unit (it has no limit): Blade.dk's SetUnitMaxState System