Nestharus
o-o
- Reaction score
- 84
JASS:
//Requires
// NumberStack hiveworkshop.com/forums/1993458-post521.html
// GetMapMaxHeroLevel hiveworkshop.com/forums/1994245-post536.html
// SetHeroLevelX hiveworkshop.com/forums/1994340-post545.html
// UnitStatePercent hiveworkshop.com/forums/jass-functions-413/snippet-unit-state-percent-189943/
//saves hero level and hero xp
library SaveXP uses NumberStack, GetMapMaxHeroLevel, SetHeroLevelX, UnitStatePercent
function SaveHeroXP takes NumberStack stack, unit whichUnit returns nothing
if (GetHeroLevel(whichUnit)!=GetMapMaxHeroLevel()) then
call stack.push(GetPercentHeroXP(whichUnit),99)
endif
call stack.push(GetHeroLevel(whichUnit)-1,GetMapMaxHeroLevel()-1)
endfunction
function LoadHeroXP takes NumberStack stack, unit whichUnit returns nothing
call SetHeroLevelX(whichUnit,stack.pop(GetMapMaxHeroLevel()-1)+1)
if (GetHeroLevel(whichUnit)!=GetMapMaxHeroLevel()) then
call AddPercentHeroXP(whichUnit,stack.pop(99))
endif
endfunction
endlibrary
JASS:
//Requires
// NumberStack hiveworkshop.com/forums/1993458-post521.html
// GetMapMaxHeroLevel hiveworkshop.com/forums/1994245-post536.html
// SetHeroLevelX hiveworkshop.com/forums/1994340-post545.html
// UnitStatePercent hiveworkshop.com/forums/jass-functions-413/snippet-unit-state-percent-189943/
//saves hero level and hero xp
library SaveXPBuffer uses NumberStack, GetMapMaxHeroLevel, SetHeroLevelX, UnitStatePercent, Buffer
//function SaveHeroXP takes NumberStack stack, unit whichUnit returns nothing
//function LoadHeroXPToBuffer takes NumberStack stack, unit whichUnit returns nothing
//function LoadHeroXPFromBuffer takes unit whichUnit returns nothing
function LoadHeroXPToBuffer takes NumberStack stack, unit whichUnit returns nothing
call Buffer.write(stack.pop(GetMapMaxHeroLevel()-1)+1)
if (GetHeroLevel(whichUnit)!=GetMapMaxHeroLevel()) then
call Buffer.write(stack.pop(99))
endif
endfunction
function LoadHeroXPFromBuffer takes unit whichUnit returns nothing
call SetHeroLevelX(whichUnit,Buffer.read())
if (GetHeroLevel(whichUnit)!=GetMapMaxHeroLevel()) then
call AddPercentHeroXP(whichUnit,Buffer.read())
endif
endfunction
endlibrary