找回密码
 点一下
查看: 2878|回复: 5

无聊中,说说设定英雄技能CD和宝物CD

[复制链接]
发表于 2008-3-5 01:35:17 | 显示全部楼层 |阅读模式
http://file.sgamer.com/Download/War3/Tools/TP.w3x

可以全局倒退时间的地图下载

具体用途看这里

http://bbs.replays.net/forum/vie ... 64&forumid=2631





英雄技能CD其实是受红狼启发

我的地图中,同常规有24个英雄,96个技能,想要全部随意设定cd,用红狼的方法可是十分糟糕的事情。。

因为很多终极技能cooldown很长 要保证精确的话。。几十个模板是有的。。然后每个技能对应几十个模板。。。oh my god ...

超过4级的技能无法slk而且爆卡。所以我抛弃了技能级别,全部用1级技能(工程升级)来完成设定。

重要的一点是cooldown可以在多层工程升级之间传递。所以我用了2层。

第一批工程升级:对应24个英雄的需要设置的技能 -> 一个标准技能

第二批工程升级:对应标准技能 -> 不同cooldown的模板(用狂暴)

这样就把几十 X 几十的技能数 变成了几十 + 几十

而cooldown在其中是完美传递的



宝物技能:

如果A和B是两个宝物,两者的“CD组”相同,则会共享CD。

具体的方式是,如果使用A,则B转一个A的cooldown。反之使用B则A转B的cooldown。

把对战中有意义的CD组归类一下

1. Spell Shield(Amulet)                ANss
    Amulet of Spell Shield            ANss

2.Dust of Appearance                AItb
    Dust of Appearance            AItb

3.Item Area Detection                AIta
    Crystal Ball                AIta

4.Item Silence                    ANsi
    Staff of Silence            AIse

5.Mass Teleport                    AHmt
    Staff of Teleportation            AImt

6.Item Skeleton Summon                AIfs
    Amulet of the Wild            AIuw
    Book of the Dead            AIfs
    Demonic Figureine            AIfu
    Ice Shard                AIir
    Inferno Stone                AIin
    Red Drake Egg                AIfd
    Spiked Collar                AIfh
    Stone Token                AIfr
    Talisman of the Wild            AIff

7.Item Divine Shield                AHds
    Potion of Divinity            AIdv

8.Item Temporary Invulnerablity            AIvu
    Potion of Invulnerability        AIvu
    Potion of Lesser Invulnerability    AIvl


9.Item Healing                    AIhe
    Health Stone                AIh2
    Potion of Greater Healing        AIh2
    Potion of Healing            AIh1
   
10.Item Mana Regain                AIma
    Mana Stone                AIm2
    Potion of Greater Mana            AIm2
    Potion of Mana                AIm1

11.Item Heal / Mana Regain            AIre
    Potion of Restoration            AIre

12.Item Area Heal / Mana Regain            AIra
    Scroll of Restoration            AIra

13.Item Area Healing                AIha
    Scroll of Healing            AIha

14.Item Temporary Speed Bonus            AIsp
    Scroll of Speed                AIsa

15.Item Anti-Magic Shell            Aami
    Anti-magic Potion            AIxs

16.Lightning Shield (Item)            AIls
    Wand of Lightning Shield        AIls

17.Steal                    Aste
    Wand of Mana Stealing            Aste

18.Change Time of Day                AIct
    Moonstone                AIct

19.Raise Dead (Item)                AIrd
    Rod of Necromancy            AIrd

20.Staff of Sanctuary                ANsa
    Staff of Sanctuary            ANsa

21.Staff of Preservation            ANpr
    Staff of Preservation            ANpr


本质上宝物CD是宝物技能CD,但是并不能通过使用技能来实现

我们需要用共享组模板来设定这个宝物的CD,可是宝物很多,模板也很多,如果相乘也很可怕

这里我用了一个比较偷懒的办法

例如最久的Cd是90秒,如果给予5秒缓冲同步时间,是18个模板技能(建议用一些没有限制条件的宝物技能来做,甚至是通魔)

注意,这18个模板技能是“技能”,他们拥有不同的cd时间。

而宝物模板是有21个,也就是21个宝物(没有限制使用的宝物,任何时候都能按出来并且没有效果)

每个宝物都对应全部18个模板技能。

需要设定时,把对应种类的模板宝物给英雄(例如需要设定保存,就把21号模板宝物给英雄),然后窍门出现了:携带宝物的技能其实也是英雄所拥有的技能。所以删除英雄的18之17个不对应的技能,然后使用宝物。宝物自动被使用掉,这时再拿起原有的宝物,这一组的cooldown就完美设定了,同时也省却了原来几千个模板的可怕性,只需要几十个模板。


//===========================================================================
// Trigger: itemcdinit
//===========================================================================


        function SetTimerReal takes timer whichTimer, string name, real value returns nothing
            local integer tp = TM2I(whichTimer)
            if ( value != 0 ) then
                call StoreReal(udg_GC,"Timer_" + I2S(tp),name,value)
            else
                call FlushStoredReal(udg_GC,"Timer_" + I2S(tp),name)
            endif
        endfunction

        function GetTimerReal takes timer whichTimer, string name returns real
            local integer tp = TM2I(whichTimer)
            return GetStoredReal(udg_GC,"Timer_" + I2S(tp),name)
        endfunction


////////////////////
function CacheItemCdData takes integer ItemSkillId, real CoolDown returns nothing
       call StoreReal(udg_GC,"ItemCoolDownData",I2S(ItemSkillId),CoolDown)
endfunction

function GetItemCdData takes integer ItemSkillId returns real
       return GetStoredReal(udg_GC,"ItemCoolDownData",I2S(ItemSkillId))
endfunction

function GetItemCdSetter takes integer ItemSkillId returns integer

if ItemSkillId == 'ANss' then
return 'I000'
endif
if ItemSkillId == 'AItb' then
return 'I001'
endif
if ItemSkillId == 'AIta' then
return 'I002'
endif
if ItemSkillId == 'AIse' then
return 'I003'
endif
if ItemSkillId == 'AImt' then
return 'I004'
endif
if ItemSkillId == 'AIuw' or ItemSkillId == 'AIfs' or ItemSkillId == 'AIfu' or ItemSkillId == 'AIir' or ItemSkillId == 'AIin' or ItemSkillId == 'AIfd' or ItemSkillId == 'AIfh' or ItemSkillId == 'AIfr' or ItemSkillId == 'AIff' then
return 'I005'
endif
if ItemSkillId == 'AIdv' then
return 'I006'
endif
if ItemSkillId == 'AIvu' or ItemSkillId == 'AIvl' then
return 'I007'
endif
if ItemSkillId == 'AIh2' or ItemSkillId == 'AIh1' then
return 'I008'
endif
if ItemSkillId == 'AIm2' or ItemSkillId == 'AIm1' then
return 'I009'
endif
if ItemSkillId == 'AIre' then
return 'I00A'
endif
if ItemSkillId == 'AIra' then
return 'I00B'
endif
if ItemSkillId == 'AIha' then
return 'I00C'
endif
if ItemSkillId == 'AIsa' then
return 'I00D'
endif
if ItemSkillId == 'AIxs' then
return 'I00E'
endif
if ItemSkillId == 'AIls' then
return 'I00F'
endif
if ItemSkillId == 'Aste' then
return 'I00G'
endif
if ItemSkillId == 'AIct' then
return 'I00H'
endif
if ItemSkillId == 'AIrd' then
return 'I00I'
endif
if ItemSkillId == 'ANsa' then
return 'I00J'
endif
if ItemSkillId == 'ANpr' then
return 'I00K'
endif
       return 0
endfunction
/////////////////////

function DeleteNoNeedItemSkills takes unit u, real r returns nothing
local integer array aId
local integer whichone = R2I(r/5)+1
local integer i = 1

set aId[1]='A0MR'
set aId[2]='A0MS'
set aId[3]='A0MT'
set aId[4]='A0MU'
set aId[5]='A0MV'
set aId[6]='A0MW'
set aId[7]='A0MX'
set aId[8]='A0MY'
set aId[9]='A0MZ'
set aId[10]='A0N0'
set aId[11]='A0N1'
set aId[12]='A0N2'
set aId[13]='A0N3'
set aId[14]='A0N4'
set aId[15]='A0N5'
set aId[16]='A0N6'
set aId[17]='A0N7'
set aId[18]='A0N8'

loop
exitwhen i > 18
if i != whichone then
   call UnitRemoveAbility(u,aId)
endif
set i = i + 1
endloop
endfunction

/////////////////////
function SetUnitItemCooldown_exec takes nothing returns nothing
local unit u = I2U(GetTimerInteger(GetExpiredTimer(),"unit"))
local real cd = GetTimerReal(GetExpiredTimer(),"cd")
local integer itemsample = GetTimerInteger(GetExpiredTimer(),"itemsample")
local item i

set i = UnitAddItemById(u,itemsample)
call DeleteNoNeedItemSkills(u, cd)
call UnitUseItem(u, i)
call DestroyTimerEx(GetExpiredTimer())
set u = null
set i = null
endfunction

/////////////////////
function SetUnitItemCooldown takes unit u, integer abil, real cd returns nothing
local integer itemsample = GetItemCdSetter(abil)
local real converteddelay
local timer delaytimer

set converteddelay = ModuloReal(cd, 5)
set delaytimer = CreateTimer()
call SetTimerInteger(delaytimer,"unit",H2I(u))
call SetTimerInteger(delaytimer,"itemsample",itemsample)
call SetTimerReal(delaytimer,"cd",cd)
call TimerStart(delaytimer, converteddelay, false, function SetUnitItemCooldown_exec)
set delaytimer = null
endfunction



/////////////////////////////////////
function Trig_itemcdinit_Actions takes nothing returns nothing
//宝物 - 技能 - CD
       call CacheItemCdData('ANss',40)
       call CacheItemCdData('AItb',20)
       call CacheItemCdData('AIta',60)
       call CacheItemCdData('AIse',20)
       call CacheItemCdData('AImt',90)
       call CacheItemCdData('AIuw',20)
       call CacheItemCdData('AIfs',20)
       call CacheItemCdData('AIfu',20)
       call CacheItemCdData('AIir',20)
       call CacheItemCdData('AIin',20)
       call CacheItemCdData('AIfd',20)
       call CacheItemCdData('AIfh',20)
       call CacheItemCdData('AIfr',20)
       call CacheItemCdData('AIff',20)
       call CacheItemCdData('AIdv',60)
       call CacheItemCdData('AIvu',45)
       call CacheItemCdData('AIvl',45)
       call CacheItemCdData('AIh2',40)
       call CacheItemCdData('AIh1',20)
       call CacheItemCdData('AIm2',40)
       call CacheItemCdData('AIm1',20)
       call CacheItemCdData('AIre',40)
       call CacheItemCdData('AIra',40)
       call CacheItemCdData('AIha',25)
       call CacheItemCdData('AIsa',60)
       call CacheItemCdData('AIxs',30)
       call CacheItemCdData('AIls',10)
       call CacheItemCdData('Aste',10)
       call CacheItemCdData('AIct',70)
       call CacheItemCdData('AIrd',22)
       call CacheItemCdData('ANsa',45)
       call CacheItemCdData('ANpr',30)

endfunction

//===========================================================================
function InitTrig_itemcdinit takes nothing returns nothing
    set gg_trg_itemcdinit = CreateTrigger(  )
    call TriggerAddAction( gg_trg_itemcdinit, function Trig_itemcdinit_Actions )
endfunction

评分

参与人数 1威望 +2 收起 理由
kook + 2 原创内容

查看全部评分

发表于 2008-3-19 11:27:58 | 显示全部楼层
于是所有号称看不懂的回复都消失了
回复

使用道具 举报

发表于 2008-3-19 23:47:55 | 显示全部楼层
果然是看不懂。这个比较强大。
慢慢研究。。
回复

使用道具 举报

发表于 2008-3-23 06:12:18 | 显示全部楼层
这玩意其实是很强大的
楼主flyingbug的创意和探索精神也是很强大的
但是这属于偏门技术-。-
回复

使用道具 举报

发表于 2008-3-23 06:18:18 | 显示全部楼层
其实也不算太偏。。。不过这个用这个做技能的话,太费事,效果却不够震撼。
回复

使用道具 举报

发表于 2008-3-30 08:17:17 | 显示全部楼层
根本没看完就OVER...厚道的顶一下吧
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 19:05 , Processed in 0.038139 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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