|
本帖最后由 徐依尘 于 2014-2-23 16:04 编辑
触发创建闪电效果,战争迷雾中仍然显示,应该如何解决
真心求解~
============算是答案吧====================
最后还得是使用本地玩家的方法PS:把这些乱七八糟的代码复制进自定义代码,然后就用自定义代码 call LOM_CLE2U(单位1变量,单位2变量,闪电类型,持续时间)
- // 创建一个链接两个单位闪电效果
- globals
- hashtable udg_HT=InitHashtable()
- endglobals
- function LOM_SLEV1P takes lightning le,player p,real xr returns nothing
- if GetLocalPlayer()==p then
- call SetLightningColor(le,1,1,1,xr)
- endif
- set le=null
- set p=null
- endfunction
- function LOM_MLE2U takes lightning le,unit u1,unit u2 returns nothing
- local player p=null
- local real x1=GetUnitX(u1)
- local real y1=GetUnitY(u1)
- local real z1=(50+GetUnitFlyHeight(u1))
- local real x2=GetUnitX(u2)
- local real y2=GetUnitY(u2)
- local real z2=(50+GetUnitFlyHeight(u2))
- local integer i=0
- call MoveLightningEx(le,false,x1,y1,z1,x2,y2,z2)
- loop
- set p=Player(i)
- exitwhen i>11
- if (GetPlayerController(p)==MAP_CONTROL_USER) and (GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING) then
- if (IsVisibleToPlayer(x1,y1,p) or IsVisibleToPlayer(x2,y2,p)) then
- call LOM_SLEV1P(le,p,1)
- else
- call LOM_SLEV1P(le,p,0)
- endif
- endif
- set p=null
- set i=i+1
- endloop
- set u1=null
- set u2=null
- set le=null
- set p=null
- endfunction
- function LOM_CLE2U_IAT takes nothing returns nothing
- local timer t=GetExpiredTimer()
- local integer k=GetHandleId(t)
- local unit u1=LoadUnitHandle(udg_HT,k,1)
- local unit u2=LoadUnitHandle(udg_HT,k,2)
- local lightning le=LoadLightningHandle(udg_HT,k,3)
- local real i=LoadReal(udg_HT,k,5)-1
- call LOM_MLE2U(le,u1,u2)
- if i>0 then
- call SaveReal(udg_HT,k,5,i)
- call TimerStart(t,LoadReal(udg_HT,k,4),false,function LOM_CLE2U_IAT)
- else
- call DestroyLightning(le)
- call DestroyTimer(t)
- call FlushChildHashtable(udg_HT,k)
- endif
- set u1=null
- set u2=null
- set le=null
- set t=null
- endfunction
- function LOM_CLE2U takes unit u1,unit u2,string letid,real xtr returns nothing
- local timer t=CreateTimer()
- local integer k=GetHandleId(t)
- local lightning le=AddLightningEx(letid,false,GetUnitX(u1),GetUnitY(u1),(35+GetUnitFlyHeight(u1)),GetUnitX(u2),GetUnitY(u2),(35+GetUnitFlyHeight(u2)))
- local real ddtr=0.03
- call SetLightningColor(le,1,1,1,0)
- call SaveUnitHandle(udg_HT,k,1,u1)
- call SaveUnitHandle(udg_HT,k,2,u2)
- call SaveLightningHandle(udg_HT,k,3,le)
- call SaveReal(udg_HT,k,4,ddtr)
- call SaveReal(udg_HT,k,5,(xtr/ddtr))
-
- call TimerStart(t,0.01,false,function LOM_CLE2U_IAT)
-
- set u1=null
- set u2=null
- set le=null
- set letid=null
- endfunction
复制代码
|
|