Jump to content
  • 0

Novice potion support npc


joelolopez

Question


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

masters i would like to request a npc that

gives a different kind of potions depending on the character level.

 

level 1~25 red potion

level 26~50 orange potion

level 51~75 yellow potion

level 76 and up white potion

 

but the tricky part is

 

the amount of potions that will be given

will vary on the maximum weight of the character

 

the total weight of the potions should be exact 49%

to avoid 50% weight penalty

 

i hope sir capuche and other master scripters here would help me..

its not that im being lazy, infact i already have my own script but

i cant make it work.. /oops

Edited by joelolopez
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

or like

prontera,150,150,1	script	dfh	56,{
	if (BaseLevel > 100)
		.@item_id = 504;// white potion
	else
		.@item_id = 501 + (BaseLevel -1) / 25;
	if ( ( getiteminfo(.@item_id,6) + Weight ) < ( MaxWeight/2 ) ) {
		.@amount = ( MaxWeight /2 - Weight ) / getiteminfo(.@item_id,6);// 50% maxweight - my weight / item weight
		if ( ( getiteminfo(.@item_id,6) * .@amount + Weight ) >= ( MaxWeight/2 ) )// weight at exactly 50%
			.@amount--;
		getitem .@item_id, .@amount;
	}
	end;
}

Stolao care about the lvl > 100 for 501 + Baselevel / 25

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  


map,x,y,f script Brew Master 123,{

mes "[Brew Master]";

mes "Would you like some potions?";

if(select("Yes:No")==2) close;

while(MaxWeight * 49 /100 > Weight){

getitem,501 + Baselevel / 25,1;

}

close;

}

Edited by Stolao
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

thanks for the both of you masters, but as i scan ur codes i didnt find any

conditions for this

 

level 1~25 red potion

level 26~50 orange potion

level 51~75 yellow potion

level 76 and up white potio

 

and the max weight of the total potions should < 50% so that the character wont get

50% overweight penalty icon

 

but ill try your codes ryt away masters!

 

===========================================================

sir can i request some follow up modification to ur script?

 

can you divide the 49% weight into

 

health potion and the other half is blue potion

Edited by joelolopez
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

prontera,150,150,1	script	dfh	56,{
	if (BaseLevel > 100)
		.@item_id = 504;// white potion
	else
		.@item_id = 501 + (BaseLevel -1) / 25;
	if ( ( 150 + Weight ) < ( MaxWeight/2 ) ) {
		.@weight_healt = getiteminfo(.@item_id,6);
		.@amount_healt = ( MaxWeight /2 - Weight ) / ( 2 *.@weight_healt );
		.@amount_blue = ( MaxWeight /2 - Weight - .@weight_healt * .@amount_healt ) / 150;
		if ( ( .@weight_healt * .@amount_healt + .@amount_blue * 150 + Weight ) >= ( MaxWeight/2 ) )
			.@amount_healt--;
		getitem .@item_id, .@amount_healt;
		getitem 505, .@amount_blue;
	}
	end;
}

the conditions

 

level 1~25 red potion

level 26~50 orange potion

level 51~75 yellow potion

level 76 and up white potion

are in .@item_id = 501 + (BaseLevel -1) / 25;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

prontera,150,150,1	script	dfh	56,{
	if (BaseLevel > 100)
		.@item_id = 504;// white potion
	else
		.@item_id = 501 + (BaseLevel -1) / 25;
	if ( ( 150 + Weight ) < ( MaxWeight/2 ) ) {
		.@weight_healt = getiteminfo(.@item_id,6);
		.@amount_healt = ( MaxWeight /2 - Weight ) / ( 2 *.@weight_healt );
		.@amount_blue = ( MaxWeight /2 - Weight - .@weight_healt * .@amount_healt ) / 150;
		if ( ( .@weight_healt * .@amount_healt + .@amount_blue * 150 + Weight ) >= ( MaxWeight/2 ) )
			.@amount_healt--;
		getitem .@item_id, .@amount_healt;
		getitem 505, .@amount_blue;
	}
	end;
}

the conditions

 

level 1~25 red potion

level 26~50 orange potion

level 51~75 yellow potion

level 76 and up white potion

are in .@item_id = 501 + (BaseLevel -1) / 25;

 

sweetttttttt tnx sir capuche! another dream come true!

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

or like

prontera,150,150,1	script	dfh	56,{
	if (BaseLevel > 100)
		.@item_id = 504;// white potion
	else
		.@item_id = 501 + (BaseLevel -1) / 25;
	if ( ( getiteminfo(.@item_id,6) + Weight ) < ( MaxWeight/2 ) ) {
		.@amount = ( MaxWeight /2 - Weight ) / getiteminfo(.@item_id,6);// 50% maxweight - my weight / item weight
		if ( ( getiteminfo(.@item_id,6) * .@amount + Weight ) >= ( MaxWeight/2 ) )// weight at exactly 50%
			.@amount--;
		getitem .@item_id, .@amount;
	}
	end;
}
Stolao care about the lvl > 100 for 501 + Baselevel / 25

I assumed it was a 99 max server my bad.

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

×
×
  • Create New...