HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

keeping mana at 100

05-14-2009, 10:11 AM#1
311
I have a druid hero in my map and he has 2 forms cat and bear. In caster form he uses mana to cast all his spells, but in bear form he uses rage(100 max)(But it uses the mana) and catform which uses energy(100max)

Now I can set the units mana to 100, however when I gain intellect I have more then 100mana now, which messes things up. I tried the +Stats thing and did -99intellect but then I have 0mana and even - so I cant do anything so that didnt work, then I tried a trigger to -(amount of int I have at the time of spell cast) but If I gain any int items while in cat form they will still give me more then 100mana

Only thing I got working so far is keeping the amount of current mana on my hero, so if I have 820mana then go bear form, then back to human I will have 820 again
05-14-2009, 10:57 PM#2
311
anyway to do this or do I need to just make a multiboard or some junk with the rage/energy because I don't want to do that and probably just will delete him then
05-14-2009, 11:49 PM#3
Tossrock
I'd recommend bonus mod

If you want something lighter, you could use a version of this:

Collapse JASS:
function SetUnitMaxMana takes unit whichUnit, integer newVal returns boolean
    local integer c = newVal-R2I(GetUnitState(whichUnit, UNIT_STATE_MAX_MANA))
    local integer i = 'A00G' // Change this to your max mana modifying ability
    if i == 0 then
        return false
    endif
    if c > 0 then
        loop
            exitwhen c == 0
            call UnitAddAbility(whichUnit, i)
            if c >= 100 then
                set c = c - 100
                call SetUnitAbilityLevel(whichUnit, i, 4)
            elseif c >= 10 then
                set c = c - 10
                call SetUnitAbilityLevel(whichUnit, i, 3)
            else
                set c = c - 1
                call SetUnitAbilityLevel(whichUnit, i, 2)
            endif
            call UnitRemoveAbility(whichUnit, i)
        endloop
    elseif c < 0 then
        set c = -c
        loop
            exitwhen c == 0
            call UnitAddAbility(whichUnit, i)
            if c >= 100 then
                set c = c - 100
                call SetUnitAbilityLevel(whichUnit, i, 7)
            elseif c >= 10 then
                set c = c - 10
                call SetUnitAbilityLevel(whichUnit, i, 6)
            else
                set c = c - 1
                call SetUnitAbilityLevel(whichUnit, i, 5)
            endif
            call UnitRemoveAbility(whichUnit, i)
        endloop
    endif
    return true
endfunction

You'll need a max mana modifying ability with 7 levels, that goes { 0 , -1, -10, -100, 1, 10, 100 }

edit: dusk posted while I was editing in the SetMax info, sigh
05-14-2009, 11:50 PM#4
Rising_Dusk
No, quite easily you can set the max mana of a unit to always be 100. I use this in my maps to modify max mana. What you should do is everytime the hero levels up or obtains an item, call SetUnitMaxState(MyDruidHero, UNIT_STATE_MAX_MANA, 100) and it'll work happily.

Don't delete him now! :)
05-15-2009, 05:47 AM#5
311
that didnt seem to work either :(
05-15-2009, 05:49 AM#6
Rising_Dusk
Did you copy the abilities from the testmap to your map? Those are kind of important.
05-15-2009, 06:49 AM#7
311
ya copied both abilities, and changed the raw code of course. set the unit to mine, copied the custom text, and put the trigger that you said