Jump to content
  • 0

help Dedicated NPC


GM Takumirai

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

im just wondering how to make it a 1 npc but all players can rent that npc.. its to waste of space if we duplicate the npc..


//Author Goddameit
//Version 2012/11/23
//Web http://bit.ly/MDuQ9F
- script DedicatedNPCMain -1,{
set .@type,atoi(strnpcinfo(2));
if( getd(".n_"+.@type+"_status") == 0 )
{
for(set .@i,1;.@i<=.amount;set .@i,.@i+1)
if( getd(".n_"+.@i+"_master") == getcharid(3) )
{
end;
}
mes "Hi, will you hire me?";
select("Yes");
set .@type,atoi(strnpcinfo(2));
setd ".n_"+.@type+"_status",1;
setd ".n_"+.@type+"_master",getcharid(3);
setd ".n_"+.@type+"_time",10;
setd ".n_"+.@type+"_name$",strcharinfo(0);
getmapxy(getd(".n_"+.@type+"_origin_map$"),getd(".n_"+.@type+"_origin_x"),getd(".n_"+.@type+"_origin_y"),1,strnpcinfo(0));
initnpctimer;
close;
}else
{
set .@type,atoi(strnpcinfo(2));
if( getd(".n_"+.@type+"_master") == getcharid(3) )
{
mes "Hi, any problem?";
switch(select("Storage","Repair all","Dismissal"))
{
case 1:
openstorage;
close;
case 2:
repairall;
close;
case 3:
callsub OnEndd;
close;
}
}else
{
end;
}
}
end;
OnPCLogoutevent:
callsub OnEndd;
end;
OnEndd:
set .@type,atoi(strnpcinfo(2));
if(getd(".n_"+.@type+"_origin_map$")!="")
unitwarp getd(".n_"+.@type+"_unit_id"),getd(".n_"+.@type+"_origin_map$"),getd(".n_"+.@type+"_origin_x"),getd(".n_"+.@type+"_origin_y");
if(isloggedin(getd(".n_"+.@type+"_master")))
message getd(".n_"+.@type+"_name$"),strnpcinfo(1)+" : See you!";
stopnpctimer;
setd ".n_"+.@type+"_status",0;
setd ".n_"+.@type+"_tmp_time",0;
setd ".n_"+.@type+"_master",0;
setd ".n_"+.@type+"_time",0;
setd ".n_"+.@type+"_name$","";
setd ".n_"+.@type+"_master_map$","";
setd ".n_"+.@type+"_master_x",0;
setd ".n_"+.@type+"_master_y",0;
setd ".n_"+.@type+"_npc_map$","";
setd ".n_"+.@type+"_npc_x",0;
setd ".n_"+.@type+"_npc_y",0;
return;
OnTimer1000:
{
set .@type,atoi(strnpcinfo(2));
for(;isloggedin(getd(".n_"+.@type+"_master"))
{
set .@type,atoi(strnpcinfo(2));
set .@aid,getd(".n_"+.@type+"_master");
if(attachrid(.@aid))
{
getmapxy(getd(".n_"+.@type+"_master_map$"),getd(".n_"+.@type+"_master_x"),getd(".n_"+.@type+"_master_y"),0);
getmapxy(getd(".n_"+.@type+"_npc_map$"),getd(".n_"+.@type+"_npc_x"),getd(".n_"+.@type+"_npc_y"),1,strnpcinfo(0));
if(maxhp/hp>=4)
{
percentheal 15,15;
specialeffect2 312;
}
if(getd(".n_"+.@type+"_tmp_time") == 0)
{
sc_start SC_BLESSING,60000,10;
specialeffect2 42;

sc_start SC_INCREASEAGI,60000,10;
specialeffect2 37;

sc_start SC_IMPOSITIO,60000,10;
specialeffect2 84;

sc_start SC_MAGNIFICAT,60000,10;
specialeffect2 76;

sc_start SC_GLORIA,60000,10;
specialeffect2 75;

sc_start SC_SUFFRAGIUM,60000,10;
specialeffect2 88;

sc_start SC_ASSUMPTIO,60000,10;
specialeffect2 375;
}
set .@tmp_time,getd(".n_"+.@type+"_tmp_time");
setd ".n_"+.@type+"_tmp_time",.@tmp_time+1;
if( .@tmp_time >= 59 )
setd ".n_"+.@type+"_tmp_time",0;
}
detachrid; 
if(!isloggedin(.@aid))
{
callsub OnEndd;
break;
}
set .@map$,getd(".n_"+.@type+"_master_map$");
set .@x,getd(".n_"+.@type+"_master_x");
set .@y,getd(".n_"+.@type+"_master_y");
set .@uid,getd(".n_"+.@type+"_unit_id");
if(distance(getd(".n_"+.@type+"_npc_x"),getd(".n_"+.@type+"_npc_y"),.@x,.@y)>=8||.@map$!=getd(".n_"+.@type+"_npc_map$"))
unitwarp .@uid,.@map$,.@x,.@y;
else
unitwalk .@uid,.@x+rand(-3,3),.@y+rand(-3,3);
setd ".n_"+.@type+"_time",getd(".n_"+.@type+"_time")-1;
if( getd(".n_"+.@type+"_time") <= 0 )
{
callsub OnEndd;
break;
}
sleep2 1000;
}
}
callsub OnEndd;
end;
OnInit:
setd ".n_"+atoi(strnpcinfo(2))+"_unit_id",getnpcid(0);
set .amount,.amount+1;
end;
}
prontera,155,180,4 duplicate(DedicatedNPCMain) Dedicated Poring 1#1 1002
prontera,157,180,4 duplicate(DedicatedNPCMain) Dedicated Poring 2#2 1002
prontera,159,180,4 duplicate(DedicatedNPCMain) Dedicated Poring 3#3 1002

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

i dont think you can create 1 NPC and ask the only 1 NPC to follow more than 1 player.. O.O

common sense.. how 1 NPC can follow more than 1 player at the same time ??

the answer still the same... you have to duplicate / clone the npc ...

a suggestion for you ....

in the NPC folder... there are ALOT npc that are not used....remove all of them...and then create those duplicated npc for rent by player..

and i belive you dont need much .... 50 ~ 100 should be enough for your server ......else... improve your server specs....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

if you don't need those npc functions (storage,repairall...)

you can use ''summon'' to spawn mob which you can set AI to give you buff

and I'm sure it will be very easy.

(100% based on script and db)

Edited by goddameit
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...