Jump to content
  • 0

Requesting a restock npc


Question

Posted

Does anyone know how to make a script that auto restock potion once you click the healer for example you set it to 500 Cold Medicine 10 Halo Halo.

Everytime you talk to the healer, The healer will automatically restock your cold medicine and halo halo to 10 pcs.

Thanks.

8 answers to this question

Recommended Posts

Posted

prontera,159,184,5	script	kjhfksjdfhs	100,{

percentheal 100,100;

if ( countitem( "Cold_Medicine" ) < 500 ) {

.@count = 500 - countitem( "Cold_Medicine" );

if ( checkweight( "Cold_Medicine", .@count ) )

getitem "Cold_Medicine", .@count;

}

if ( countitem( "Halohalo" ) < 10 ) {

.@count = 10 - countitem( "Halohalo" );

if ( checkweight( "Halohalo", .@count ) )

getitem "Halohalo", .@count;

}

end;

}

500 cold medicines is quite heavy ...
Posted
prontera,159,184,5	script	kjhfksjdfhs	100,{
	percentheal 100,100;
	if ( countitem( "Cold_Medicine" ) < @cold_medecine ) {
		.@count = @cold_medecine - countitem( "Cold_Medicine" );
		if ( checkweight( "Cold_Medicine", .@count ) )
			getitem "Cold_Medicine", .@count;
	}
	if ( countitem( "Halohalo" ) < @haloh ) {
		.@count = @haloh - countitem( "Halohalo" );
		if ( checkweight( "Halohalo", .@count ) )
			getitem "Halohalo", .@count;
	}
	end;
OnWhisperGlobal:
	mes "how many cold medecine?";
	input @cold_medecine, 0,500;
	mes "how many halo";
	input @haloh, 0,10;
	close;
}

whisper the npc to set the amount

Posted (edited)

I rather change the healing into OnTouch, and the setting into normal npc message

I'm having fun complicating this script

[paste=5dtzwyernzn1]

somehow it seems like ..

if ( sscanf( potion_restock$, "%d#%d", .@a, .@b ) < 2 )

doesn't work if the potion_restock$ is an emptry string ..

-> reported -> http://rathena.org/board/tracker/issue-8562-

Edited by AnnieRuru
Posted

then how do you want to make the settings so the players can adjust the number of potions they want to bring ?

or do you mean only the GM can set, players can only click on it ?

yeah ... making this more complicated

[paste=6iuyh744gw92]

Posted

that's no fun at all ...

prontera,159,184,5	script	kjhfksjdfhs	100,{
	if ( ( .@count = .cold_medicine - countitem( "Cold_Medicine" ) ) > 0 ) {
		if ( checkweight( "Cold_Medicine", .@count ) )
			getitem "Cold_Medicine", .@count;
		else
			dispbottom "You can't carry enough Cold Medicine";
	}
	if ( ( .@count = .halohalo - countitem( "Halohalo" ) ) > 0 ) {
		if ( checkweight( "Halohalo", .@count ) )
			getitem "Halohalo", .@count;
		else
			dispbottom "You can't carry enough Halohalo";
	}
	end;
OnInit:
	.cold_medicine = 500;
	.halohalo = 10;
}

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