Jump to content

Recommended Posts

  • 2 weeks later...
Posted (edited)

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
Posted

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
Posted

:( 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

Posted (edited)

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
  • 5 weeks later...
Posted

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 :

  • 1 month later...
Posted

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;
}

Posted

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

  • 3 weeks later...
  • 2 weeks later...
  • 4 months later...
  • 5 months later...
  • 3 weeks later...
Posted

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;}
  • 3 weeks later...
  • 4 months later...
Posted

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;
 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...