JASS:
scope Selection initializer onInit
private function select takes nothing returns nothing
local integer index = GetPlayerId(GetTriggerPlayer())
if DONT[index] == false then
set PlayerTarget[index] = GetTriggerUnit()
set DONT[index] = true
call SelectUnitForPlayerSingle(gg_unit_Hmkg_0000, GetTriggerPlayer())
set DONT[index] = false
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer index = 0
call TriggerAddAction(t, function select)
loop
call TriggerRegisterPlayerSelectionEventBJ(t, Player(index), true)
set index = index + 1
exitwhen index == bj_MAX_PLAYERS
endloop
endfunction
endscope
i was wondering why if i select another unit, it still says that PlayerTarget is gg_unit_Hmkg_0000..
i have this:
JASS:
scope Globals initializer onInit
globals
boolean array DONT
constant string INV_TAR = "Invalid Target!"
constant string NO_MAN = "Not Enought Mana!"
constant string TOO_FAR = "Target Too Far Away!"
constant string TOO_NEA = "Target Too Near!"
constant string NO_TAR = "No Target!"
constant string MAX_HP = "Your Target's HP is full!"
endglobals
function strings takes nothing returns nothing
local integer index = 0
debug call BJDebugMsg( "Globals initialized" )
loop
set DONT[index] = false
set index = index + 1
exitwhen index == bj_MAX_PLAYERS
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction(t, function strings)
call TriggerRegisterTimerEventSingle(t, 1.00)
endfunction
endscope
and:
JASS:
debug call BJDebugMsg(GetUnitName(PlayerTarget[index]))
what i want is when i select a unit, the unit becomes the
JASS:
PlayerTarget[index]
i know its quite confusing but please ask me questions dealing this.