Jump to content
  • 0

Potion Brewer Bulk Input Not Working Sort Of


kalabasa

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

Greetings! i got this script added some edit myself Bulk input was working but the output is only applied once for example input 100 Bulk and the process only do once instead of 100 either sucess or failed and also how to show to the npc to display what current brew level the player is and the current exp needed to unlock the next brewLvl and lastly how to change the brewchance i know where it located but i dont know how to read exactly the formula or what is coded right here.

//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================


//Change coordinates
prontera,144,180,3	script	Brewho	46,{

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
mes "Empty Bottle"; //Change to what requirements you want to use
mes "Alcohol";
mes "Yggdrasil Berry^000000";
mes "Also, a talent fee of 100,000z!";
menu "I've got them master brewer!",-;
next;
input .@quantity;
next;
if(countitem(713) < .@quantity || countitem(970) < .@quantity || countitem(607) < .@quantity || Zeny < 100000) goto Lnenough; //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
delitem 713,.@quantity;
delitem 970,.@quantity;
delitem 607,.@quantity;
set Zeny,Zeny-100000;
if(BrewLvl == 0)  { set @brewchance,rand(1,5); //10% chance to brew on Lvl 0
	if(@brewchance == 3) {
	misceffect 305;
	set BrewExp,BrewExp+1;
	getnameditem 607,strcharinfo(0); //Change Item ID, Must match the potion to be made!
	goto Lsuccess;
	}
	else {
	misceffect 306;
	goto Lfail;
	}
}
else if(BrewLvl == 1)  { set @brewchance,rand(1,4); //25% chance to brew on Lvl 1
	if(@brewchance == 3) {
	misceffect 305;
	set BrewExp,BrewExp+1;
	getnameditem 607,strcharinfo(0); //Change Item ID, Must match the potion to be made!
	goto Lsuccess;
	}
	else {
	misceffect 306;
	goto Lfail;
	}
}
else if(BrewLvl == 2)  { set @brewchance,rand(1,3); //33.33% chance to brew on Lvl 2
	if(@brewchance == 3) {
	misceffect 305;
	set BrewExp,BrewExp+1;
	getnameditem 607,strcharinfo(0); //Change Item ID, Must match the potion to be made!
	goto Lsuccess;
	}
	else {
	misceffect 306;
	goto Lfail;
	}
}
else if(BrewLvl == 3)  { set @brewchance,rand(1,2); //50% chance to brew on Lvl 3
	if(@brewchance == 2) {
	misceffect 305;
	//if(BrewExp < 10000)
	set BrewExp,BrewExp+1;
	getnameditem 607,strcharinfo(0); //Change Item ID, Must match the potion to be made!
	goto Lsuccess;
	}
	else {
	misceffect 306;
	goto Lfail;
	}
}

Lsuccess:
next;
mes "[^0000FF Brewho ^000000]";
mes "Congratulations! You've succeeded!";
if(BrewExp < 10000) dispbottom "You've gained 1 Brewing Exp.";
if(BrewExp == 1000) { set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewExp == 5000) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewExp == 10000) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
}
close;

Lfail:
next;
mes "[^0000FF Brewho ^000000]";
mes "Oh.. You've failed.. Brew with me again next time!";
close;



Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;


}

 

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

I did a few modifications... read the comments and if you have any doubt please tell me:

//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================

//Just for fun... don´t know if it will work!
function	script	int__	{
.@i = getstrlen( .@str$ = getarg(0) ) -3;
.@is_negative = charat( .@str$, 0 ) == "-";
while ( .@i > .@is_negative ) {
	.@str$ = insertchar( .@str$, ",", .@i );
	.@i -= 3;
}
return .@str$;
}

//Change coordinates
prontera,144,180,3	script	Brewho	46,{

//Configuration, items and zenys:
//Change to what requirements you want to use
set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).
//set .@itemq[0],1,3,1; //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){mes ""+getitemname(.@item[.@i])+" x"+.@itemq[.@i]+"";}else{mes ""+getitemname(.@item[.@i])+"";}}
mes "^000000"; 
mes "Also, a talent fee of "+int__(.@zeny)+" z!";
menu "I've got them master brewer!",-;
next;
input .@quantity;
next;
//Checking requirements
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){if(countitem(.@item[.@i]) < (.@quantity*.@itemq[.@i])){goto Lnenough;}}else{if(countitem(.@item[.@i]) < .@quantity){goto Lnenough;}}}
if(Zeny < .@zeny) goto Lnenough; //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
//Deleting the items!
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){delitem .@item[.@i],(.@itemq[.@i]*.@quantity));}else{delitem .@item[.@i],.@quantity;}}
set Zeny,Zeny-.@zeny;
//Lets goooo with the chances
if(BrewLvl == 0){set @brewchance,rand(1,5);}
if(BrewLvl == 1){set @brewchance,rand(1,4);}
if(BrewLvl == 2){set @brewchance,rand(1,3);}
if(BrewLvl == 3){set @brewchance,rand(1,2);}
for( .@i = 0; .@i < .@quantity; .@i++ ){
    if(@brewchance == 1) {
        misceffect 305;
        set BrewExp,BrewExp+1;
        getnameditem .@result,strcharinfo(0); //Change Item ID, Must match the potion to be made!
        set .@ok,.@ok+1;
        //goto Lsuccess;
	}
	else {
        misceffect 306;
        set .@ko,.@ko+1;
        //goto Lfail;
	}
    
}

//Now let´s see the results
next;
mes "[^0000FF Brewho ^000000]";
//mes "Congratulations! You've succeeded!";
mes "Well, well... let me see.";
mes "You succeeded "+.@ok+" time/s and failed "+.@ko+" time/s.";
if(BrewExp < 10000){dispbottom "You've gained "+.@ok+" Brewing Exp.";}
if(BrewLvl == 0 && BrewExp > 999){ set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewLvl == 1 && BrewExp > 4999) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewLvl == 2 && BrewExp > 9999) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
set BrewExp,0; //Comment this if u don´t wanna clean up this var for the player (max lvl so exp not needed)
}
close;

Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;

}

Now should be easier to configure and use ? I did not test it so... maybe have a few errors ?.

PD: Sorry for the typos I was in a hurry xD

Edited by caos51
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

On 1/5/2021 at 5:51 PM, caos51 said:

I did a few modifications... read the comments and if you have any doubt please tell me:


//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================

//Just for fun... don´t know if it will work!
function	script	int__	{
.@i = getstrlen( .@str$ = getarg(0) ) -3;
.@is_negative = charat( .@str$, 0 ) == "-";
while ( .@i > .@is_negative ) {
	.@str$ = insertchar( .@str$, ",", .@i );
	.@i -= 3;
}
return .@str$;
}

//Change coordinates
prontera,144,180,3	script	Brewho	46,{

//Configuration, items and zenys:
//Change to what requirements you want to use
set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).
//set .@itemq[0],1,3,1; //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){mes ""+getitemname(.@item[.@i])+" x"+.@itemq[.@i]+"";}else{mes ""+getitemname(.@item[.@i])+"";}}
mes "^000000"; 
mes "Also, a talent fee of "+int__(.@zeny)+" z!";
menu "I've got them master brewer!",-;
next;
input .@quantity;
next;
//Checking requirements
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){if(countitem(.@item[.@i]) < (.@quantity*.@itemq[.@i])){goto Lnenough;}}else{if(countitem(.@item[.@i]) < .@quantity){goto Lnenough;}}}
if(Zeny < .@zeny) goto Lnenough; //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
//Deleting the items!
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){delitem .@item[.@i],(.@itemq[.@i]*.@quantity));}else{delitem .@item[.@i],.@quantity;}}
set Zeny,Zeny-.@zeny;
//Lets goooo with the chances
if(BrewLvl == 0){set @brewchance,rand(1,5);}
if(BrewLvl == 1){set @brewchance,rand(1,4);}
if(BrewLvl == 2){set @brewchance,rand(1,3);}
if(BrewLvl == 3){set @brewchance,rand(1,2);}
for( .@i = 0; .@i < .@quantity; .@i++ ){
    if(@brewchance == 1) {
        misceffect 305;
        set BrewExp,BrewExp+1;
        getnameditem .@result,strcharinfo(0); //Change Item ID, Must match the potion to be made!
        set .@ok,.@ok+1;
        //goto Lsuccess;
	}
	else {
        misceffect 306;
        set .@ko,.@ko+1;
        //goto Lfail;
	}
    
}

//Now let´s see the results
next;
mes "[^0000FF Brewho ^000000]";
//mes "Congratulations! You've succeeded!";
mes "Well, well... let me see.";
mes "You succeeded "+.@ok+" time/s and failed "+.@ko+" time/s.";
if(BrewExp < 10000){dispbottom "You've gained "+.@ok+" Brewing Exp.";}
if(BrewLvl == 0 && BrewExp > 999){ set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewLvl == 1 && BrewExp > 4999) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewLvl == 2 && BrewExp > 9999) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
set BrewExp,0; //Comment this if u don´t wanna clean up this var for the player (max lvl so exp not needed)
}
close;

Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;

}

Now should be easier to configure and use ? I did not test it so... maybe have a few errors ?.

PD: Sorry for the typos I was in a hurry xD

sorry i just check this post atm i test itt out and give results thanks

 

Okay i finally got it working phew. 

1. If Entered no value it will still proceed and does not consume/delete requirements

2. When higher value entered sometimes the npc will stuck and dialog will not close

3. The success chance is not mixed for example if entered value is 100 all of them will fail vice versa

4. if brewing failed it will gained brewing exp +1 instead of 0

5. if possible i need 3 requirements not 1 ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

Ok, here´s a corrected version should fix pretty much all but the second one (maybe it´s some emulator cap? wich number get stuck?)

//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================

//Just for fun... don´t know if it will work!
function	script	int__	{
.@i = getstrlen( .@str$ = getarg(0) ) -3;
.@is_negative = charat( .@str$, 0 ) == "-";
while ( .@i > .@is_negative ) {
	.@str$ = insertchar( .@str$, ",", .@i );
	.@i -= 3;
}
return .@str$;
}

//Change coordinates
prontera,144,180,3	script	Brewho	46,{

//Configuration, items and zenys:
//Change to what requirements you want to use
set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).
//set .@itemq[0],1,3,1; //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){mes ""+getitemname(.@item[.@i])+" x"+.@itemq[.@i]+"";}else{mes ""+getitemname(.@item[.@i])+"";}}
mes "^000000"; 
mes "Also, a talent fee of "+int__(.@zeny)+" z!";
menu "I've got them master brewer!",-;
next;
input .@quantity;
next;
if(.@quantity < 1){goto Lnenough;}
//Checking requirements
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){if(countitem(.@item[.@i]) < (.@quantity*.@itemq[.@i])){goto Lnenough;}}else{if(countitem(.@item[.@i]) < .@quantity){goto Lnenough;}}}
if(Zeny < .@zeny){goto Lnenough;} //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
//Deleting the items!
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){delitem .@item[.@i],(.@itemq[.@i]*.@quantity));}else{delitem .@item[.@i],.@quantity;}}
set Zeny,Zeny-.@zeny;
for( .@i = 0; .@i < .@quantity; .@i++ ){
    //Lets goooo with the chances
    if(BrewLvl == 0){set @brewchance,rand(1,5);}
    if(BrewLvl == 1){set @brewchance,rand(1,4);}
    if(BrewLvl == 2){set @brewchance,rand(1,3);}
    if(BrewLvl == 3){set @brewchance,rand(1,2);}

    if(@brewchance == 1) {
        misceffect 305;
        set BrewExp,BrewExp+1;
        getnameditem .@result,strcharinfo(0); //Change Item ID, Must match the potion to be made!
        set .@ok,.@ok+1;
        //goto Lsuccess;
	} else {
        misceffect 306;
        set .@ko,.@ko+1;
        //goto Lfail;
	}
    
}

//Now let´s see the results
next;
mes "[^0000FF Brewho ^000000]";
//mes "Congratulations! You've succeeded!";
mes "Well, well... let me see.";
mes "You succeeded "+.@ok+" time/s and failed "+.@ko+" time/s.";
if(BrewExp < 10000){dispbottom "You've gained "+.@ok+" Brewing Exp.";}
if(BrewLvl == 0 && BrewExp > 999){ set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewLvl == 1 && BrewExp > 4999) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewLvl == 2 && BrewExp > 9999) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
set BrewExp,0; //Comment this if u don´t wanna clean up this var for the player (max lvl so exp not needed)
}
close;

Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;

}

Also I don´t understand your point 5 and please, test again the 4 one (I don´t know how it happend).

Regards!

Edited by caos51
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

On 1/7/2021 at 11:58 PM, caos51 said:

Ok, here´s a corrected version should fix pretty much all but the second one (maybe it´s some emulator cap? wich number get stuck?)


//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================

//Just for fun... don´t know if it will work!
function	script	int__	{
.@i = getstrlen( .@str$ = getarg(0) ) -3;
.@is_negative = charat( .@str$, 0 ) == "-";
while ( .@i > .@is_negative ) {
	.@str$ = insertchar( .@str$, ",", .@i );
	.@i -= 3;
}
return .@str$;
}

//Change coordinates
prontera,144,180,3	script	Brewho	46,{

//Configuration, items and zenys:
//Change to what requirements you want to use
set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).
//set .@itemq[0],1,3,1; //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){mes ""+getitemname(.@item[.@i])+" x"+.@itemq[.@i]+"";}else{mes ""+getitemname(.@item[.@i])+"";}}
mes "^000000"; 
mes "Also, a talent fee of "+int__(.@zeny)+" z!";
menu "I've got them master brewer!",-;
next;
input .@quantity;
next;
if(.@quantity < 1){goto Lnenough;}
//Checking requirements
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){if(countitem(.@item[.@i]) < (.@quantity*.@itemq[.@i])){goto Lnenough;}}else{if(countitem(.@item[.@i]) < .@quantity){goto Lnenough;}}}
if(Zeny < .@zeny){goto Lnenough;} //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
//Deleting the items!
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){delitem .@item[.@i],(.@itemq[.@i]*.@quantity));}else{delitem .@item[.@i],.@quantity;}}
set Zeny,Zeny-.@zeny;
for( .@i = 0; .@i < .@quantity; .@i++ ){
    //Lets goooo with the chances
    if(BrewLvl == 0){set @brewchance,rand(1,5);}
    if(BrewLvl == 1){set @brewchance,rand(1,4);}
    if(BrewLvl == 2){set @brewchance,rand(1,3);}
    if(BrewLvl == 3){set @brewchance,rand(1,2);}

    if(@brewchance == 1) {
        misceffect 305;
        set BrewExp,BrewExp+1;
        getnameditem .@result,strcharinfo(0); //Change Item ID, Must match the potion to be made!
        set .@ok,.@ok+1;
        //goto Lsuccess;
	} else {
        misceffect 306;
        set .@ko,.@ko+1;
        //goto Lfail;
	}
    
}

//Now let´s see the results
next;
mes "[^0000FF Brewho ^000000]";
//mes "Congratulations! You've succeeded!";
mes "Well, well... let me see.";
mes "You succeeded "+.@ok+" time/s and failed "+.@ko+" time/s.";
if(BrewExp < 10000){dispbottom "You've gained "+.@ok+" Brewing Exp.";}
if(BrewLvl == 0 && BrewExp > 999){ set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewLvl == 1 && BrewExp > 4999) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewLvl == 2 && BrewExp > 9999) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
set BrewExp,0; //Comment this if u don´t wanna clean up this var for the player (max lvl so exp not needed)
}
close;

Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;

}

Also I don´t understand your point 5 and please, test again the 4 one (I don´t know how it happend).

Regards!

set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).  i getting error with this line how do i exactly configure it?

set .@item[0],713;    i set to this i can only set one requirements how to i set all of them?

npc stuck when you input 200+ above it will still generate results but you wont get brewing exp

 

Working fine i guess let me just test thoroughly 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

Uhm... I´ll try yo explain.

Now you have a configuration part:

//Change to what requirements you want to use
set .@item[0],713,970,607; //Array with items IDs to use (only 1 of them).
//set .@itemq[0],1,3,1; //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

The first array .@item[0] defines the items ID of the brewing formula. You can put from 1-254 different items separated by ",".

The example are the items configured in your script 713,970,607. But if you only configure this, it will try to get 1 of each item... but why if you want to pick one of this... three of that...

The second (and commented) variable is for that:

//set .@itemq[0],1,3,1;

if you uncomment this, it will take 1 for the first item, 3 for the second and 1 of the third one. They are in the same order

.@item[0],<ITEM ID 1>,<ITEM ID 2>,<ITEM ID 3>...;

.@itemq[0],<ITEM ID 1 QUANTITY>,<ITEM ID 2 QUANTITY>,<ITEM ID 3 QUANTITY>...;

Then another two vars with the zenys required and the ITEM ID of the brew result.

Maybe more than 200 trys is to much and we can limit the imput to max 100. What do you think?

 

I´m putting some corrections in this new version and with a limit of 100 each try (I think maybe the array vars where not being configured correctly).

Try this:

//======Name========================================
// Potion Brewer NPC
//======Version=====================================
// 1.0
//======Author(s)===================================
// Sandbox
//======Comments====================================
// In loving memory of AstralRO
//==================================================

//Just for fun... don´t know if it will work!
function	script	int__	{
.@i = getstrlen( .@str$ = getarg(0) ) -3;
.@is_negative = charat( .@str$, 0 ) == "-";
while ( .@i > .@is_negative ) {
	.@str$ = insertchar( .@str$, ",", .@i );
	.@i -= 3;
}
return .@str$;
}

//Change coordinates
prontera,144,180,3	script	Brewho	46,{

//Configuration, items and zenys:
//Change to what requirements you want to use
setarray(.@item[0],713,970,607); //Array with items IDs to use (only 1 of them).
//setarray(.@itemq[0],1,3,1); //Uncomment if you want to use different quantities for each item, same order, array with quentities to use.
set .@zeny,100000; //Money required.
set .@result,607; //The obtained item on success.

mes "[^0000FF Brewho ^000000]";
mes "Hello, I can teach you how to brew! Teach you, teach you how to brew ^000088Astral Beer^000000"; //Change to what kind of potion do you want to brew
menu "Teach me please!",-;
next;
mes "[^0000FF Brewho ^000000]";
mes "Okay, you'll be needing these..";
mes "^000088";
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){mes ""+getitemname(.@item[.@i])+" x"+.@itemq[.@i]+"";}else{mes ""+getitemname(.@item[.@i])+"";}}
mes "^000000"; 
mes "Also, a talent fee of "+int__(.@zeny)+" z!";
menu "I've got them master brewer!",-;
next;
mes "(How many tries?)";
mes "Max: 100";
input .@quantity;
next;
if(.@quantity < 1){goto Lnenough;}
if(.@quantity > 100){set .@quantity,100;}
//Checking requirements
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){if(countitem(.@item[.@i]) < (.@quantity*.@itemq[.@i])){goto Lnenough;}}else{if(countitem(.@item[.@i]) < .@quantity){goto Lnenough;}}}
if(Zeny < .@zeny){goto Lnenough;} //Must match the requirements above.
mes "[^0000FF Brewho ^000000]";
mes "Let's see the results!";
//Uncomment to enable casting effect
progressbar "ffff00",1;
//Deleting the items!
for( .@i = 0; .@i < getarraysize(.@item); .@i++ ){if(.@itemq[.@i]>0){delitem .@item[.@i],(.@itemq[.@i]*.@quantity);}else{delitem .@item[.@i],.@quantity;}}
set Zeny,Zeny-.@zeny;
for( .@i = 0; .@i < .@quantity; .@i++ ){
    //Lets goooo with the chances
    if(BrewLvl == 0){set @brewchance,rand(1,5);}
    if(BrewLvl == 1){set @brewchance,rand(1,4);}
    if(BrewLvl == 2){set @brewchance,rand(1,3);}
    if(BrewLvl == 3){set @brewchance,rand(1,2);}

    if(@brewchance == 1) {
        misceffect 305;
        set BrewExp,BrewExp+1;
        getnameditem .@result,strcharinfo(0); //Change Item ID, Must match the potion to be made!
        set .@ok,.@ok+1;
        //goto Lsuccess;
	} else {
        misceffect 306;
        set .@ko,.@ko+1;
        //goto Lfail;
	}
    
}

//Now let´s see the results
next;
mes "[^0000FF Brewho ^000000]";
//mes "Congratulations! You've succeeded!";
mes "Well, well... let me see.";
mes "You succeeded "+.@ok+" time/s and failed "+.@ko+" time/s.";
if(BrewExp < 10000){dispbottom "You've gained "+.@ok+" Brewing Exp.";}
if(BrewLvl == 0 && BrewExp > 999){ set BrewLvl,1;
dispbottom "Congratulations! Your Brewing Mastery is now Level 1!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 1!",bc_all,0x00FFFF;
}
else if(BrewLvl == 1 && BrewExp > 4999) { set BrewLvl,2;
dispbottom "Congratulations! Your Brewing Mastery is now Level 2!";
announce strcharinfo(0)+"'s Brewing Mastery reached Level 2!",bc_all,0x00FFFF;
}
else if(BrewLvl == 2 && BrewExp > 9999) { set BrewLvl,3;
dispbottom "Congratulations! Your Brewing Mastery is now Level 3!";
announce strcharinfo(0)+"'s Brewing Mastery reached Max Level!",bc_all,0x00FFFF;
set BrewExp,0; //Comment this if u don´t wanna clean up this var for the player (max lvl so exp not needed)
}
close;

Lnenough:
mes "[^0000FF Brewho ^000000]";
mes "Are you trying to brew me out!?";
close;

}

 

PS: I could test this on an offline server and seems to be working fine now.

Edited by caos51
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

I don´t know if you copied it before my last edit, just in case copy it again jajajaja (fixed a ")" in delete item).

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

i just copied the last edit atm working as intended maybe one last request? if you input higher than 100 the process will still continue can you add some checking if they input higher thatn 100 the process will not process thanks!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

Just now, kalabasa said:

i just copied the last edit atm working as intended maybe one last request? if you input higher than 100 the process will still continue can you add some checking if they input higher thatn 100 the process will not process thanks!

What it does right now if you put more than 100 only does 100 anyways. If you want an error, change:

if(.@quantity > 100){set .@quantity,100;}

for this:

if(.@quantity > 100){goto Lnenough;}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

Thanks Man, Cheers~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  05/31/21
  • Last Seen:  

Hi @caos51 can you make help to add a menu for this script that will work for single brewing? So there will be the single and bulk. Hope you can help thanks!

On 1/8/2021 at 7:26 PM, kalabasa said:

Thanks Man, Cheers~

Hi Bro do you have the full script that is working? I have a lot of errors encountered. See one below.

set .@item[0],713,970,607; - parse_line: expected ';'
 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  26
  • Reputation:   1
  • Joined:  06/25/16
  • Last Seen:  

On 6/9/2021 at 6:35 AM, kenetitsss said:

Hi @caos51 can you make help to add a menu for this script that will work for single brewing? So there will be the single and bulk. Hope you can help thanks!

Hi Bro do you have the full script that is working? I have a lot of errors encountered. See one below.

set .@item[0],713,970,607; - parse_line: expected ';'
 

Send me your full script, probably the missing ";" is on the previous line.

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