Jump to content

Question

Posted

I would like to get help:

Good day this is about the code for npc that gives you monster to support you like a Priest. This is the code:
 

prontera,119,162,3	script	Hired Help	56,{
//Dialogue
	if(@hired){ mes .npcn$; mes "It Looks like you two are having fun. Well don't let me stop you- carry on!"; close; }
	mes .npcn$; mes "Hello, would you be interested in purchasing some of my lovely ladies?";
	mes "They buff you, heal you, and even revive you!!";
	mes "So what do you say, huh?"; next;
	if(select("Yes:No")&2) { mes .npcn$; mes "You're missing out!"; close; }
	mes .npcn$; mes "It's 1z per-second with these beautiful gals."; input(.@time);
	if(.@time>Zeny||.@time<=0) { mes .npcn$; mes "You don't have enough. That's just too bad. Oh well better luck next time."; close; }
	close2;
//End

//Working parts
	set .@gid,bg_monster(.@bgid,.npcm$,.npcx,.npcy,"[Hired Help] "+.hhnm$[rand(1,getarraysize(.hhnm$))],.mobid,"Hired Help::OnBroken");
	set @hired,1; set Zeny,Zeny-.@time;
	set .@usrid, getcharid(3);
	set .@map$,strcharinfo(3);
	while( set(.@i,.@i+1)&&playerattached()&&.@i<=.@time*20 ) {
		sleep2 1;
		if(!playerattached()) break;
		if((.@i%(.btym*20))==1) {
			while(.buffs[((set(.@i,.@i+2)-2)%(.btym*20))]) {
				unitskilluseid .@gid,.buffs[((.@i%(.btym*20))-2)],.buffs[(((.@i%(.btym*20))+1)-2)],.@usrid;
				sleep2 1000;
			}
			sc_start 32,240000,10,.@gid;
		}
		getmapxy(.@map1$,.@x1,.@y1,BL_PC);
		set .@dis, sqrt(pow(.@x1-.@tmpx,2 )+pow(.@y1-.@tmpy,2 ) );
		if(.@dis&&.@dis<.wlkd){ unitwalk .@gid,.@tmpx,.@tmpy; .@lstx=.@tmpx; .@lsty=.@tmpy;}
		else if(.@dis>=.wlkd) unitwarp .@gid,.@map1$,.@x1,.@y1;
		else unitwalk .@gid,.@lstx,.@lsty;
		if(!(.@i%5)){ .@tmpm$=.@map1$;.@tmpx=.@x1;.@tmpy=.@y1; }
		if(.@map1$!=.@map$) {
			set .@map$, strcharinfo(3);
			unitwarp .@gid,.@map1$,.@x1,.@y1;
		}
		if(!Hp) unitskilluseid .@gid,54,4,.@usrid;
		if(Hp*100<MaxHp*.hpat) unitskilluseid .@gid,28,99,.@usrid;
	}
	killmonster .@map1$,"Hired Help::OnBroken";
	if(playerattached()) set @hired,0;
	end;
//End

OnBroken:
	end;

//NPC Variables
	OnInit:
		set .hpat, 70; //Heals the player when HP drops below this percent. You want this below 100 at all times.
		set .mobid,1626; //ID of your custom mob.
		set .btym, 240; //Rebuff in seconds.
		set .wlkd, 6; //Character speed before mobs warps to him.
		set .npcn$,"[^0000FFGreg^000000]";
		getmapxy( .npcm$,.npcx,.npcy,BL_NPC );
		setarray .buffs[1], 29, 10, 34, 10; // Skill_id, Skill_lv, Etc.
		setarray .hhnm$[1], "Ellsie", "Jenny", "Ashley", "Meghan", "Wenndy", "Anna"; //Hired npc will be randomly named from these values.
}

This code is not mine and it's from this link:

https://rathena.org/board/topic/84503-hire-npc/

It works the first half that it summons the monster but console is prompting that the monster can't unitwalk and makes the monster just stuck with the NPC. I would like to change the bg_monster part and just make it summon so players won't attack it and fixed the unitwalk.

3 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, Louis T Steinhil said:

Found a different way. SOLVED

Could you post your solution, please?
I'm interested in this! 😄

  • 0
Posted

I used summon script commands then made a dedicated mob that buffs. so basically not much coding for unitwalk and unitwarp since i turned on the slave warp to master on battle/monster.conf

 

// Should slaves teleport back to their master if they get too far during chase? (Note 1)
// Default (Official): no
slave_stick_with_master: yes

 

 

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.

  • Recently Browsing   0 members

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