看板 mud_sanc 關於我們 聯絡資訊
副本系統已加入 instance_map2data 及 instance_virtual 的設定, 以 /std/new_ob/instance/laechan/002.c 為例 // instance_map2data 參數 instance_map2data=@LONG 001-002 006-007-009 | | | 003-004-005 008 LONG ; // 我讓每一個以虛擬基底區域產生的房間的 short 及 long 共通 // 不共通的設定再於 instance_data 設定即可 instance_comm=([ "short":"[副本]黑熊小徑", "long":"一條雜草叢生的小徑,在這裡不時會聽到黑熊的低吼聲。\n\n", ]); // 每一個副本房間的額外設定 // 例如我設定最後一格 "009.c" 的 short 不同,以及要做心跳判斷 instance_data=([ "009":([ "short":"[副本]黑熊小徑盡頭", "instance_check":1, ]), ]); // 要使用虛擬基底區域時可以這樣給 // 1.我設定讓它使用 /std/ob/room.c 即 ROOM // wiz 可視自己的需要決定要讓它使用哪個房間 // 2.instance_paths 也很簡單,也可以給 /x/x/xxx 這種完全不存在的 // 它的唯一條件就是不能存在 /x/x/xxx/001.c, /x/x/xxx/002.c // 一旦存在 oroom 就會指向這些房間,而非虛擬房間 instance_paths="/std/ob/"; instance_virtual="/std/ob/room"; instance_ob=base_name(this_object()); // 固定 // 只要有 instance_virtual 底下的東西就變成「虛擬房間檔名」 // 也就是實際上不存在 instance_paths+"001.c", "002.c", ... instance_files=({ "001","002","003","004","005","006","007","008","009" }); 「變動地圖」的部份,create_instance() 裡面有一段 if(function_exists("instance_map2data",this_object())) instance_map2data=this_object()->instance_map2data(ppl_name,usr); 它這意思就是說,我在 /std/new_ob/instance/laechan/002.c 可 以這樣寫 // 假設這個副本有兩張地圖 static mixed maps=({ @LONG 001-002 006-007-009 | | | 003-004-005 008 LONG , @LONG 001-002-003-004 | 006-005 | 007-008-009 LONG , }); int instance_map2data(string ppl_name,mixed usr) { instance_map2data=maps[random(sizeof(maps))]; return 1; } 這樣「每一次的 create_instance」,它都會經由 instance_map2data函數 去更動 instance_map2data字串,達到每次都是隨機地圖。 wiz 可自行 more /std/new_ob/instance/laechan/002.c 及 create 它來 觀看執行結果。 最後提一下 instance_virtual 這個參數,理論上因為 iroom 是使用 INSTANCE_ROOM,所以 instance_virtual 不管給什麼好像都沒差,但 實際上可以做到有差: if(undefinedp(idata["short"])) { if(idata["short"]=="query_short") idata["short"]="[副本]"+oroom->query_short(tmp3); else idata["short"]="[副本]"+oroom->query("short"); } if(undefinedp(idata["long"])) { if(idata["long"]=="query_long") idata["long"]="[副本]"+oroom->query_long(tmp3); else idata["long"]=oroom->query("long"); } 這樣該副本的 short 及 long 就可以寫在 instance_virtual 房間 內,例如該房間的 query_short 函數可以這樣寫 string query_short(string tmp3) { if(tmp3=="009") return "黑熊小徑盡頭"; return "黑熊小徑"; } 當 instance_virtual 所指向的房間有這樣寫時,instance_data就 可以減少設定欄,不過它的缺點是 wiz 無法透過只 more 002.c 來 看到設定的全貌,所以我是傾向不要在 instance_virtual 裡面設 ,讓 instance_virtual 也固定呼叫 /std/ob/room.c,然後把該設 定的東西全集中到 002.c 裡面。 這個我再評估,下午會決定。 Laechan -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.61.157.53 ※ 文章網址: http://www.ptt.cc/bbs/mud_sanc/M.1398048354.A.FEE.html