• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

active % of hp regen buff

Status
Not open for further replies.
Level 3
Joined
Oct 31, 2014
Messages
55
i want to make an active buff that regenerates life percentage of the hero per second.
also how do i make channelable skills, to make them not channelable
example: DOTA Pit Lord - Fire Rain or something like Enigma - Death and Decay
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
I actually made that ability today for my map XD

When it is being cast, the caster regenerates 40% of his max hp over 16 seconds.

Just make an ability based of Orc - Berserk and change the art of it.
Then go to the trigger editor and make a new trigger.
I have a custom hp regen system and therefor I don't need a large amount of code.

Event - Unit starts the effect of an abiliy
Condition - Ability being cast equal to REGAIN_HEALTH_ABILITY
Actions - Add casting unit to group REGAIN_HEALTH_GROUP
Wait 16 seconds.
remove casting unit from REGAIN_HEALTH_GROUP

Other trigger:

Event - Every ... seconds of game time.
Actions - Pick every unit in unit group REGAIN_HEALTH_GROUP and do actions:
Set life of picked unit to (life of picked unit + (% X maxlife of picked unit))

I also made it in jass so I have no problem with wait + casting unit.
(suggest you to do the same)

For the other abilities, let the real ability be cast by a dummy unit ;)
 
Level 3
Joined
Oct 31, 2014
Messages
55
can you post the triggers?, i have a hard time even finding the right actions :p.
also i dont have any JASS knowledge :/.
for the channeling abilities i already thought about creating a dummy but i cant manage to make it work (you have a real noob right here :p)
so plz post the triggers
 
Level 3
Joined
Oct 31, 2014
Messages
55
thank you for your time :D!, also how do i set the amount of healing that i want
i want 30/40/50/60 % regen in 12 seconds :p
oh nvm i believe i already discover how this works
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Replace Trig_Heal_Actions with this:
JASS:
function Trig_Heal_Actions takes nothing returns nothing
    local unit u = GetSpellAbilityUnit()
    local integer i = GetUnitAbilityLevel(u, 'A000')
    local integer Loop = 1
    local integer TotalDurationInSeconds = 12 //Change in whatever you want
    local real baseStat = 0.2                        //Change in whatever you want
    local real incrementStat = 0.1                 //Change in whatever you want
    
    loop
        exitwhen (Loop > TotalDurationInSeconds)
        call SetUnitLifeBJ(u, GetUnitState(u, UNIT_STATE_LIFE) + (baseStat + (incrementStat*i)) * GetUnitState(u, UNIT_STATE_MAX_LIFE) / I2R(TotalDurationInSeconds))
        call PolledWait(1)
        set Loop = Loop + 1
    endloop
    call UnitRemoveBuffBJ('B000', u)
endfunction

That code is a little bit better.
The biggest difference is that you can actually set the ability effect in the local variables (in the top) and so you don't have to change the real code.
Another thing is that the buff is automatically removed from the unit. You can set the duration of that ability in the Object Editor to a high value, because when the effect is gone, the buff is removed too. (You can set the duration to 0.00 (infinite).)

The amount of health regenerated is this:
TotalRegeneratedHealth = BaseStat + (IncrementStat * LevelOfAbility) as percentage of maximum health.

When you cop and paste this into your map.
Change the following things:
call UnitRemoveBuffBJ('B000', u) - The 'B000' is an identical number that represents a unit, destructible, doodad, item, ability, buff or upgrade.
Change that code to the code of your heal buff
return GetSpellAbilityId() == 'A000' - Same but this is the Heal Ability.
 
Status
Not open for further replies.
Top