- Joined
- Aug 4, 2012
- Messages
- 1,022
FIXED!
Here's the code, thanks to TriggerHappy & Bribe!
QUESTION:
Those code was made by ME

It's got no syntax error!!
but it doesn't work
Here's what I want with that code:
1. Player enters chat "-refresh"
2. All unit owned by chatting player will be reseted it cooldowns, hp & mana
Here's the code, thanks to TriggerHappy & Bribe!
JASS:
scope refresh initializer chat
globals
private constant string string = "-refresh"
endglobals
private function pick takes nothing returns nothing
local unit u
call groupenumunitsofplayer(bj_lastcreatedgroup, gettriggerplayer(), null)
loop
set u = firstofgroup(bj_lastcreatedgroup)
exitwhen u == null
call groupremoveunit(bj_lastcreatedgroup, u)
call setwidgetlife(u, 999999)
call setunitstate(u, unit_state_mana, 999999)
call unitresetcooldown(u)
endloop
endfunction
private function chat takes nothing returns nothing
local trigger t = createtrigger()
local integer i = 12
loop
set i = i - 1
call triggerregisterplayerchatevent(t, player(i), string, true)
exitwhen i == 0
endloop
call triggeraddaction(t, function pick)
set t = null
endfunction
endscope
QUESTION:
JASS:
scope Refresh initializer Chat
globals
private constant string STRING = "-refresh"
private constant player PLAYER = Player(0)
endglobals
private function Fresh takes nothing returns nothing
call SetUnitLifePercentBJ(GetTriggerUnit(), 100)
call SetUnitManaPercentBJ(GetTriggerUnit(), 100)
call UnitResetCooldown(GetTriggerUnit())
endfunction
private function Pick takes nothing returns nothing
call ForGroupBJ(GetUnitsOfPlayerAll(PLAYER), function Fresh)
endfunction
private function Chat takes nothing returns nothing
call TriggerRegisterPlayerChatEvent(gg_trg_Refresh, PLAYER, STRING, true)
call TriggerAddAction(gg_trg_Refresh, function Pick)
endfunction
endscope
It's got no syntax error!!
but it doesn't work
Here's what I want with that code:
1. Player enters chat "-refresh"
2. All unit owned by chatting player will be reseted it cooldowns, hp & mana
Last edited: