作者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