精華區beta WarCraft 關於我們 聯絡資訊
這個構想是hobill先想到,他用的方式是jass 但他的做法需要自己取得填進去item type 臨時找不到他,所以我整個jass是直接重寫,無法跟他的比較 用法很簡單,把Jass整個貼到觸發器初始區 然後直接在合成的部分設定如下 (也就是說,使用者只需要貼上Jass,然後利用gui介面就可以使用) 如:古爾+古爾=羅 set ItemStuff[0]=羅 set ItemStuff[1]=古爾 set ItemStuff[2]=古爾 Custom script:call DoItemCompose() 重複的物品只需要重複設一次即可,當然event是unit 得到物品 利用到的變數只有一個 ItemStuff[5] as Type of Item 如果合成配方可能會超過5個,自己修改Jass中所有5這個數字及ItemStuff的容量 最後,因為其中一些東西是我的地圖專用變數,所以我貼上來有作修改 可能會有沒刪乾淨或修改完整導致有bug,請加分說一下我再改 使用前在地圖中提到是ItemCompose Jass Powered by gyd會更感激 ======================================================================= Jass部分,斷行部分請自行組合 稍微解說流程 判斷得到的道具是不是合成表內容 -X> 清空ItemStuff內容(a) ↓ 逐一拿出ItemStuff(loop)→如果ItemStuff不是no item type -X> 合成,do a ↓ 計算該合成原料數量 ↓ 計算該合成原料擁有量 ↓ 擁有量超過需要量 -X> 合成條件不足,離開,do a ↓ 繼續做下一個原料 //道具合成函式:DoItemCompose() function ClearItemsArray takes nothing returns nothing //每次合成結束就清空一次原料陣列,這個function總共被呼叫三次,包括合成失敗 set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 5 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd set udg_ItemStuff[GetForLoopIndexA()] = GetItemTypeId(null) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop endfunction function ItemManipulatedCheck takes nothing returns boolean if ( GetItemTypeId(GetManipulatedItem()) == udg_ItemStuff[1] ) then return true endif if ( GetItemTypeId(GetManipulatedItem()) == udg_ItemStuff[2] ) then return true endif if ( GetItemTypeId(GetManipulatedItem()) == udg_ItemStuff[3] ) then return true endif if ( GetItemTypeId(GetManipulatedItem()) == udg_ItemStuff[4] ) then return true endif if ( GetItemTypeId(GetManipulatedItem()) == udg_ItemStuff[5] ) then return true endif return false endfunction function DoItemCompose takes nothing returns nothing // 針對每個原料 if ( not ItemManipulatedCheck() ) then call ClearItemsArray() return else endif set bj_forLoopBIndex = 1 set bj_forLoopBIndexEnd = 5 local integer tempInt = 0 loop exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd // 如果是no-item就離開迴圈 exitwhen udg_ItemStuff[GetForLoopIndexB()] == GetItemTypeId(null) set tempInt = 0 // 計算需要量 set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 5 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if ( udg_ItemStuff[GetForLoopIndexA()] == udg_ItemStuff[GetForLoopIndexB()] ) then set tempInt = ( tempInt + 1 ) else endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop // 計算擁有量 set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) == udg_ItemStuff[GetForLoopIndexB()]) then set tempInt = ( tempInt - 1 ) else endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop // 如果任何一個條件失敗就結束 if ( tempInt > 0 ) then // 結束前清空原料的陣列 call ClearItemsArray() return else endif set bj_forLoopBIndex = bj_forLoopBIndex + 1 endloop set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 5 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call RemoveItem( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), udg_ItemStuff[GetForLoopIndexA()]) ) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop call UnitAddItemByIdSwapped( udg_ItemStuff[0], GetTriggerUnit() ) call AddSpecialEffectTargetUnitBJ( "origin", GetTriggerUnit(), "Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl" ) call DestroyEffectBJ( GetLastCreatedEffectBJ() ) // 結束前清空原料的陣列 call ClearItemsArray() endfunction -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.223.204.171
Kendai:推 05/04 13:55
Ricrollp:看不懂......>< 05/04 13:56
gyd:簡單說就是,把jass放進去,你只需要控制gui就可以合成 05/04 13:58
gyd:物品的check(包括數量),remove,create都自動做好 05/04 14:00
jhunfong:原po有玩暗黑嗎...Lo Gul 05/04 14:01
slycsboy:HOBILL的也跟他討論過XD 這個系統整個簡化 超讚 05/04 14:02
cycu0315:推 05/04 14:02
SvcChaos:push 05/04 15:01
BlueLex:推 05/04 15:13
blackjack0s:想推不能推... 05/04 17:03
wix3000:推 我的地圖有用類似的了,用觸發直接寫會lag 05/04 23:42
wu2183:推 05/06 23:10
※ 編輯: gyd 來自: 218.171.58.70 (05/07 08:46)