五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

一些JAPI的技巧(1)

2022-12-21 16:26 作者:bili_38354167  | 我要投稿

我想分享一下一些我所了解的對(duì)于JAPI的應(yīng)用。

但僅限于YDWE的EX和網(wǎng)易的DZ函數(shù),由于網(wǎng)絡(luò)問(wèn)題和語(yǔ)言問(wèn)題我并不在M16活躍,所以不了解JN相關(guān)函數(shù)的應(yīng)用。


1:設(shè)置技能屬性

大部分人都知道,EX函數(shù)只能設(shè)置一個(gè)技能類別的數(shù)據(jù),更改后所有同類型技能數(shù)據(jù)會(huì)一起更改。

但一些技能有例外,他們不會(huì)立即刷新數(shù)據(jù),而是在添加刪除或更改技能等級(jí)時(shí)更新數(shù)據(jù)。

看一個(gè)例子:


? ? function UnitSetDamageBonus takes unit whichUnit, real newValue returns nothing

? ? ? ? if GetUnitAbilityLevel(whichUnit, 'AIat') <= 0 then

? ? ? ? ? ? call UnitAddAbility(whichUnit, 'AIat')

? ? ? ? endif

? ? ? ? call EXSetAbilityDataReal(EXGetUnitAbility(whichUnit, 'AIat'), 1, ABILITY_DATA_DATA_A, newValue)

? ? ? ? call IncUnitAbilityLevel(whichUnit, 'AIat')

? ? ? ? call DecUnitAbilityLevel(whichUnit, 'AIat')

? ? endfunction


這是一個(gè)設(shè)置單位額外攻擊獎(jiǎng)勵(lì)的函數(shù),'AIat'是一個(gè)攻擊之爪技能。(使用"Ctrl+D"來(lái)查看物體編輯器中的ID,使用"Ctrl+F"來(lái)查找ID)

這樣就可以完成對(duì)一個(gè)單位設(shè)置額外攻擊力,而不影響其他擁有攻擊之爪的單位。

但你無(wú)法得知直接通過(guò)獲取技能數(shù)據(jù)來(lái)得知此單位的額外攻擊,你需要自己儲(chǔ)存他的額外攻擊數(shù)值。


同理可以這樣修改的技能還有:

'AIsx', 'AId1', 'AIms', 'Aamk'....甚至更多


還有一些例外的情況,生命恢復(fù)和法力恢復(fù)。('Arel', 'AIrn')

生命恢復(fù)和法力恢復(fù)技能無(wú)法通過(guò)直接更改等級(jí)來(lái)達(dá)到刷新效果。

他們需要與('AIlf', 'AIbm')這種能夠增加生命值或法力值上限的物品技能來(lái)搭配使用。

看一個(gè)例子:


? ? function UnitSetLifeRegenBonus takes unit whichUnit, real newValue returns nothing

? ? ? ? if GetUnitAbilityLevel(whichUnit, 'Arel') <= 0 then

? ? ? ? ? ? call UnitAddAbility(whichUnit, 'Arel')

? ? ? ? endif

? ? ? ? call EXSetAbilityDataReal(EXGetUnitAbility(whichUnit, 'Arel'), 1, ABILITY_DATA_DATA_A, newValue)

? ? ? ? call IncUnitAbilityLevel(whichUnit, 'Arel')

? ? ? ? call DecUnitAbilityLevel(whichUnit, 'Arel')

? ? ? ? call UnitAddAbility(whichUnit, 'AIlf')

? ? ? ? call UnitRemoveAbility(whichUnit, 'AIlf')

? ? endfunction


這個(gè)設(shè)置生命值恢復(fù)獎(jiǎng)勵(lì)的函數(shù)在改變等級(jí)后,多了一個(gè)添加刪除'AIlf'技能的操作來(lái)讓數(shù)據(jù)刷新。

法力恢復(fù)同理,在更改技能等級(jí)后添加刪除'Albm'技能即可,同樣需要你自行儲(chǔ)存此單位的恢復(fù)獎(jiǎng)勵(lì)數(shù)值。


還有一個(gè)比較特殊的情況,'AIsi'

通過(guò)以下操作,可以永久性的增加或減少一個(gè)單位的視野。


? ? function UnitAddVisualRange takes unit whichUnit, integer value returns nothing

? ? ? ? call UnitAddAbility(whichUnit, 'AIsi' )

? ? ? ? call EXSetAbilityDataReal(EXGetUnitAbility(whichUnit, 'AIsi'), 2, ABILITY_DATA_DATA_A, - value )

? ? ? ? call IncUnitAbilityLevel(whichUnit, 'AIsi')

? ? ? ? call UnitRemoveAbility(whichUnit, 'AIsi' )

? ? endfunction


這些技巧可以用來(lái)取代二進(jìn)制屬性系統(tǒng)。

需要注意的是:這些技能最好自己添加,而不是在物體編輯器中直接給予單位,這樣可能會(huì)導(dǎo)致鏡像單位擁有錯(cuò)誤的數(shù)據(jù)。

對(duì)于鏡像單位,應(yīng)該在鏡像單位產(chǎn)出時(shí)重新同步主體的額外屬性。

2:被動(dòng)技能的冷卻時(shí)間

https://cafe.naver.com/w3umf/133585

有描述設(shè)置被動(dòng)技能冷卻時(shí)間的方法。

但這種方法會(huì)使圖標(biāo)可以點(diǎn)擊,并且對(duì)于幻象單位不顯示圖標(biāo)和冷卻時(shí)間,我自認(rèn)為有更好的方法。

魔獸爭(zhēng)霸3種有3個(gè)被動(dòng)技能模板可以擁有冷卻時(shí)間,'AIll', 'Aexh', 'AOre'。

'AIll'始終使用暗圖標(biāo),這是一個(gè)巨大的缺陷。https://tieba.baidu.com/p/6634712745

'Aexh'在hive有詳細(xì)介紹,https://www.hiveworkshop.com/threads/passive-ability-with-cooldown-best-method.275068/。

'AOre'對(duì)幻象也顯示圖標(biāo)和冷卻時(shí)間,唯一的問(wèn)題就是,如何讓重生失去作用。


native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event


為擁有重生技能的單位注冊(cè)此事件,單位在有重生時(shí)死亡也會(huì)觸發(fā)此事件。

觸發(fā)事件時(shí)禁用重生技能,0秒計(jì)時(shí)器后開(kāi)啟。


一個(gè)例子:


function EnableReincarnationActions takes nothing returns nothing

local timer t = GetExpiredTimer()

local integer h = GetHandleId(t)

local player p = LoadPlayerHandle(HY, h, 1)

if not SPCDB[GetPlayerId(p)] then

call SetPlayerAbilityAvailable(p, 'QP1G', true)

call SetPlayerAbilityAvailable(p, 'A522', true)

call SetPlayerAbilityAvailable(p, 'QP17', true)

call SetPlayerAbilityAvailable(p, 'QP1O', true)

call SetPlayerAbilityAvailable(p, 'A3UF', true)

call SetPlayerAbilityAvailable(p, 'A0CG', true)

endif

call FlushChildHashtable(HY, h)

call DestroyTimer(t)

set t = null

set p = null

endfunction


function DisableReincarnationActions takes nothing returns boolean

local trigger tri = GetTriggeringTrigger()

local timer t = CreateTimer()

local integer tri_h = GetHandleId(tri)

local integer h = GetHandleId(t)

local player p = LoadPlayerHandle(HY, tri_h, 1)

call SetPlayerAbilityAvailable(p, 'QP1G', false)

call SetPlayerAbilityAvailable(p, 'A522', false)

call SetPlayerAbilityAvailable(p, 'QP17', false)

call SetPlayerAbilityAvailable(p, 'QP1O', false)

call SetPlayerAbilityAvailable(p, 'A3UF', false)

call SetPlayerAbilityAvailable(p, 'A0CG', false)


call SavePlayerHandle(HY, h, 1, p)

call TimerStart(t, 0.00, false, function EnableReincarnationActions)

set p = null

set t = null

set tri = null

return false

endfunction


function CreateCheckReincarnationTrig takes unit u returns nothing

local trigger t = CreateTrigger()

local integer h = GetHandleId(t)


call SavePlayerHandle(HY, h, 1, GetOwningPlayer(u))

call TriggerRegisterDeathEvent(t, u)

call TriggerAddCondition(t, Condition(function DisableReincarnationActions))

call SaveTriggerHandle(W, GetHandleId(u),'PACD', t)

set t = null

endfunction

3:?jiǎn)挝活愋蛿?shù)據(jù)


globals

? ? constant integer UNIT_STRING_MODEL_PATH = 13

? ? constant integer UNIT_STRING_MODEL_PORTRAIT_PATH = 14

? ? constant integer UNIT_STRING_SHADOW_PATH = 0x13

? ? constant integer UNIT_REAL_MODEL_SCALE = 0x2c

? ? constant integer UNIT_REAL_SHADOW_X = 0x20

? ? constant integer UNIT_REAL_SHADOW_Y = 0x21

? ? constant integer UNIT_REAL_SHADOW_W = 0x22

? ? constant integer UNIT_REAL_SHADOW_H = 0x23

endglobals


native EXGetUnitString takes integer unitcode, integer Type returns string

native EXSetUnitString takes integer unitcode,integer Type,string value returns boolean

native EXGetUnitReal takes integer unitcode, integer Type returns real

native EXSetUnitReal takes integer unitcode,integer Type,real value returns boolean

native EXGetUnitInteger takes integer unitcode, integer Type returns integer

native EXSetUnitInteger takes integer unitcode,integer Type,integer value returns boolean

native EXGetUnitArrayString takes integer unitcode, integer Type,integer index returns string


一些數(shù)據(jù)需要在設(shè)置后使用變身刷新數(shù)據(jù),或者在創(chuàng)建單位之前來(lái)修改這些值。


4:lua引擎


https://github.com/actboy168/jass2lua/blob/master/lua-engine.md


我并不怎么了解LUA,我只能分享一些簡(jiǎn)單的與JASS的應(yīng)用。


LUA引擎中有很多獨(dú)特的功能,通過(guò)hook庫(kù)的功能讓JASS可以調(diào)用它們。


native EXExecuteScript takes string script returns string

EXExecuteScript此函數(shù)也可以在JASS與LUA引擎交互。


示例:


local message = require 'jass.message'

local globals = require 'jass.globals'

local hook = require "jass.hook"


function hook.GetStartLocPrioSlot(x,y)

? ? local ability, order= message.button(x, y)

? ? globals.MessageAbilityOrder = order

? ? return ability

end


function hook.GetDetectedUnit()

? ? local u = message.selection()

? ? if not u then

? ? ? ? return nil

? ? end? ??

? ? return u

end


GetStartLocPrioSlot 只在config中使用,在正常游戲時(shí)沒(méi)有作用。

GetDetectedUnit 什么也不干,我不知道他有什么作用。

這2個(gè)函數(shù)都是我用不到的,所以hook來(lái)與LUA交互。

GetStartLocPrioSlot 現(xiàn)在會(huì)返回當(dāng)前玩家控制臺(tái)指定坐標(biāo)的技能Id和命令。

GetDetectedUnit 現(xiàn)在會(huì)返回玩家當(dāng)前所選擇的第一個(gè)單位。

必須要注意的是:這些值全都是異步的,如果需要在同步環(huán)境下使用,請(qǐng)使用DzSyncData。

鏈接:https://pan.baidu.com/s/1kqwznNIcu7TT5pc0uymdmA?pwd=5vfy?

提取碼:5vfy


我之前的DoubleClickSpell系統(tǒng)就是通過(guò)LUA引擎來(lái)實(shí)現(xiàn)的。

https://cafe.naver.com/w3umf/133875


japi庫(kù):require 'jass.japi'

包含了所有EX和DZ的JAPI函數(shù),由于JNLoader沒(méi)有向LUA引擎注入JN函數(shù),所以LUA無(wú)法使用JN函數(shù)。

進(jìn)入此地圖可以查看當(dāng)前環(huán)境下JAPI庫(kù)中的所有函數(shù)。

鏈接:https://pan.baidu.com/s/1hWOblnVf3HUNjYPuhlWanw?pwd=mqq2?

提取碼:mqq2


一些JAPI的技巧(1)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
乐都县| 马公市| 永泰县| 惠水县| 尚义县| 长子县| 临邑县| 高邮市| 潼南县| 独山县| 平南县| 博罗县| 海兴县| 龙海市| 固阳县| 德江县| 合肥市| 平邑县| 萍乡市| 观塘区| 绩溪县| 延边| 平安县| 淮南市| 南阳市| 沾化县| 洪湖市| 田林县| 抚顺市| 勐海县| 颍上县| 都兰县| 苗栗县| 兴国县| 惠安县| 罗江县| 博湖县| 拜泉县| 禹城市| 肥东县| 曲沃县|