Hey, I wanted to make emoji system triggered by keypress, map is arena so bound to hero.
Here's what I have.
It never reaches actions.
Here's what I have.
JASS:
/*globals used: emojicharge integer array (index is playerID, supposed to be cooldown, when value isn't 0, player cannot express his awe);
Hero unit array (assigned unit for each player once he picks hero)*/
function Trig_Emoji_Conditions takes nothing returns boolean
return emojicharge[GetPlayerId(GetTriggerPlayer())]==0
endfunction
function Trig_Emoji_Actions takes nothing returns nothing
local unit u = Hero[GetPlayerId(GetTriggerPlayer())]
call DestroyEffect(AddSpecialEffectTarget("wpson.mdx",u,"overhead"))
set emojicharge[GetPlayerId(GetTriggerPlayer())]=1
call TriggerSleepAction(15)
set emojicharge[GetPlayerId(GetTriggerPlayer())]=0
endfunction
function InitTrig_Emoji takes nothing returns nothing
local trigger gg_trg_Emoji=CreateTrigger()
local integer i=0
loop
call TriggerRegisterPlayerKeyEventBJ(gg_trg_Emoji,Player(i),bj_KEYEVENTTYPE_DEPRESS,bj_KEYEVENTKEY_UP)
exitwhen i==bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Emoji,Condition(function Trig_Emoji_Conditions))
call TriggerAddAction(gg_trg_Emoji,function Trig_Emoji_Actions)
set t=null
endfunction