[wizs] ass 的修改

看板mud_sanc (Sanctuary - 聖殿)作者 (小太保)時間16年前 (2009/09/29 11:56), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
假設底下為 ass 檔 inherit MONSTER; int die(object ppl) { object horse=this_object(); int trust; trust=count_trust(ppl,horse); // 所以需要再新增這個函數 if(replace_to_horse(horse,ppl->query("name"),trust)) return 1; ::die(); return 1; } 由上面的模擬修改可知... 一、需要再新增 count_trust 函數,或者讓 trust 的初始值均   為固定值(這個也可行,則所有 horse_data 資料都是固定值   ,方便載入) 二、replace_to_horse 若設定預設訊息,則所有座騎的馴服都將   follow 同一訊息;若要自訂訊息,則 destruct(horse)的動   作必須挪出 replace_to_horse 之外,容易產生 bug。   這部份我還要再評估。 三、在上述撰寫原則下,若 count_trust 函數有了,但是在執行 replace_to_horse 失敗時(return 0),將執行怪物原先的 die。 因此,以 /d/crazy/3/mob/horse3.c 為例... int die(object ppl) { string msg,msgs; object horse=this_object(); // 在這一個區塊加入上述判斷式如下... //===================================================== int trust; trust=count_trust(ppl,horse); // 所以需要再新增這個函數 if(replace_to_horse(horse,ppl->query("name"),trust)) return 1; //===================================================== // 然後若 replace_to_horse 傳回 0 就執行原先的自訂 die // 也就是用自訂 clone/remove 的方式叫出 HORSE msg=HIW+"\n荒野草原的王者$O"+HIW+"被$N"+HIW+"打敗後, 歸順了$N"+HIW+"!\n\n"+NOR; msgs=msg; msgs=substr(msgs,"$N","你"); msgs=substr(msgs,"$O",query("chi_name")); write(msgs); msgs=msg; msgs=substr(msgs,"$N",this_player()->query("chi_name")); msgs=substr(msgs,"$O",query("chi_name")); shout(msgs); horse=clone_object(CM"horse4"); horse->move(environment(this_object())); remove(); return 1; } LAechan -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.170.120.118
文章代碼(AID): #1AmOLzkR (mud_sanc)
文章代碼(AID): #1AmOLzkR (mud_sanc)