Jump to content

Dedicated NPC [v.3]


Recommended Posts

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  90
  • Reputation:   5
  • Joined:  06/17/12
  • Last Seen:  

Great Job master GOD! I want to use this on my server. :D question, is there a way to change the npc so it will not be followed by homunculus? XD Thanks and hope that this script wil get even better /no1

Is there a way to duplicate them without affecting the other when a player logged off?? Because For example, I have 3 duplicates of the dedi npc, the other player logout, the two other duplicates will also reset to its position without masters. :D Thanks

Edited by cataclysmro
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:  

Great Job master GOD! I want to use this on my server. :D question, is there a way to change the npc so it will not be followed by homunculus? XD Thanks and hope that this script wil get even better /no1

Is there a way to duplicate them without affecting the other when a player logged off?? Because For example, I have 3 duplicates of the dedi npc, the other player logout, the two other duplicates will also reset to its position without masters. :D Thanks

in my test, it already will not affect other master.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  90
  • Reputation:   5
  • Joined:  06/17/12
  • Last Seen:  

:( So maybe there's something wrong here master goddameit. I added the map array.

//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?";
 next;
 mes "If you die or log off, you'll have to hire me again.";
 select("Yes");
 set .@type,atoi(strnpcinfo(2));
 setd ".n_"+.@type+"_status",1;
 setd ".n_"+.@type+"_master",getcharid(3);
 setd ".n_"+.@type+"_time",3599;
 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));
   for( .@i = 0; .@i < getarraysize( .maps$ ); .@i++ )
   if( getd(".n_"+.@type+"_master_map$") == .maps$[.@i] ){
   callsub onendd;
   break;
   }
   if(maxhp/hp>=4)
   {
   percentheal 80,80;
   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;
  }
  if( getd(".n_"+.@type+"_master_map$") == ".@maps" )
  {
   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;
setarray .maps$, "pvp_y_8-2", "pvp_y_8-1";
end;
}
prontera,147,173,4 duplicate(DedicatedNPCMain) Slave#1 1611
prontera,147,171,4 duplicate(DedicatedNPCMain) Slave#2 1611
prontera,147,169,4 duplicate(DedicatedNPCMain) Slave#3 1611

Thank you. /thx

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:  

research it by yourself.

or you can delete this script.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  90
  • Reputation:   5
  • Joined:  06/17/12
  • Last Seen:  

research it by yourself.

or you can delete this script.

:( That's not so friendly. But i wont delete the script and thanks for this great script anyways. :D

Im still your fan! /no1

I removed the

OnPCLogoutevent:
callsub OnEndd;
end;

And now it's working great! :D Even without that, logging off or whn the character dies, the npc will be reset and warp back to its position

Edited by KoolKat29
Link to comment
Share on other sites

  • 5 weeks later...

  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

i got an error.

im using 3ecam.

how to fix it ?

[Error]:  Loading NPC file: npc/custom/myscript/dedicated_npc.txt
script error on npc/custom/myscript/dedicated_npc.txt line 139
   parse_line: need ';'
  134 :			    }
  135 :	    }
  136 :	    callsub OnEndd;
  137 :	    end;
  138 : OnInit:
*  139 :	    setd ".n_"+atoi(strnpcinfo(2))+"_unit_id",getnpcid'('0);
  140 :	    set .amount,.amount+1;
  141 :	    end;
  142 : }
  143 :

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:  

i got an error.

im using 3ecam.

how to fix it ?

this is rA script command ''getnpcid''

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

i got an error.

im using 3ecam.

how to fix it ?

this is rA script command ''getnpcid''

so i cant use it on 3ecam ? :(

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:  

so i cant use it on 3ecam ? :(

you can add by yourself

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

thanks God... i just put an setarray

where to set in. can u show me .. noobies :(

Link to comment
Share on other sites


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

put this code


set .@type,atoi(strnpcinfo(2));
attachrid(getd(".n_"+.@type+"_master"));
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));
{

for( .@i = 0; .@i < getarraysize( .map$ ); .@i++ )
if( getd(".n_"+.@type+"_master_map$") == .map$[.@i] ){
callsub onendd;
break;
}

put this in the lower part.

OnInit:
setd ".n_"+atoi(strnpcinfo(2))+"_unit_id",getnpcid(0);
set .amount,.amount+1;
setarray .map$,
"guild_vs1","0",
"guild_vs2","1",
"guild_vs3","2",
"guild_vs4","3",
"guild_vs5","4",
"06guild_01","5",
"06guild_02","6";
end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

Good Job i love your work /no1 .... by the way is there's a way that you are hiring an NPC which will fight along side with you like a which have there own hp mercenaries and they have the ability to use differend ataking skill to a monster..

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   1
  • Joined:  01/20/13
  • Last Seen:  

Hi . I do not understand how to change type , not poring > i wont sword wish

how to change?

thanks



when a player diee  NPC  is buggy

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  126
  • Reputation:   4
  • Joined:  10/31/12
  • Last Seen:  

how to make NPC rent into 10min???

Super Like Script! 

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:  

how to make NPC rent into 10min???

Super Like Script! 

 

search ''Time Set :'' in #1

Link to comment
Share on other sites


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

- problem :

when the player die. the dedicated npc stay there and don't follow anymore..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  126
  • Reputation:   4
  • Joined:  10/31/12
  • Last Seen:  

yes

i try to config like this setd ".n_"+.@type+"_time",10;

but not working wen i click the poring after a sec NPC say see you!

dump

 

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:  

- problem :

when the player die. the dedicated npc stay there and don't follow anymore..

fixed

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

i saw a script just like this please give credits to the owner.

Link to comment
Share on other sites

  • 5 months later...

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

upload new version

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   48
  • Joined:  07/23/13
  • Last Seen:  

After click "dismissal" npc stayed at current location, this make other player hard to find the npc.

*Suggestion: 

 

Change:

 

if(!.npc_status[.@i])
continue;
 
To:
 
if(!.npc_status[.@i])
{Endd(.@i);continue;}
Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  07/07/14
  • Last Seen:  

I really like your work sir but I think you can make it better. I noticed that when using the heal functionality the npc stops following the character after death and becomes stuck to its last position even if you dismiss it. And even if npc is dismissed, you also still can't hire a new clone since it too seem stuck. Below are some of my observations....

 

if(MaxHp/Hp>=2)
{
percentheal 10,0;
specialeffect2 312;
}
 
 
 
set getvariableofnpc(.npc_hprecover[@id_use],"DedicatedNPCTimer"),2;  ----> Why must this be set higher than hprecover_delay? Setting it to too high or same as hprecover_delay causes the same error.
 
 

//NPC follows and respawns successfully but no heal

if(.npc_hprecover[.@i]>=.hprecover_delay)
.hprecover_delay = 1;
.npc_hprecover[.@i] = 0;
 
 

//NPC heals but stops following after you die and stuck after dismiss

if(.npc_hprecover[.@i]>=.hprecover_delay)
.hprecover_delay = 1; 
.npc_hprecover[.@i] = 1 or more;
 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  86
  • Topics Per Day:  0.02
  • Content Count:  591
  • Reputation:   146
  • Joined:  06/19/12
  • Last Seen:  

you can make the npc random walk on the map ? all duplicate walking radmon on maps and th player must search the Porings for Support 

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
Reply to this topic...

×   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...