|
发表于 2006-12-10 17:46:20
|
显示全部楼层
修改版...
应该比较YD滴说...
只改了1个函数...顺便修正了一些小问题...
- function SetGuard_Func takes nothing returns nothing
- local timer tm = GetExpiredTimer()
- local unit pet = i2u(GetStoredInteger(udg_GC, "Guarder"+I2S(h2i(tm)), "Pet"))
- local unit captain = i2u(GetStoredInteger(udg_GC, "Guarder"+I2S(h2i(tm)), "Captain"))
- local real x = GetUnitX(captain) - GetUnitX(pet)
- local real y = GetUnitY(captain) - GetUnitY(pet)
- local real d = x*x + y*y
- local real v
- local real a
- local string s = OrderId2String(GetUnitCurrentOrder(pet))
- set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "GuardRanger")
- if d<v*v then
- if s != "attack" and s != "move" and GetRandomInt(0,100)<10 then
- set x = GetUnitX(captain)
- set y = GetUnitY(captain)
- set d = GetRandomReal(0,v)
- set a = GetRandomReal(0,360)
- call IssuePointOrder(pet, "attack", x+d*CosBJ(a), y+d*SinBJ(a))
- endif
- else
- set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "ReturnRanger")
- if d<v*v then
- if s != "attack" and s != "move" then
- call IssuePointOrder(pet, "attack", GetUnitX(captain), GetUnitY(captain))
- endif
- else
- set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "OutRanger")
- if d!=0 and d>v*v then
- call SetUnitPosition(pet,GetUnitX(captain),GetUnitY(captain))
- else
- call IssuePointOrder(pet, "move", GetUnitX(captain), GetUnitY(captain))
- endif
- endif
- endif
- set tm = null
- set pet = null
- set captain = null
- endfunction
复制代码 |
|