- Joined
- Nov 30, 2007
- Messages
- 1,202
Basically after this line:
The code doesn't work any more. Only thing I can think off is if g isn't declared but it is...
JASS:
call SyncSelections()
call GroupEnumUnitsSelected(g, pp, null)
JASS:
private function AttachName takes integer p, integer i, string name returns nothing
local unit u
local unit foundunit
local integer count
local integer j = (p*10) + i
local player pp = Player(p)
if sCharacterName[j] == null then
call DisplayTimedTextToPlayer(pp, 0, 0, 5, "|cffff0303[ERROR]|r Failed to attach a name.|r")
return
endif
if i > 0 then
set count = 0
call BJDebugMsg("this is shown")
call SyncSelections()
call GroupEnumUnitsSelected(g, pp, null)
call BJDebugMsg("but not this...")
loop
call BJDebugMsg("looping")
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
if GetOwningPlayer(u) == pp then
set count = count + 1
set foundunit = u
endif
endloop
call BJDebugMsg("never reach this point")
if count == 1 then
call BJDebugMsg("Victory!")
elseif count == 0 then
call DisplayTimedTextToPlayer(pp, 0, 0, 5, "|cffff0303[ERROR]|r Need to have a character selected to execute command.")
else
call DisplayTimedTextToPlayer(pp, 0, 0, 5, "|cffff0303[ERROR]|r Can only attach a name to one of your units.")
endif
endif
endfunction