• 0
Sign in to follow this  
dolphincute

Request Rental NPC

Question

Hello and good day, its been years since the last time i had my hand down on ragnarok, got me back on it since the new mobile version released,

back to topic, i would really thankful for anyone who would take their precious time to help me create a certain npc:

Details:

///////////////////////////////////////////////////////////////////////

                                 Rental NPC

/////////////////////////////////////////////////////////////////////

Descriptions :

1. Player could rent healer NPC, but require poring coin ( we call him owner after this ) for let say a week?

2. Owner can set the zeny price for that healer NPC service for other player, and each time any  player use that healer service, all zeny charged  will be stored, while owner can withdraw the  accumulated zeny at any time

3. This Healer NPC also had other buffs, but need to be unlocked, here some example:

         Tier 1 : 1 Poring Coin Needed unlock full heal HP and SP

         Tier 2 : 2 Poring Coin Needed unlock Agi and Bless +10

         Tier 3 : 3 Poring Coin Needed unlock what ever  

and carry on more buffs..

//////////////////////////////////////////////////////////////////////

 

Thanks for your time and your efforts,

you could read from here to get some idea of it :  Click Me

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hope it works.

//===== rAthena Script =======================================
//= Healer
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= Basic healer script.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.1 Aligned coordinates with @go.
//============================================================

-	script	Healer	-1,{

	[email protected] = 0;	// Heal delay, in seconds

	setarray [email protected][0], 7539, 10;

	if ( $healer_rent <= gettimetick(2) && countitem([email protected][0]) >= [email protected][1]) {
		message strcharinfo(0), "Do you want to rent this NPC? Price: "[email protected][1]+" "+getitemname([email protected][0])+".";
		if ( select("No:Yes") == 2 ) {
			if (countitem([email protected][0]) >= [email protected][1]) {
				delitem [email protected][0], [email protected][1];
				$healer_zeny = 0;
				$healer_price = 0;
				$healer_rent = gettimetick(2) + 7 * 24 * 60 * 60;
				$healer_id = getcharid(3);
			}
		}
	} else if ( $healer_rent > gettimetick(2) && getcharid(3) == $healer_id ) {
		message strcharinfo(0),"Rent time left: "+Time2Str($healer_rent)+".";
		message strcharinfo(0),"Zeny avaiaible: "+F_InsertComma($healer_zeny)+".";
		switch(select("Continue:Set cost:"+(($healer_zeny)? "Withdraw zeny" : ""))) {
		case 2:
			input $healer_price;
			break;
		case 3:
			if($healer_zeny) {
				message strcharinfo(0), F_InsertComma($healer_zeny)+" received.";
				Zeny += $healer_zeny;
				$healer_zeny = 0;
			} else {
				message strcharinfo(0),"There isn't any zeny.";
			}
			break;
		}
	}
	if(countitem([email protected][0])) {
		message strcharinfo(0),"Currency: "+getitemname([email protected][0])+".";
		for([email protected] = 1;.item_amt[[email protected]] > 0;[email protected]++) {
			[email protected] = .index[[email protected] - 1];
			if(!(#healer_unlock & 1 << ([email protected] - 1)))
				[email protected]$+= "Unlock "+.buff_name$[[email protected]]+" ("+.item_amt[[email protected]]+")";
			[email protected]$+= ":";
		}
		[email protected] = select([email protected]$);
		if(countitem([email protected][0] >= .item_amt[[email protected]]) {
			#healer_unlock^= (1 << ([email protected] - 1))
	}
	if (@HD > gettimetick(2))
		end;
	if ($healer_price) {
		message strcharinfo(0), "Healing costs " + F_InsertComma($healer_price) + " Zeny.";
		if (Zeny < $healer_price)
			end;
		if (select("^0055FFHeal^000000:^777777Cancel^000000") == 2)
			end;
		if(Zeny < $healer_price)
			end;
		Zeny -= $healer_price;
		$healer_zeny += $healer_price;
	}
	specialeffect2 EF_HEAL2;
	percentheal 100,100;
	if(#healer_unlock) {
		for([email protected] = 1;.item_amt[[email protected]] > 0;[email protected]++) {
			if(#healer_unlock & (1 << ([email protected] - 1))) {
				[email protected] = .buff_index[[email protected] - 1];
				[email protected] = .buff_index[[email protected]];
				for([email protected] = [email protected];[email protected] <= [email protected];[email protected]++)
					sc_start .buff_id[[email protected]],240000,.buff_lv[[email protected]];
			}
		}
	}
	if ([email protected])
		@HD = gettimetick(2) + [email protected];
	end;

OnInit:

	[email protected]$ = strnpcinfo(2);
	if([email protected]$ != "") {
		// add_buff(<item amount>,"name",<buff>,<lvl>{,<buff>,<lvl>});
		add_buff(1,"Agi and Blessing",SC_INCREASEAGI,10,SC_BLESSING,10);
		//add_buff(2,...);

		.buff_id = 0;
		.total_buffs = 0;
	}
	end;

	function	add_buff	{

		.buff_name$[++.buff_id] = getarg(1);
		.item_amt[.buff_id] = getarg(0);
		[email protected] = getargcount();
		for([email protected] = 2;[email protected] < [email protected];[email protected]+= 2) {
			.buff_id[[email protected] + .total_buffs - 2] = getarg([email protected]);
			.buff_lv[[email protected] + .total_buffs - 2] = getarg([email protected] + 1);
		}
		.total_buffs+= (([email protected]/2) - 1);
		.buff_index[.buff_id] = .total_buffs;

	}
}


// Duplicates
//============================================================
alberta,25,240,6	duplicate(Healer)	Healer#alb	909
aldebaran,135,118,6	duplicate(Healer)	Healer#alde	909
amatsu,200,79,4	duplicate(Healer)	Healer#ama	909
ayothaya,207,169,6	duplicate(Healer)	Healer#ayo	909
comodo,184,158,6	duplicate(Healer)	Healer#com	909
einbech,57,36,6	duplicate(Healer)	Healer#einbe	909
einbroch,57,202,6	duplicate(Healer)	Healer#einbr	909
geffen,115,72,6	duplicate(Healer)	Healer#gef	909
gonryun,156,122,6	duplicate(Healer)	Healer#gon	909
hugel,89,150,6	duplicate(Healer)	Healer#hug	909
izlude,121,150,6	duplicate(Healer)	Healer#izl	909	//Pre-RE: (125,118)
jawaii,250,139,4	duplicate(Healer)	Healer#jaw	909
lighthalzen,152,100,6	duplicate(Healer)	Healer#lhz	909
louyang,226,103,4	duplicate(Healer)	Healer#lou	909
manuk,272,144,6	duplicate(Healer)	Healer#man	909
mid_camp,203,289,6	duplicate(Healer)	Healer#mid	909
moc_ruins,72,164,4	duplicate(Healer)	Healer#moc	909
morocc,153,97,6	duplicate(Healer)	Healer#mor	909
moscovia,220,191,4	duplicate(Healer)	Healer#mos	909
niflheim,212,182,5	duplicate(Healer)	Healer#nif	909
payon,179,106,4	duplicate(Healer)	Healer#pay	909
prontera,162,193,4	duplicate(Healer)	Healer#prt	909
rachel,125,116,6	duplicate(Healer)	Healer#rac	909
splendide,201,153,4	duplicate(Healer)	Healer#spl	909
thor_camp,249,74,4	duplicate(Healer)	Healer#thor	909
umbala,105,148,3	duplicate(Healer)	Healer#umb	909
veins,217,121,4	duplicate(Healer)	Healer#ve	909
xmas,143,136,4	duplicate(Healer)	Healer#xmas	909
yuno,164,45,4	duplicate(Healer)	Healer#yuno	909

// Duplicates (Renewal)
//============================================================
brasilis,194,221,6	duplicate(Healer)	Healer#bra	909
dewata,195,187,4	duplicate(Healer)	Healer#dew	909
dicastes01,201,194,4	duplicate(Healer)	Healer#dic	909
ecl_in01,45,60,4	duplicate(Healer)	Healer#ecl	909
malangdo,132,114,6	duplicate(Healer)	Healer#mal	909
malaya,227,204,6	duplicate(Healer)	Healer#ma	909
mora,55,152,4	duplicate(Healer)	Healer#mora	909

 

Edited by n0tttt
  • Love 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this