- Joined
- Aug 7, 2004
- Messages
- 875
Hey I have the following code that repicks a player's hero...
Everything works fine except for one thing... whenever the unit is added to the tavern one other unit disappears from the stock and it keeps happening everytime this repick action gets called... I don't know how to fix this...
Anyone got a shot?
JASS:
function RemoveHeroIcon takes player who returns nothing
local player p = who
local integer i = GetConvertedPlayerId(p)
if(i <= 5) then
call MultiboardSetItemIconBJ( udg_Multiboard, 1, ( i + 2 ), "" )
else
call MultiboardSetItemIconBJ( udg_Multiboard, 1, ( i + 3 ), "" )
endif
set p = null
endfunction
JASS:
function Repick takes player who returns nothing
local player p = who
local integer i = GetConvertedPlayerId(p)
local location l = GetUnitLoc(udg_heroselector[i])
call RemoveHeroIcon(p)
call DisplayTextToForce(GetPlayersAll(), GetPlayerNameColoured(p) +" has repicked |c001398F4" + GetHeroProperName(udg_dead[i]) + ".")
call SetUnitOwner(udg_heroselector[i], p, true)
call AddUnitToStockBJ(GetUnitTypeId(udg_dead[i]), GetUnitBelongsToTavern(udg_dead[i]), 1, 1)
call PanCameraToTimedLocForPlayer(p,l,0)
call RemoveUnit(udg_dead[i])
set udg_dead[i] = null
call RemoveLocation(l)
set p = null
set l = null
endfunction
Everything works fine except for one thing... whenever the unit is added to the tavern one other unit disappears from the stock and it keeps happening everytime this repick action gets called... I don't know how to fix this...
Anyone got a shot?