[摳頂] 副本系統

作者: laechan (揮淚斬馬雲)   2014-02-21 08:35:47
#define INSTANCE_ROOM
static mixed files=({});
static mapping instance_area=([]);
int product_instance(object ppl)
{
string f,names;
object room,ob;
names=ppl->query("name");
instance_room[names]=([]);
foreach(f in files)
{
if(!file_exists(f+".c"))
{
write("副本產生失敗!\n");
return 1;
}
else if(catch(room=find_object_or_load(f)))
{
write("副本產生失敗!\n");
return 1;
}
ob=clone_object(INSTANCE_ROOM);
ob->set("short",room->query("short"));
ob->set("long",room->query("long"));
ob->set("exits",room->query("exits"));
ob->set("objects",room->query("objects"));
ob->reset();
instance_room[names][f]=ob;
}
write("副本產生中......\n");
call_out("enter_instance",2,ppl,names);
return 1;
}
int enter_instance(object ppl)
{
object ob;
if(!ppl)
{
clean_instance(ppl,names);
return 1;
}
ob=instance_room[names][files[0]];
ppl->move_player(ob,"SNEAK");
ob->start_count_time(ppl);
return 1;
}
========================================================
這個副本系統是比之前更單純的東西,如上所見,它的核心只有
幾行,加上一些擴充的東西應該 200 行以內也可以搞定,精華
主要寫在 INSTANCE_ROOM 裡頭。結合 quest 的話就類似底下的
表現..
> quest ooo about xxx
某人: 好的, 現在就送你到OO之地, 請跟那裡的神官對話!
副本產生中....
+ 羅德斯大教堂 +
你現在位於本地最負盛名的教堂裡,這個教堂已經有相當久的歷
史了,看起來大概有一、二百年的時間,牆上的繪畫已經開始剝
落了,已經快看不出來在畫些什麼了,但依稀可見到的是,天神
創造這個世界的情況。目前這個教堂由幾個牧師來管理,幫忙人
們辦理結婚大事。你可以打(help marriage)來獲得訊息。
明顯出口有: north.
Lv200.教堂神官-尤尼(Yuuni)
>
這東西不會很難寫,而且它也支援組隊過副本、多人副本、腳本
架構等,甚至玩家也有能力寫,因為它的腳本架構還蠻簡單的。
不過這東西我現在沒啥動力寫(給我一些動力吧!!),可以確定的
是這東西一定會出現在聖殿。
Laechan

Links booklink

Contact Us: admin [ a t ] ucptt.com