• 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.

[JASS] Spell Book

Status
Not open for further replies.
Level 4
Joined
Nov 27, 2012
Messages
85
Hello,

Having 2 issues with spellbooks,

1) The spellbook icon is showing up, even though it's disabled
2) The spellbook (DkNs) has 2 passive abilities inside, one for HP regen (DkHP), one for MP regen (DkMP), and they're supposed to scale with the level of the spellbook.

The HP skill is fine, but the MP skill stays at level 1 even when the spell book is level 2 or 3

The second trigger is because the ability is only active during the night

JASS:
function Trig_Darkness_Conditions takes nothing returns boolean
    return GetLearnedSkill()=='DydW' or GetLearnedSkill()=='DydE' or GetLearnedSkill()=='DydR'
endfunction

function Trig_Darkness_Actions takes nothing returns nothing
    set udg_unit_darkness=GetTriggerUnit()
    set udg_integer_darkness=GetLearnedSkillLevel()

    if udg_integer_darkness==1 then
        call UnitAddAbility(udg_unit_darkness,'Ashm')
        call UnitAddAbility(udg_unit_darkness,'DkNs')
        call SetPlayerAbilityAvailable(GetOwningPlayer(udg_unit_darkness),'DkNs',true)
        call SetPlayerAbilityAvailable(GetOwningPlayer(udg_unit_darkness),'DkNs',false)
        call UnitMakeAbilityPermanent(udg_unit_darkness,true,'Ashm')
        call EnableTrigger(gg_trg_Darkness_Time)
    endif
endfunction
//===========================================================================
function InitTrig_Darkness takes nothing returns nothing
    local integer i=0
    
    set gg_trg_Darkness=CreateTrigger()
    loop
        exitwhen i==bj_MAX_PLAYER_SLOTS
        call TriggerRegisterPlayerUnitEvent(gg_trg_Darkness,Player(i),EVENT_PLAYER_HERO_SKILL,null)
        set i=i+1
    endloop
    
    call TriggerAddCondition(gg_trg_Darkness,Condition(function Trig_Darkness_Conditions))
    call TriggerAddAction(gg_trg_Darkness,function Trig_Darkness_Actions)
endfunction

JASS:
function Trig_Darkness_Time_Actions takes nothing returns nothing
    local real r=GetFloatGameState(GAME_STATE_TIME_OF_DAY)
    
    if r==0.00 or r<6.00 or r>=18.00 then
        call UnitAddAbility(udg_unit_darkness,'DkNs')
        call SetUnitAbilityLevel(udg_unit_darkness,'DkMP',udg_integer_darkness)
        call SetUnitAbilityLevel(udg_unit_darkness,'DkHP',udg_integer_darkness)
        call SetPlayerAbilityAvailable(GetOwningPlayer(udg_unit_darkness),'DkNs',true)
        call SetPlayerAbilityAvailable(GetOwningPlayer(udg_unit_darkness),'DkNs',false)
    else
        if r>=6.00 and r<18.00 then
            call UnitRemoveAbility(udg_unit_darkness,'DkNs')
        endif
    endif
endfunction
//===========================================================================
function InitTrig_Darkness_Time takes nothing returns nothing
    set gg_trg_Darkness_Time=CreateTrigger()
    call DisableTrigger(gg_trg_Darkness_Time)
    call TriggerRegisterTimerEvent(gg_trg_Darkness_Time,1.00,true)
    call TriggerAddAction(gg_trg_Darkness_Time,function Trig_Darkness_Time_Actions)
endfunction
 
Level 4
Joined
Nov 27, 2012
Messages
85
I'm not sure, I made this skill a few years ago, think I just threw it in there for safe measures

The MP skill is based on Item Mana Regeneration

edit: screw it, decided to not use the spell book and make a skill for each level of the MP regen
 
Last edited:
Status
Not open for further replies.
Top