游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2675|回复: 4

[讨论] 请牛人抬手帮忙下

[复制链接]

5

主题

25

帖子

25

积分

注册会员

Rank: 2

积分
25
发表于 2008-1-8 21:12:00 | 显示全部楼层 |阅读模式
namespace eval BHN_Boss {
  variable timeline [ clock seconds ]
  variable timediff 3
  proc CanCast { npc victim } {
    variable timeline
    variable timediff
    set now [ clock seconds ]
    set mobh [GetHealthPCT $npc]
    set spell_list "22539 23364 22687 20623 18431 17646 17131"
##############################################################################
# NPC Say
#######################
    set spellid [lindex $spell_list [expr {int(rand()*[llength $spell_list])}]]
    if {$spellid == 22539} { Say $npc 0 "Burn! You wretches! Burn!" }
    if {$spellid == 23364} { Say $npc 0 "I'll swap you from these grounds!" }  
    if {$spellid == 22687} { Say $npc 0 "Stop healing and face me!" }  
    if {$spellid == 20623} { Say $npc 0 "I command death!" }  
    if {$spellid == 18431} { Say $npc 0 "RROOOAARRGGH!" }  
    if {$spellid == 17646} { Say $npc 0 "My whelps will become as powerful as I am one day!" }  
    if {$spellid == 17131} { Say $npc 0 "Obey me! The Broad Mother of the Black Dragonflight!" }
############################################################################
    # NPC & Victim Spell Line
############################################################################
    ## Circle of Flame
    if { $mobh == 98 } {
     castspell $npc $npc 17447
      if { $now >= ( $timeline + $timediff ) } {
        return $spellid
      }
    }  
    ## Boss Flying (remote timer test)
    if { ($mobh <= 75)&&($mobh >= 70)} {
      Emote $npc 254
# Landing Script Call Command
      if { $now >= ( $timeline + $timediff ) } {
        # Boss Landing
        Emote $npc 293
      }
    }
    ## Self Heal (potion spell)
    if { ($mobh <= 5)&&($mobh >= 2) } {
      castspell $npc $npc 4042
      if { $now >= ( $timeline + $timediff ) } {
        return $spellid
      }
    }
    ## Return Else
    else { return $spellid }
  }
  set loadinfo "Flying & Landing Boss"
  set loadvers "Beta 2.00"
  puts "[clock format [clock seconds] -format %k:%M:%S]:Mloadinfo ($loadvers) - Tha-Doctor"


上面是某个怪物的AI脚本,哪位牛人帮忙解读下吗?不胜感激啊!

5

主题

25

帖子

25

积分

注册会员

Rank: 2

积分
25
 楼主| 发表于 2008-1-8 21:28:00 | 显示全部楼层

Re:请牛人抬手帮忙下

希望有人帮忙解答下啊
自己顶了

15

主题

727

帖子

736

积分

高级会员

Rank: 4

积分
736
发表于 2008-1-8 21:32:00 | 显示全部楼层

Re:请牛人抬手帮忙下


namespace eval BHN_Boss {//命名空间。防止变量重复声明用的。BHN_BOSS是头BOSS,BHN彪悍牛?
  variable timeline [ clock seconds ]//声明变量,看下面应该是计时器
  variable timediff 3 //声明变量,看下面应该是周期设定,单位是秒
  proc CanCast { npc victim } {//处理函数,参数应该是NPC目标
    variable timeline//再次声明
    variable timediff//还声明
    set now [ clock seconds ]//设置时间为当前时间
    set mobh [GetHealthPCT $npc]//设置怪物HP为这个怪物的HP
    set spell_list "22539 23364 22687 20623 18431 17646 17131"//设置法术列表,应该是5位数为1个法术ID
##############################################################################
# NPC Say//NPC说
#######################
    set spellid [lindex $spell_list [expr {int(rand()*[llength $spell_list])}]]//应该是怪物施法
    if {$spellid == 22539} { Say $npc 0 "Burn! You wretches! Burn!" }//法术对应台词,以下皆同
    if {$spellid == 23364} { Say $npc 0 "I'll swap you from these grounds!" }  
    if {$spellid == 22687} { Say $npc 0 "Stop healing and face me!" }  
    if {$spellid == 20623} { Say $npc 0 "I command death!" }  
    if {$spellid == 18431} { Say $npc 0 "RROOOAARRGGH!" }  
    if {$spellid == 17646} { Say $npc 0 "My whelps will become as powerful as I am one day!" }  
    if {$spellid == 17131} { Say $npc 0 "Obey me! The Broad Mother of the Black Dragonflight!" }
############################################################################
    # NPC & Victim Spell Line
############################################################################
    ## Circle of Flame
    if { $mobh == 98 } {//如果怪物HP=98
     castspell $npc $npc 17447//对NPC变量施展17447编号的法术,应该是烈焰之环还是火环啥的.看翻译
      if { $now >= ( $timeline + $timediff ) } {//如果现在的时间>刚才记录的时间+周期秒,则返回法术ID.
        return $spellid
      }
    }  
    ## Boss Flying (remote timer test)
    if { ($mobh <= 75)&&($mobh >= 70)} {
      Emote $npc 254//做表情,条件同上
# Landing Script Call Command
      if { $now >= ( $timeline + $timediff ) } {
        # Boss Landing
        Emote $npc 293//做表情,其他同.这两个表情应该是BOSS起飞和降落.
      }
    }
    ## Self Heal (potion spell)
    if { ($mobh <= 5)&&($mobh >= 2) } {//5>=HP>=2,BOSS自疗
      castspell $npc $npc 4042
      if { $now >= ( $timeline + $timediff ) } {
        return $spellid
      }
    }
    ## Return Else
    else { return $spellid }
  }
  set loadinfo "Flying & Landing Boss"//下面应该是说明
  set loadvers "Beta 2.00"
  puts "[clock format [clock seconds] -format %k:%M:%S]:Mloadinfo ($loadvers) - Tha-Doctor"


28

主题

3250

帖子

3262

积分

论坛元老

Rank: 8Rank: 8

积分
3262
QQ
发表于 2008-1-8 21:51:00 | 显示全部楼层

Re:请牛人抬手帮忙下

呵呵,黑龙MM……

5

主题

25

帖子

25

积分

注册会员

Rank: 2

积分
25
 楼主| 发表于 2008-1-9 01:33:00 | 显示全部楼层

Re:请牛人抬手帮忙下

太感谢了啊
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-15 17:16

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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