找回密码
 点一下
查看: 2752|回复: 4

如何查看DOTA中英雄技能的代码

  [复制链接]
发表于 2008-12-9 16:18:36 | 显示全部楼层 |阅读模式
比如要查看

发表于 2008-12-9 16:35:50 | 显示全部楼层
方法1:通过英雄
dota的j代码里技能事件注册是通过选英雄时判断英雄的附加值(points)来的,那么首先就是要找到这个英雄,得到其附加值
找到英雄的方法么我用的一般有两种。第一种是通过那些txt,找到英雄的名字或者称谓,得到单位类型id,注意因为一些文本需要,英雄名字可能出现多次,不过真正的英雄只有1个(也有可能多些,因为有变身),那么注意了,英雄id的第一个字母是大写的;第二种是通过unitui.slk,通过模型来找英雄,对于同模型的单位辨别方法和上面一样。通过这些基本能很快地找到英雄的id,然后到unitdata.slk里,通过这个英雄id得到这个英雄的附加值,就是points这一栏,比如说10,然后去j代码里搜索==10,下面的几个就是这个英雄的技能的注册函数,具体是哪一个的话就稍微看看代码,觉得像的就是了
方法2:通过技能
首先通过txt找到你要的技能id,然后将这个id转化为数字,这个转换方法很多帖子里都有,演示也不少,就是和单位id、物品id转数字一样的方法,自己去搜索下看看,然后通过这个数字去找技能,因为dota的j代码里技能id都是直接转为数字的。不过这个方法我基本没有用过,不知道可行性有多高
回复

使用道具 举报

发表于 2008-12-9 16:44:36 | 显示全部楼层
[jass]
function CatchCastingActions takes nothing returns nothing
    local player localplayer = GetLocalPlayer()
    local unit localunit = GetTriggerUnit()
    local integer spell
    local string str
    if(GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT)then
        set str = "使用了"
        set spell = GetSpellAbilityId()
    else
        set str = "学习了"
        set spell = GetLearnedSkill()
    endif
    call DisplayTimedTextToPlayer(localplayer,0,0,1,GetPlayerName(GetTriggerPlayer()) + "的" + GetUnitName(localunit) + str + GetObjectName(spell) + "(" + I2S(spell) + ")")
    set localunit = null
endfunction

function AddInitialize takes nothing returns nothing
        local trigger CatchCasting=CreateTrigger()
    local integer index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(CatchCasting,Player(index),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        call TriggerRegisterPlayerUnitEvent(CatchCasting,Player(index),EVENT_PLAYER_HERO_SKILL,null)
        set index = index + 1
        exitwhen index >= bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition(CatchCasting,Condition(function CatchCastingActions))
endfunction
[/jass]
再在main函数最后添加call AddInitialize()
回复

使用道具 举报

发表于 2008-12-9 17:05:48 | 显示全部楼层
hmmm………………
很好奇ls为什么要发这段代码呢??(正在做DCD Project,智商下降中)
回复

使用道具 举报

发表于 2008-12-12 15:20:34 | 显示全部楼层
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-7-21 12:16 , Processed in 0.071370 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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