1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

DummyHotkeys.w3x
Variables
Initialization
DummyHotkey
Demo
Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code except Custom Script Item. Custom Script Item will merge into map script after globals variables declaration with the list order in trigger view.

		
Name Type Is Array Initial Value
library DummyHotkeys initializer init

    //NOTE THIS SYSTEM DOES ONLY SUPPORT ACTIVLY USED ABILITIES. DOES NOT WORK WITH AUTOCAST ABILITIES.
    //Written By CanFight

    globals
   
        private integer array DummySpells
        private integer DummySpellCount
        private integer array RealSpellId
        private string array RealSpellOrder
        private boolean array RealSpellTargeting
        private integer SpellCount
        private integer PlayerCount = 24              
   
    endglobals
   
    //make sure that the unit has the Abillity before you apply this.
    //takes player id (0 based), your spells ID, the spells Order Id, its target Type (instant, unit, point or both) and if its an area target spell.
    function SetDummyHotkey takes unit u, integer sid, integer index, string order, integer targetType, boolean aoe returns nothing
        local integer pid = GetPlayerId(GetOwningPlayer(u))
        local integer alvl = GetUnitAbilityLevel(u,sid) - 1
        if RealSpellId[index * PlayerCount + pid] == 0 then
            call UnitRemoveAbility(u, RealSpellId[index * PlayerCount + pid])    
        endif
       
        set RealSpellId[index * PlayerCount + pid] = sid
        set RealSpellOrder[index * PlayerCount + pid] = order
       
        if targetType != 0 then
            set RealSpellTargeting[index * PlayerCount + pid] = true
        else
            set RealSpellTargeting[index * PlayerCount + pid] = false
        endif  
   
        if GetLocalPlayer() == Player(pid) then
            call BlzSetAbilityIcon(DummySpells[index], BlzGetAbilityIcon(sid) )
            call BlzSetAbilityTooltip(DummySpells[index], BlzGetAbilityTooltip(sid, alvl), 0 )
            call BlzSetAbilityExtendedTooltip(DummySpells[index], BlzGetAbilityExtendedTooltip(sid, alvl), 0 )
        endif
         
        if aoe then
            call BlzSetAbilityIntegerLevelField(BlzGetUnitAbility(u, DummySpells[index]), ABILITY_ILF_OPTIONS, 0, 3 )
            call BlzSetAbilityRealLevelField(BlzGetUnitAbility(u, DummySpells[index]), ABILITY_RLF_AREA_OF_EFFECT, 0, BlzGetAbilityRealLevelField(BlzGetUnitAbility(u, sid), ABILITY_RLF_AREA_OF_EFFECT, alvl) )
        else  
            call BlzSetAbilityIntegerLevelField(BlzGetUnitAbility(u, DummySpells[index]), ABILITY_ILF_OPTIONS, 0, 1 )
        endif  
       
        call BlzSetAbilityRealLevelField(BlzGetUnitAbility(u, DummySpells[index]), ABILITY_RLF_CAST_RANGE, 0, BlzGetAbilityRealLevelField(BlzGetUnitAbility(u, sid), ABILITY_RLF_CAST_RANGE, alvl) - 10 )
                     
        call BlzUnitHideAbility(u, sid, true )
        call BlzSetAbilityIntegerLevelField( BlzGetUnitAbility(u, DummySpells[index]), ABILITY_ILF_TARGET_TYPE, 0, targetType)
        call BlzSetUnitAbilityManaCost(u, DummySpells[index], 0, BlzGetAbilityManaCost(sid, alvl) )
        call BlzSetUnitAbilityCooldown(u, DummySpells[index], 0, BlzGetAbilityCooldown(sid, alvl) )
       
    endfunction

    private function DummyCast takes nothing returns nothing
        local unit caster = GetTriggerUnit()
        local integer pid = GetPlayerId(GetOwningPlayer(caster))
        local location castPos = GetUnitLoc(caster)
        local location p
        local integer DAbiId = GetSpellAbilityId()
        local integer SAbiIndex = -1
        local integer i = 0
        loop
            exitwhen i >= DummySpellCount
            if DAbiId == DummySpells[i] then
                set SAbiIndex = i
            endif
            set i = i + 1
        endloop
       
        if SAbiIndex == -1 then
            return
        endif
        call BlzSetUnitAbilityManaCost(caster,RealSpellId[SAbiIndex * PlayerCount + pid], GetUnitAbilityLevel(caster,RealSpellId[SAbiIndex * PlayerCount + pid]) - 1,0)
        call BlzUnitHideAbility( caster, RealSpellId[SAbiIndex * PlayerCount + pid], false ) //abillity cant be hidden while being cast.
                                             
        set p = GetSpellTargetLoc()
       
        if RealSpellTargeting[SAbiIndex * PlayerCount + pid] then
            call IssuePointOrderLoc( caster, RealSpellOrder[SAbiIndex * PlayerCount + pid], p)
        else
            call IssueImmediateOrder(caster, RealSpellOrder[SAbiIndex * PlayerCount + pid])
        endif
       
        call RemoveLocation(p)
       
        call BlzUnitHideAbility( caster, RealSpellId[SAbiIndex * PlayerCount + pid], true )
       
        call RemoveLocation(castPos)
        call SetUnitState(caster, UNIT_STATE_MANA, GetUnitState(caster, UNIT_STATE_MANA) + I2R(BlzGetUnitAbilityManaCost(caster, DummySpells[SAbiIndex] , 0)))
    endfunction
   
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
       
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT  )
        call TriggerAddAction(t, function DummyCast)
   
        //setup the dummy spells they should be based on a blank channel spell. All of them need base order ids that are not used by other spells.
   
        set DummySpells[0] = 'A000'
        set DummySpells[1] = 'A001'
        set DummySpells[2] = 'A002'
        set DummySpells[3] = 'A003'
        set DummySpellCount = 4
   
    endfunction

endlibrary
Demo
  Events
    Time - Elapsed game time is 1.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 30.00 seconds the text: Abilities are bound to Q W E R. Currently only q and w are set up.
    Unit - Add Crushing Wave to Archmage 0000 <gen>
    Custom script: call SetDummyHotkey(gg_unit_Hamg_0000, 'ACcv',0, "carrionswarm", 2, false)
    Unit - Add Rain of Fire (Neutral Hostile 1) to Archmage 0000 <gen>
    Custom script: call SetDummyHotkey(gg_unit_Hamg_0000, 'ACrg',1, "rainoffire", 2, true)