function CloneUnit takes unit whichUnit, player cloneOwner, real cloneX, real cloneY, real cloneFacing returns unit
local unit clone
local gamecache g = InitGameCache("CloneCache.w3v")
call StoreUnit(g, "clone", "clone", whichUnit)
set clone = RestoreUnit(g, "clone", "clone", cloneOwner, cloneX, cloneY, cloneFacing)
call SetUnitState(clone, UNIT_STATE_LIFE, GetUnitState(whichUnit, UNIT_STATE_LIFE))
call SetUnitState(clone, UNIT_STATE_MANA, GetUnitState(whichUnit, UNIT_STATE_MANA))
call FlushGameCache(g)
set g = null
return clone
endfunction
local unit clone
local gamecache g = InitGameCache("CloneCache.w3v")
call StoreUnit(g, "clone", "clone", whichUnit)
set clone = RestoreUnit(g, "clone", "clone", cloneOwner, cloneX, cloneY, cloneFacing)
call SetUnitState(clone, UNIT_STATE_LIFE, GetUnitState(whichUnit, UNIT_STATE_LIFE))
call SetUnitState(clone, UNIT_STATE_MANA, GetUnitState(whichUnit, UNIT_STATE_MANA))
call FlushGameCache(g)
set g = null
return clone
endfunction