找回密码
 点一下
查看: 4026|回复: 2

组内全部单位删除(或删除单位上的所有特效,但保留单位)

[复制链接]
发表于 2007-10-12 17:22:17 | 显示全部楼层 |阅读模式
  1.     function GroupRemoveUnitEffect takes group whichGroup, string handleName returns nothing
  2.         local group g = CreateGroup()
  3.         local unit u
  4.         call GroupAddGroup( whichGroup, g )
  5.         loop
  6.             set u = FirstOfGroup( g )
  7.             exitwhen u == null
  8.             if ( handleName == null ) then
  9.                 call RemoveUnit( u )
  10.             else
  11.                 call DestroyEffect( GetHandleEffect( u, handleName ))
  12.                 call FlushStoredInteger( LocalVars(),I2S(H2I( u )), handleName )
  13.             endif
  14.             call GroupRemoveUnit( g, u )
  15.         endloop
  16.         call DestroyGroup( g )
  17.         set g = null
  18.     endfunction
复制代码

制作华丽技能时很有用的函数,用法:
call GroupRemoveUnitEffect( g, "effect" )
结果:
删除所有单位上的特效,但单位保留。

call GroupRemoveUnitEffect( g, null )
把组内所有的单位移除。

必须配合游戏缓存使用。
  1.     function H2I takes handle h returns integer
  2.         return h
  3.         return 0
  4.     endfunction
  5.     function LocalVars takes nothing returns gamecache
  6.         if ( bj_lastCreatedGameCache == null ) then
  7.             set bj_lastCreatedGameCache = InitGameCache("jasslocalvars.w3v")
  8.         endif
  9.         return bj_lastCreatedGameCache
  10.     endfunction
  11.     function GetHandleEffect takes handle subject,string name returns effect
  12.         return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
  13.         return null
  14.     endfunction
复制代码
发表于 2009-4-11 23:35:20 | 显示全部楼层
好东西!!!!!!!!!!!111111   [s:186]  [s:186]
回复

使用道具 举报

发表于 2011-4-7 15:32:53 | 显示全部楼层
不错的东西,多年后的我来学习以下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-22 19:06 , Processed in 0.056522 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表