• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Permanent Mana Increase {with a tome item}

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2005
Messages
119
Uhh, this is such a simple question, I thought there was an item for it, but then I realised there wasn't. The I thought I could use a trigger, but I couldn't!

So yeah, I need an item to give +50 permanent mana to the user.
Is there a JASS way of doing it, to get/add mana to the unit (permanent total only)

Thanks in advance,
Gloomfrost
 
Level 5
Joined
Sep 21, 2005
Messages
119
Thanks guys, I'll try it out! :) Forgot you can just add those hidden abilities. Doesn't quite work the same way as a tome though, as I think their mana remaining doesn't increase as their cap does with those bonuses, but w/e, good enough.

Thanks again!
Gloom

P.S Unless someone else has something to add about a diff add, you can mark this as solved.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Uhm, okay wait so I tried it..

@azn;

i need it to work like a tome.. just adding the ability DOES give them the 50 mana bonus or w/e, but if they use it again, it won't add 50 more.

@Supergood;

Seriously? How many levels should I make.. like 100? If it's a tome-type ability, it would be nice to have it be done permanently.

~Gloom
 
Level 5
Joined
Sep 21, 2005
Messages
119
That looks like a lot of code and hassle for something simple :s

I read it over, it makes sense and all, but something that's based on a bug in the game may be fixed in the future, and I don't want to copy all the variables and libraries over...
 
Level 5
Joined
Sep 21, 2005
Messages
119
I know but I need it to be a usable tome, not auto-acquired.. like they click it, and it gives them +50 mana..

And I need the item to be consumed.

btw I looked more over that VJass script then, it actually lags a little in the way it works, I may end up using it, I just took the map from wc3campaigns though, it was a bit simpler to understand... so thanks for that. +rep.

I think I got it from here now for sure. Thanks,
~Gloom

EDIT: Okay so I did get it after some modifications to the script etc...
I'll just paste my triggers just for anyone looking for this can find it easier. (Note; this is the most efficient way for anything added LESS THAN 100 mana (mine was +50), anyone who wants to add more than that will have to re-do the script a little.)

Code:
constant function MaxStateModifierId takes unitstate u returns integer
    if u == UNIT_STATE_MAX_MANA then
        return 'A02S' // Rawcode of the Max Mana Modifier ability.
    endif
    return 0
endfunction

function SetUnitMaxState takes unit whichUnit, unitstate whichUnitState, integer newVal returns boolean
    local integer c = newVal-R2I(GetUnitState(whichUnit, whichUnitState))
    local integer i = MaxStateModifierId(whichUnitState)
    if i == 0 then
        return false
    endif
    if c > 0 then
        loop
            exitwhen c == 0
            call UnitAddAbility(whichUnit, i)
            if 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
    endif
    return true
endfunction

and then a trigger doing this:
-------
Event - Unit uses an item
Cond - Item type of Item being manipulated = your item.
Events -
set i = Integer((Max mana of (Hero manipulating item) + 50)
Custom script: call SetUnitMaxState(GetManipulatingUnit(), UNIT_STATE_MAX_MANA, udg_i)
-------

The modifier ability for me looks just like any Item Mana Bonus (+50) or w/e, with 3 levels, level 1: 0 Level2: -1, Level3: -10
The negatives are needed (get them by SHIFT-Clicking the data value and typing them in)

Goodluck to everyone in the future.
~Gloom
 
Last edited:
Status
Not open for further replies.
Top