看板 WarCraft 關於我們 聯絡資訊
因為全域變數沒有UnitPool可以選 所以有使用Return Bug將UnitPool轉成Integer存在全域變數 其實還有ItemPool 用法也都差不多 用UnitPool的好處: 隨機選單位的觸發變的很精簡 壞處: 最核心的部份只有jass Return Bug部分的jass如下--------- function H2I takes handle pTarg returns integer return pTarg return 0 endfunction function I2UnitPool takes integer i returns unitpool return i return null endfunction --------------------------------- 建立清單的部份 Custom script: local unitpool up=CreateUnitPool() 這是建立UnitPool Custom script: set udg_UnitPool = H2I(up) 這是利用return bug存進變數 然後就是一堆的 Set SystemIndex = (SystemIndex + 1) Set Units[SystemIndex] = XXXX單位 然後最後跑個loop For each (Integer A) from 1 to SystemIndex, do (Actions) Loop - Actions Custom script: call UnitPoolAddUnitType(up,udg_Units[bj_forLoopAIndex],1) 而最後建立單位的時候非常簡單的 Custom script: call PlaceRandomUnit(I2UnitPool(udg_UnitPool),玩家,X,Y,面向) 我做好的範例圖在流連上 連結:http://forums.wasabistudio.ca/viewtopic.php?f=5&t=18330 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.192.224.249
gonzdevour:看不懂就推。 04/18 14:10
gonzdevour:不太瞭解這跟UnitType陣列的差別說....... 04/18 14:10
readper:其實差不多 主要是多一個他能設定機率 04/18 14:40
readper:範例圖裡面我是都設定機率一樣 04/18 14:47
gonzdevour:喔,瞭解,謝謝。 04/18 21:53
chungsen: 偶喔喔喔喔~~~~~~~ 04/21 21:11
chungsen: /▏      |\ 04/21 21:11
chungsen: ▏\__ __/ ▏ 該推爆了 04/21 21:11
chungsen: \__◢███◣__/ 兄弟們出動啦!!! 04/21 21:11
chungsen: █████▏ 04/21 21:11
chungsen: ▏ ● ●▏ ╴╴╴╴╴╴ 04/21 21:11
chungsen: ▏ > ▏ ◣ ﹨     04/21 21:11
chungsen: ▏ △皿△▏ █◣ ﹨ ██ /▏ 04/21 21:11
chungsen:┌─ ﹨    ╱┐ ██◣ ﹨ ██/ ▏ 04/21 21:11
chungsen:│ ╱  ̄ ̄ ﹨│ ███████▋ █ ( / 04/21 21:11
chungsen:│ ∕ ╲ 蠻∕ ╲ ███████▊ ◢██^^ 04/21 21:11
chungsen:│∕ ╲ ╴╴╲╴ ███████▊◢█◤█ 04/21 21:11
chungsen:│︳ ╲ ╱\\\\ \\\\ ◢████▌ 04/21 21:11
chungsen:│︳ ▄▅▇███▆███████◣ 04/21 21:11