Undeclared Function H2I

Status
Not open for further replies.
Level 15
Joined
Jul 19, 2007
Messages
855
Can someone tell me why this error is happening for me? I'm trying to import "Strygwyr's Thirst" ability from this spellpack Strygwyr's Thirst Spellpack and I have imported all functions required for it but it still gives me this error. What can I do to solve it?
uf.png
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Again, this is very outdated stuff that is bound to have issues on recent versions. That being said, this may work:
vJASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope StrygwyrsThirst initializer Init

globals
    private constant integer AbilId = 'A00C'
    private constant integer DumAbilId = 'S001'
    private constant integer BuffId = 'B005'
   
    private group G = null
    private unit U
    private boolexpr B
    private boolean Bool
   
    private unit array Dum
endglobals

private function Filt takes nothing returns boolean
    local unit u = U
    local unit t = GetFilterUnit()
    local real dist
    local integer id
   
    if IsUnitType(t,UNIT_TYPE_HERO)==true and IsUnitEnemy(t,GetOwningPlayer(u)) then
        if GetWidgetLife(t)/GetUnitState(t,ConvertUnitState(1))>.4 or GetWidgetLife(t)<.405 then
            call UnitShareVision(t,GetOwningPlayer(u),false)
            return false
        endif
       
        set dist = DBU(u,t)
        if dist<GetUnitAbilityLevel(u,AbilId)*1500. then
            set Bool = true
            set id = GetPlayerId(GetOwningPlayer(u))
            call UnitShareVision(t,GetOwningPlayer(u),true)
            if GetUnitAbilityLevel(Dum[id],DumAbilId)==0 then
                call UnitAddAbility(Dum[id],DumAbilId)
            endif
            call SetUnitAbilityLevel(Dum[id],DumAbilId,GetUnitAbilityLevel(u,AbilId))
        else
            call UnitShareVision(t,GetOwningPlayer(u),false)
        endif
    endif
   
    set u = null
    set t = null
    return false
endfunction

private function Effects takes nothing returns nothing
    local unit u=GetEnumUnit()
    local group g=NewGroup()

    set Bool = false
    set U = u
    call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,B)
    if not Bool then
        call UnitRemoveAbility(Dum[GetPlayerId(GetOwningPlayer(u))],DumAbilId)
        call UnitRemoveAbility(u,BuffId)
    endif
   
    set u = null
    call ReleaseGroup(g)
endfunction

private function Update takes nothing returns nothing
    call ForGroup(G,function Effects)
endfunction

private function Actions takes nothing returns nothing
    local timer t
    local unit u = GetTriggerUnit()
    local integer id = GetPlayerId(GetOwningPlayer(u))
   
    if G==null then
        set G = CreateGroup()
        set t = CreateTimer()
        call TimerStart(t,.5,true,function Update)
    endif
    call GroupAddUnit(G,u)
    set Dum[id] = CreateUnit(GetOwningPlayer(u),CasterId,0.,0.,0.)
    call SetUnitInvulnerable(Dum[id],true)
endfunction

private function Conds takes nothing returns boolean
    if GetLearnedSkill()==AbilId and not IsUnitIllusion(GetTriggerUnit()) and GetUnitAbilityLevel(GetTriggerUnit(),AbilId)==1 then
        call Actions()
    endif
    return false
endfunction
private function Init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(t,Condition(function Conds))
   
    set B = Condition(function Filt)
   
    call PreloadAbil(DumAbilId)
endfunction

endscope
Perhaps it's time to learn how to make your own custom spells? It's a hell of a lot more fun to be able to do it yourself, well worth the effort.
 
Level 15
Joined
Jul 19, 2007
Messages
855
Again, this is very outdated stuff that is bound to have issues on recent versions. That being said, this may work:
vJASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope StrygwyrsThirst initializer Init

globals
    private constant integer AbilId = 'A00C'
    private constant integer DumAbilId = 'S001'
    private constant integer BuffId = 'B005'
  
    private group G = null
    private unit U
    private boolexpr B
    private boolean Bool
  
    private unit array Dum
endglobals

private function Filt takes nothing returns boolean
    local unit u = U
    local unit t = GetFilterUnit()
    local real dist
    local integer id
  
    if IsUnitType(t,UNIT_TYPE_HERO)==true and IsUnitEnemy(t,GetOwningPlayer(u)) then
        if GetWidgetLife(t)/GetUnitState(t,ConvertUnitState(1))>.4 or GetWidgetLife(t)<.405 then
            call UnitShareVision(t,GetOwningPlayer(u),false)
            return false
        endif
      
        set dist = DBU(u,t)
        if dist<GetUnitAbilityLevel(u,AbilId)*1500. then
            set Bool = true
            set id = GetPlayerId(GetOwningPlayer(u))
            call UnitShareVision(t,GetOwningPlayer(u),true)
            if GetUnitAbilityLevel(Dum[id],DumAbilId)==0 then
                call UnitAddAbility(Dum[id],DumAbilId)
            endif
            call SetUnitAbilityLevel(Dum[id],DumAbilId,GetUnitAbilityLevel(u,AbilId))
        else
            call UnitShareVision(t,GetOwningPlayer(u),false)
        endif
    endif
  
    set u = null
    set t = null
    return false
endfunction

private function Effects takes nothing returns nothing
    local unit u=GetEnumUnit()
    local group g=NewGroup()

    set Bool = false
    set U = u
    call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,B)
    if not Bool then
        call UnitRemoveAbility(Dum[GetPlayerId(GetOwningPlayer(u))],DumAbilId)
        call UnitRemoveAbility(u,BuffId)
    endif
  
    set u = null
    call ReleaseGroup(g)
endfunction

private function Update takes nothing returns nothing
    call ForGroup(G,function Effects)
endfunction

private function Actions takes nothing returns nothing
    local timer t
    local unit u = GetTriggerUnit()
    local integer id = GetPlayerId(GetOwningPlayer(u))
  
    if G==null then
        set G = CreateGroup()
        set t = CreateTimer()
        call TimerStart(t,.5,true,function Update)
    endif
    call GroupAddUnit(G,u)
    set Dum[id] = CreateUnit(GetOwningPlayer(u),CasterId,0.,0.,0.)
    call SetUnitInvulnerable(Dum[id],true)
endfunction

private function Conds takes nothing returns boolean
    if GetLearnedSkill()==AbilId and not IsUnitIllusion(GetTriggerUnit()) and GetUnitAbilityLevel(GetTriggerUnit(),AbilId)==1 then
        call Actions()
    endif
    return false
endfunction
private function Init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(t,Condition(function Conds))
  
    set B = Condition(function Filt)
  
    call PreloadAbil(DumAbilId)
endfunction

endscope
Perhaps it's time to learn how to make your own custom spells? It's a hell of a lot more fun to be able to do it yourself, well worth the effort.
Thanks it works now. Well I don't even dare to try how to learn JASS-triggers because I understand nothing...
 
Status
Not open for further replies.
Top