Spell Trigger Troubles

Heresme

Member
Reaction score
4
I think I made an error in my triggers... If something looks stupid, mention it and I'll tell you whether or not it's intentional.

The spell:
Healing Strike
Heals allies when attacked for 30 life each spell level, minus the users attack.

Variable:
Clubhealed
True/False

Learning the spell
Code:
Healing Strike On
Event
Ogre Clubhealer 0034 learns a skill
Conditions
(Learned Hero Skill) Equal to Healing Strike
Events
Turn on Healing Strike Effect
Set Clubhealed = True
Turn off (this trigger)

Code:
Healing Stike Effect
Event
Berserker 0032 takes damage
Conditions
(Attacking Unit) equal to Ogre Clubhealer 0034
Clubhealed = True
Events
Set life of (triggering unit) to ((Life of (triggering unit)) + 30)

Yes I am using those specific units. Does that look right? Any help appreciated. Thanks in advance.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
scope Healing Strike

globals
     private integer HealingStrikeId = 'A000' (Replace this your healing strike Id)
     private real HealHP = 30.
     private real AoE = 300. (Healing Area)
endglobals 

private function Cond takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(),HealingStrikeId)>0
endfunction

private function Act takes nothing returns nothing
     local unit u = GetAttacker()
     local group g = CreateGroup()
     local unit temp
     local real TotalHeal = HealHP * GetUnitAbilityLevel(u,HealingStrikeId)
     call GroupEnumUnitInRange(g,GetUnitX(u),GetUnitY(u),AoE,null)
     loop
        set temp = FirstOfGroup(g)
     exitwhen temp == null
        if IsUnitAlly(temp,GetOwningPlayer(u)) == true then
           call SetUnitState(u,UNIT_STATE_LIFE),TotalHeal+GetUnitState(u,UNIT_STATE_LIFE))
         endif
        call GroupRemoveUnit(g,u)
     endloop
     call GroupClear(g)
     call DestroyGroup(g)
     set u = null
     set g = null
     set temp = null
     endloop

function InitTrig_HealingStrike takes nothing returns nothing
     local trigger t = CreateTrigger()
     call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
     call TriggerAddCondition(t,Condition(function Cond))
     call TriggerAddAction(t,function Act)
     set t = null
endfunction

endscope


Create a trigger named "HealingStrike" and paste it into. Setup the globals to implement. Needs JassNewGenPack 1.5b to implement. Hope I can help you.
 

Heresme

Member
Reaction score
4
Thanks for the help. I'm not too keen on learning Jass for a hobby so it's really appreciated.
 

Heresme

Member
Reaction score
4
Hey uh, hate to sound like an idiot, but where do I find my spells ID?

Edit: Only to actually read the Jass page and find out it doesn't work with the latest version... And then to read it doesn't effect me...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top