Spell doesn't work, maybe bad base-skill?

Lehona

New Member
Reaction score
12
I got this two triggers in my (test-)map, but the spell, which should save the target untouched and transfer all damage to the caster, doesn't work.
JASS:
scope HGB4 initializer HGBe4

globals
private constant integer ID = 'HoGu'
public real HP = 0.0
endglobals

private function Cons takes nothing returns boolean
return (GetSpellAbilityId() == ID)
endfunction

private function HoGuBe4 takes nothing returns nothing HolyGuardBe4
    local unit u
    loop
        exitwhen UnitHasBuffBJ(u, MyScope_BC)
        set u = GroupPickRandomUnit (GetUnitsInRectAll(GetPlayableMapRect()))
    endloop
    set HP = GetUnitState (u, UNIT_STATE_LIFE)
endfunction
        
private function HGBe4 takes nothing returns nothing
local trigger t = CreateTrigger()
local unit u
loop
exitwhen GetUnitAbilityLevel(u, ID) > 0
set u = GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect()))
if GetUnitAbilityLevel(u, ID) > 0 then 
call TriggerRegisterUnitEvent (t, u, EVENT_UNIT_SPELL_CAST)
endif
endloop
call TriggerAddAction (t, function HoGuBe4)
call TriggerAddCondition (t, Filter(function Cons))
endfunction

endscope


scope MyScope initializer HG
globals
public constant integer BC = 'X001'
endglobals

private function Cons takes nothing returns boolean
    return (UnitHasBuffBJ(GetTriggerUnit(), BC))
endfunction

private function HolyGuard takes nothing returns nothing
    local unit u
    local real r = GetUnitState(u, UNIT_STATE_LIFE)
    local real r2 = GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE)
    local real HPT = HGB4_HP
    loop
        exitwhen GetUnitAbilityLevel(u, 'HoGu') > 0
        set u = GroupPickRandomUnit (GetUnitsInRectAll(GetPlayableMapRect()))
    endloop
    
    set r2 = HGB4_HP - r2
    set r = r - r2
    call SetUnitState (u, UNIT_STATE_LIFE, r)    
    call SetUnitState (GetTriggerUnit(), UNIT_STATE_LIFE, HGB4_HP)
endfunction

private function HG takes nothing returns nothing
    local trigger t = CreateTrigger()
    local unit u
    loop                                         
    exitwhen  UnitHasBuffBJ(u, BC)
    set u = GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect()))
    if UnitHasBuffBJ(u, BC) then 
    call TriggerRegisterUnitEvent (t,u, EVENT_UNIT_DAMAGED)
    endif
    endloop
    call TriggerAddAction (t, function HolyGuard)
    call TriggerAddCondition(t, Filter(function Cons))
endfunction
endscope


JASS:
scope MyScope initializer HG
globals
public constant integer BC = 'X001'
endglobals

private function Cons takes nothing returns boolean
    return (UnitHasBuffBJ(GetTriggerUnit(), BC))
endfunction

private function HolyGuard takes nothing returns nothing
    local unit u
    local real r = GetUnitState(u, UNIT_STATE_LIFE)
    local real r2 = GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE)
    local real HPT = HGB4_HP
    loop
        exitwhen GetUnitAbilityLevel(u, 'HoGu') > 0
        set u = GroupPickRandomUnit (GetUnitsInRectAll(GetPlayableMapRect()))
    endloop
    
    set r2 = HGB4_HP - r2
    set r = r - r2
    call SetUnitState (u, UNIT_STATE_LIFE, r)    
    call SetUnitState (GetTriggerUnit(), UNIT_STATE_LIFE, HGB4_HP)
endfunction

private function HG takes nothing returns nothing
    local trigger t = CreateTrigger()
    local unit u
    loop                                         
    exitwhen  UnitHasBuffBJ(u, BC)
    set u = GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect()))
    if UnitHasBuffBJ(u, BC) then 
    call TriggerRegisterUnitEvent (t,u, EVENT_UNIT_DAMAGED)
    endif
    endloop
    call TriggerAddAction (t, function HolyGuard)
    call TriggerAddCondition(t, Filter(function Cons))
endfunction
endscope


The spell is actually based on Holy Light (I didn't found any good baseskill, because I play just DotA, not any melee maps) and gives the target a buff, which is based on anti-magicshield (magic immun!).
 
I would love to help but you posted this in the wrong section here you will receive help for most but not all things, there is a specific forum for JASS Help so if you are new please read the rules first before posting im getting really sick of seeing JASS HELP in this forum
 
Okay, thaugt that here I can also get help for questions about base skills.
Can maybe a moderator fix my bad?^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top