找回密码
 点一下
查看: 8981|回复: 0

[Izualizm]让电脑控制的英雄自动学习技能

  [复制链接]
发表于 2006-4-3 08:32:34 | 显示全部楼层 |阅读模式
Melee里的英雄会学习技能, 但是custom里似乎不会. 用Hero - Learn Skill又无法学习自定义技能, 也无法和英雄目前的等级对应起来..

这个办法需要你先制定几种不同的学习顺序, 再在trigger编辑器里创建一个技能数组, 我这里叫ab_iSkills, 下面代码橙色部分可以换成自己的, 棕色是注释, 整个函数必须粘贴到trigger编辑器最上面的 xxx.w3x 里.
[trigger]
function IzualizmSkills takes nothing returns nothing
// 把自定义的4种技能存入变量, A005是终极技能, 6级后才能学到
// A00x这些是技能ID~~
local integer BaQiSi = 'A002'
local integer TJJTDS = 'A003'
local integer WeiSuoAura = 'A001'
local integer BTwave = 'A005'

// 两种顺序各50%几率
if ( ( GetRandomInt(1, 100) > 50 ) ) then
// ------------------------------------------------------------------------
// 顺序1
set udg_ab_iSkills[ 1] = BaQiSi
set udg_ab_iSkills[ 2] = TJJTDS
set udg_ab_iSkills[ 3] = BaQiSi
set udg_ab_iSkills[ 4] = WeiSuoAura
set udg_ab_iSkills[ 5] = BaQiSi
set udg_ab_iSkills[ 6] = BTwave
set udg_ab_iSkills[ 7] = TJJTDS
set udg_ab_iSkills[ 8] = TJJTDS
set udg_ab_iSkills[ 9] = WeiSuoAura
set udg_ab_iSkills[10] = WeiSuoAura
else
// 顺序2
set udg_ab_iSkills[ 1] = BaQiSi
set udg_ab_iSkills[ 2] = WeiSuoAura
set udg_ab_iSkills[ 3] = BaQiSi
set udg_ab_iSkills[ 4] = TJJTDS
set udg_ab_iSkills[ 5] = BaQiSi
set udg_ab_iSkills[ 6] = BTwave
set udg_ab_iSkills[ 7] = TJJTDS
set udg_ab_iSkills[ 8] = TJJTDS
set udg_ab_iSkills[ 9] = WeiSuoAura
set udg_ab_iSkills[10] = WeiSuoAura
endif
endfunction
[/trigger]
一级的英雄有1点技能, 所以做个trigger对应一级英雄 (我这里的事件是当玩家雇佣了英雄时)
[trigger]
Events
Unit - A unit owned by Neutral Passive Sells a unit
Conditions
(Unit-type of (Sold unit)) Equal to Izualizm
(Unspent skill points of (GetSoldUnit())) Greater than or equal to 1
Actions
Custom script: local integer abFirstTemp
Custom script: local integer abFirstTempIndex = GetHeroLevel(GetSoldUnit()) - GetHeroSkillPoints(GetSoldUnit())
Custom script: set bj_forLoopAIndex = 1
Custom script: set bj_forLoopAIndexEnd = GetHeroSkillPoints(GetSoldUnit())
Custom script: call IzualizmSkills()
Custom script: loop
Custom script: exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
Custom script: set abFirstTemp = udg_ab_iSkills[abFirstTempIndex + GetForLoopIndexA()]
Custom script: set bj_forLoopAIndex = bj_forLoopAIndex + 1
Custom script: endloop
[/trigger]
上面这句等价于
[trigger]
Events
Unit - A unit owned by Neutral Passive Sells a unit
Conditions
(Unit-type of (Sold unit)) Equal to Izualizm
(Unspent skill points of (Sold unit)) Greater than or equal to 1
Actions
For each (Integer A) from 1 to (Unspent skill points of (Sold unit)), do (Actions)
Loop - Actions
Hero - Learn skill for (Sold unit): ab_iSkills[ ( Hero Level of (Sold unit) - (Unspent skill points of (Sold unit)) ) + IntegerA]
[/trigger]
平时(1级以后)就用这个trigger
[trigger]
Events
Unit - A unit owned by Player 1 (Red) Gains a level
Conditions
(Unit-Type of (Leveling Hero)) Equal to Izualizm
(Unspent skill points of (Leveling Hero)) Greater than or equal to 1
Actions
Custom script: local integer abTemp
Custom script: local integer abTempIndex = GetHeroLevel(GetLevelingUnit()) - GetHeroSkillPoints(GetLevelingUnit())
Custom script: set bj_forLoopAIndex = 1
Custom script: set bj_forLoopAIndexEnd = GetHeroSkillPoints(GetLevelingUnit())
Custom script: loop
Custom script: exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
Custom script: set abTemp = udg_ab_iSkills[abTempIndex + GetForLoopIndexA()]
Custom script: set bj_forLoopAIndex = bj_forLoopAIndex + 1
Custom script: endloop
[/trigger]
等价于
[trigger]
Events
Unit - A unit owned by Player 1 (Red) Gains a level
Conditions
(Unit-type of (Leveling Hero)) Equal to Izualizm
(Unspent skill points of (Leveling Hero)) Greater than or equal to 1
Actions
For each (Integer A) from 1 to (Unspent skill points of (Leveling Hero)), do (Actions)
Loop - Actions
Hero - Learn skill for (Leveling Hero): ab_iSkills[ ( Hero Level of (Leveling Hero) - (Unspent skill points of (Leveling Hero)) ) + IntegerA]
[/trigger]

评分

参与人数 1威望 +6 收起 理由
alexries + 6

查看全部评分

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

本版积分规则

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

GMT+8, 2024-5-5 04:10 , Processed in 0.510220 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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