|
- function GroupRemoveUnitEffect takes group whichGroup, string handleName returns nothing
- local group g = CreateGroup()
- local unit u
- call GroupAddGroup( whichGroup, g )
- loop
- set u = FirstOfGroup( g )
- exitwhen u == null
- if ( handleName == null ) then
- call RemoveUnit( u )
- else
- call DestroyEffect( GetHandleEffect( u, handleName ))
- call FlushStoredInteger( LocalVars(),I2S(H2I( u )), handleName )
- endif
- call GroupRemoveUnit( g, u )
- endloop
- call DestroyGroup( g )
- set g = null
- endfunction
复制代码
制作华丽技能时很有用的函数,用法:
call GroupRemoveUnitEffect( g, "effect" )
结果:
删除所有单位上的特效,但单位保留。
call GroupRemoveUnitEffect( g, null )
把组内所有的单位移除。
必须配合游戏缓存使用。
- function H2I takes handle h returns integer
- return h
- return 0
- endfunction
- function LocalVars takes nothing returns gamecache
- if ( bj_lastCreatedGameCache == null ) then
- set bj_lastCreatedGameCache = InitGameCache("jasslocalvars.w3v")
- endif
- return bj_lastCreatedGameCache
- endfunction
- function GetHandleEffect takes handle subject,string name returns effect
- return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
- return null
- endfunction
复制代码 |
|