|
楼主 |
发表于 2011-4-11 22:51:05
|
显示全部楼层
胡乱写了个函数,复制一个单位到x,y,面朝facing。- function CopyUnitSJ takes unit oldunit, real x, real y, real facing returns unit
-     local unit      newunit
-     local gamecache unitcache
-     local string    cachename = "CopyUnitSJcache.w3v"
-     set unitcache = InitGameCache( cachename )
-     call StoreUnit(unitcache,  "Category", "label", oldunit)
-     set newunit   = RestoreUnit(unitcache, "Category", "label", GetOwningPlayer(oldunit), x, y, facing)
-     call FlushGameCache( unitcache )
-     call SetUnitLifeBJ( newunit, GetUnitState(oldunit, UNIT_STATE_LIFE))
-     call SetUnitManaBJ( newunit, GetUnitState(oldunit, UNIT_STATE_MANA))
-     call RemoveUnit(oldunit)
-     set oldunit   = null
-     set unitcache = null
-     return newunit
- endfunction
复制代码 魔法和生命复制了,但是buff和技能cd没弄。不是很完美。
谢谢希瓦的提示,原来还有gamechche这种东西^_^ |
|