• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

How to give a hero more than 4 spells ?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
have a limit for hero abilities but anyway u can give alot unit ability

whatever u can use this system if u want more ability and pageing http://www.hiveworkshop.com/forums/spells-569/libram-v3-0-0-0-a-193521/

it is vjass but u can do in jass too.

i made it too, and following the methode:
make a integer array PAGE (we store here what page is the current for unit)
-once add lets say 16 ability to hero
-disable every ability after what isnt on current page
make a updown ability what show the next page, if somebody click to next page ability then acctually its increase page value with 1 and disable abilities on previous page

in my case udg_Max_Ability_Per_Unit=12 at map init and class2[] show the hero what class (so different skillset for archer, wizard, warror, so each with 12 ability)

Abilities was stored to variables and lets say if i choose paladin what is class2[]=0 then its add to unit the Abilities[0-11], if warrior what is 1 then add Abilities[12-23] to unit and we shift that 12 ability

so basically in jass the pageing after u added all ability what u want look like this

(this mpi but u can use custom unit value too if u want more but problem is when u got same ability on more unit/player )

up ability
JASS:
function Trig_Shift_up_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A014'
endfunction

function Trig_Shift_up_Actions takes nothing returns nothing
local player pl = GetTriggerPlayer()
local integer p = GetPlayerId(pl) + 1
local integer i = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4 
local integer t = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4 + 3
    loop
        exitwhen i > t
        call SetPlayerAbilityAvailable( pl, udg_Abilities1[i], false )
        set i = i + 1
    endloop
    if ( udg_AbilityPage > 0  ) then
        set udg_AbilityPage = udg_AbilityPage - 1 
    else
        set udg_AbilityPage = udg_Max_Ability_Per_Unit / 4 - 1
    endif
    set i = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4
    set t = i + 3
    loop
        exitwhen i > t
        call SetPlayerAbilityAvailable( pl, udg_Abilities1[i], true )
        set i = i + 1
    endloop
set pl = null
endfunction

//===========================================================================
function InitTrig_Shift_up takes nothing returns nothing
    set gg_trg_Shift_up = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Shift_up, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
    call TriggerAddCondition( gg_trg_Shift_up, Condition( function Trig_Shift_up_Conditions ) )
    call TriggerAddAction( gg_trg_Shift_up, function Trig_Shift_up_Actions )
endfunction
down ability
JASS:
function Trig_Shift_down_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01A'
endfunction

function Trig_Shift_down_Actions takes nothing returns nothing
local player pl = GetTriggerPlayer()
local integer p = GetPlayerId(pl) + 1
local integer i = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4 
local integer t = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4 + 3
    loop
        exitwhen i > t
        call SetPlayerAbilityAvailable( pl, udg_Abilities1[i], false )
        set i = i + 1
    endloop
    if ( udg_AbilityPage < ( udg_Max_Ability_Per_Unit / 4 - 1 ) ) then
        set udg_AbilityPage = ( udg_AbilityPage + 1 )
    else
        set udg_AbilityPage = 0
    endif
    set i = udg_Class2 * udg_Max_Ability_Per_Unit + udg_AbilityPage * 4
    set t = i + 3
    loop
        exitwhen i > t
        call SetPlayerAbilityAvailable( pl, udg_Abilities1[i], true )
        set i = i + 1
    endloop
set pl = null
endfunction

//===========================================================================
function InitTrig_Shift_down takes nothing returns nothing
    set gg_trg_Shift_down = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Shift_down, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
    call TriggerAddCondition( gg_trg_Shift_down, Condition( function Trig_Shift_down_Conditions ) )
    call TriggerAddAction( gg_trg_Shift_down, function Trig_Shift_down_Actions )
endfunction
 
Status
Not open for further replies.
Top