找回密码
 点一下
楼主: everguo

[Red_wolf]粉YD的佣兵系统

  [复制链接]
发表于 2006-12-10 17:46:20 | 显示全部楼层
修改版...
应该比较YD滴说...
只改了1个函数...顺便修正了一些小问题...
  1. function SetGuard_Func takes nothing returns nothing
  2.     local timer tm = GetExpiredTimer()
  3.     local unit pet = i2u(GetStoredInteger(udg_GC, "Guarder"+I2S(h2i(tm)), "Pet"))
  4.     local unit captain = i2u(GetStoredInteger(udg_GC, "Guarder"+I2S(h2i(tm)), "Captain"))
  5.     local real x = GetUnitX(captain) - GetUnitX(pet)
  6.     local real y = GetUnitY(captain) - GetUnitY(pet)
  7.     local real d = x*x + y*y
  8.     local real v
  9.     local real a
  10.     local string s = OrderId2String(GetUnitCurrentOrder(pet))
  11.     set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "GuardRanger")
  12.     if d<v*v then
  13.         if s != "attack" and s != "move" and GetRandomInt(0,100)<10 then
  14.             set x = GetUnitX(captain)
  15.             set y = GetUnitY(captain)
  16.             set d = GetRandomReal(0,v)
  17.             set a = GetRandomReal(0,360)
  18.             call IssuePointOrder(pet, "attack", x+d*CosBJ(a), y+d*SinBJ(a))
  19.         endif
  20.     else
  21.         set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "ReturnRanger")
  22.         if d<v*v then
  23.             if s != "attack" and s != "move" then
  24.                 call IssuePointOrder(pet, "attack", GetUnitX(captain), GetUnitY(captain))
  25.             endif
  26.         else
  27.             set v = GetStoredReal(udg_GC, "Guarder"+I2S(h2i(tm)), "OutRanger")
  28.                 if d!=0 and d>v*v then
  29.                     call SetUnitPosition(pet,GetUnitX(captain),GetUnitY(captain))
  30.                 else
  31.                     call IssuePointOrder(pet, "move", GetUnitX(captain), GetUnitY(captain))
  32.                 endif
  33.         endif
  34.     endif
  35.     set tm = null
  36.     set pet = null
  37.     set captain = null
  38. endfunction
复制代码
回复

使用道具 举报

 楼主| 发表于 2006-12-10 17:55:46 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| 发表于 2006-12-10 18:07:55 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-12-10 18:11:49 | 显示全部楼层
忘了说料...
我测试时素把timeout设成0.2s滴
为了不让pet动的过快把YD滴概率设成10%...
另外如果要加主动释放技能滴话还要小改一下...
回复

使用道具 举报

 楼主| 发表于 2006-12-10 18:25:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-12-10 18:43:46 | 显示全部楼层
实际上要添加释放技能的话只要把含有
if s != "attack" and s != "move"
的那2行加上s != "roar"这个条件即可
目的是不让其它order打断roar
回复

使用道具 举报

 楼主| 发表于 2006-12-10 18:57:17 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-12-10 19:02:03 | 显示全部楼层
其实,这和“攻击时有一定概率释放某技能”不是一样的么
回复

使用道具 举报

 楼主| 发表于 2006-12-10 19:05:08 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-12-10 19:25:46 | 显示全部楼层
我的思路是加个AI..............
但MS比触发占的空间大
回复

使用道具 举报

发表于 2006-12-10 19:35:35 | 显示全部楼层
AI有虾米用?
非对战AI也素靠触发和Jass实现的...
回复

使用道具 举报

 楼主| 发表于 2006-12-10 19:37:51 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-12-11 19:27:27 | 显示全部楼层
引用第17楼everguo2006-12-10 15:57发表的:
另外我想知道   如何去掉这个系统

比如,你让召唤出来的非英雄单位做佣兵   那么  当这个佣兵死后  如果让程序不再执行呢



很好~ 很强大~~
明明里面就有个RemoveGuard函数......
回复

使用道具 举报

发表于 2006-12-11 19:39:02 | 显示全部楼层
呃...可以在SetGuard时生成一个能自动RemoveGuard滴触发...适合某些懒人...
回复

使用道具 举报

 楼主| 发表于 2006-12-11 20:02:31 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 07:51 , Processed in 0.084239 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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