作者justinj (黑旋风)
看板mud_sanc
标题[wizs] 指令模拟
时间Sun May 1 17:50:46 2011
写一个teleport的指令模拟,本来要改自gps这个内容的写法
但整合不起来...amem
以下是程式内容.....
------------------------------------------------------
inherit OBJECT;
void create()
{
seteuid(getuid(this_object()));
set("short","传送模拟器");
set("long",@LONG
传送teleport
LONG) ;
set("id",({"machine"}));
set("mass",1);
set("unit","颗");
}
void init()
{
add_action("teleport","teleport");
}
int move_env(object env)
{
write("你使用了传送能力传送到这里来了!!\n");
this_player()->move_to(env);
return 1;
}
int map_function(string env_name,int max,string dir,int len)//max最大长度
{
object env;
mapping exits;
if(catch(env=find_object_or_load(env_name))) return notify_fail("传送错误!!
\n");
if( random(max)<len || !exits=env->query("exits"))//没有出口时不再继续,长度越
长越难传送
{
move_env(env);
return 1;
}
if(random(10) && env_name=exits[dir]) //九成选你所选的方向传送
{
map_function(env_name,max,dir,len+1);
return 1;
}
map_function(values(exits)[random(sizeof(exits))],max,dir,len+1);
return 1;
}
int teleport(string str)
{
object ob,ppl=this_player(),env;
if(!str||str=="") return notify_fail(@J
指令
teleport [玩家A]:传送到[玩家A]附近(可能差几格)
teleport [怪物B]:传送到[玩家A]附近(可能差几格)
teleport [方向]:传送往所选的方向n格(n从1~20,不可控制)
J);
if(ob=find_player(str))
{
if(!env=environment(ob)) return notify_fail("你要传送的玩家处在虚空中哦!!
\n");
if(ppl->query_temp("time_record/teleport")>time())
return notify_fail("你要休息一下才能传送哦!!\n");
ppl->set_temp("time_record/teleport",time()+30);
map_function(base_name(env),3,"none",0);
return 1;
}
if(ob=find_living(str))
{
if(!env=environment(ob)) return notify_fail("你要传送的怪物处在虚空中哦!!
\n");
if(ppl->query_temp("time_record/teleport")>time())
return notify_fail("你要休息一下才能传送哦!!\n");
ppl->set_temp("time_record/teleport",time()+30);
map_function(base_name(env),3,"none",0);
return 1;
}
if(!env=environment(ppl)) return notify_fail("你处在虚空中哦!!\n");
if(ppl->query_temp("time_record/teleport")>time())
return notify_fail("你要休息一下才能传送哦!!\n");
ppl->set_temp("time_record/teleport",time()+30);
map_function(base_name(env),20,str,0);
return 1;
}
---------------------------------------------------------------
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.129.142.183