作者loveFantasy (幻滅月之死)
看板mud
標題Re: [問題] 問一個編輯mud時遇到的問題
時間Mon Oct 17 00:09:29 2011
不好意思又挖墳來請教這個問題
在ES2lib中
/std/char.c 中這段為了節省系統消耗而停心跳的code
if( ((cnd_flag & CND_NO_HEAL_UP) || !heal_up())
&& !is_fighting()
&& !interactive(this_object())) {
if( environment() ) {
ob = first_inventory(environment());
while(ob && !interactive(ob))
ob = next_inventory(ob);
}
if( !ob ) set_heart_beat(0);
}
目前好像只有戰鬥 (/std/attack.c) 會再次啟動心跳
但是有些設了 chat_chance 和 chat_msg 的NPC想讓他在有玩家進入這個區域,他心跳
又是關掉的情況重新開他的心跳。
我一開始以為在 /feature/move.c 裡面寫判斷就好,不過發現xxx->set_heart_beat(1)
這種寫法是沒有用的,所以上來請問要怎麼達成..
另外又請問如果關心跳那行判定裡,對所有有chat_chance屬性的npc永遠不關心跳大概負
擔是多嚴重? 我知道這樣可以work但是對於對系統消耗的差異沒有一個概念..
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.90.34
1F:→ laechan:在該 npc 裡頭設 void init() 函數去觸發如何? 10/17 00:14
2F:→ laechan:不然你也可以試試用 ::set_heart_beat(1); 10/17 00:18
3F:→ loveFantasy:我試試 先感謝 10/17 00:24
4F:→ loveFantasy:其實對個別npc可以直接寫個flag讓他不會被關掉 10/17 00:38
5F:→ loveFantasy:還是想不到怎麼寫出move會開心跳的寫法 10/17 00:38
6F:推 justinj:如果好幾個玩家同時進進出出不就當了嗎...(一下子關一下開 10/17 08:51
7F:→ justinj:要聽誰的?)....amem 10/17 08:53
8F:→ loveFantasy:僅在心跳時這格沒有玩家才會關心跳阿 10/17 11:24
9F:→ loveFantasy:所以不可能發生系統同時要他關和開心跳的狀況 10/17 11:24
10F:→ laechan:無法 xxx->set_heart_beat 有可能是因為在 npc file 裡頭 10/17 12:06
11F:→ laechan:set_heart_beat 被使用 nomask 宣告的緣故你可以檢查看看 10/17 12:06
12F:→ laechan:再不然就是你的 npc 沒有 seteuid 10/17 12:07
13F:→ laechan:void set_heart_beat(int i){efun::set_heart_beat(i);} 10/17 12:08
14F:→ laechan:上面是聖殿使用的宣告方式, 在 /std/monster.c 10/17 12:08
15F:→ loveFantasy:是 int set_heart_beat( int flag ); 10/17 12:15
16F:→ loveFantasy:於是在feature那個資料夾底下新寫了一個function去 10/17 12:17
17F:→ loveFantasy:set_heart_beat就解決問題了..不過還是搞不懂為什麼 10/17 12:17
18F:→ laechan:嘛,可能有限定 set_heart_beat 必須寫在物件內呼叫吧? 10/17 17:08