Jump to content
  • 0
Hit`

BG Shop Script

Question

Hello,

I was looking for a script about it to use along with Hercules' Battlegrounds and found one here (starts at line #644) but it has an error.

Here's the error, 

So I tried to PM one of the Script Developers for help and @Asheraf pointed out that the script uses custom script commands. My question is, is there a way for it to work and be compatible with Hercules? Like maybe change the part where custom commands are used and instead use Hercules script commands.

Here's the script,

Spoiler

// BG MALL
// *********************************************************************

prontera,155,115,2	script	Telma	1_F_MERCHANT_02,{
	mes "[Telma]";
	mes "Welcome, mighty warrior.";
	mes "Do you need supply for your battles?";
	mes "I can exchange you a nice amount for your badges or open the normal Chronos Supply Store for you.";
	next;
	switch( select("^FF0000Terra Old Red Box^000000:^FFA500Chronos Supply Store^000000:^FF0000Battleground Exclusive^000000:^0000FFWar of Emperium Exclusive Boxs:War of Emperium Exclusive Items^000000:Other Items") )
	{
	case 1: // Terra Old Red Box
		mes "[Telma]";
		mes "You can exchange your BG partipation points, a full round of each won BG, for one ^FF0000Terra Old Red Box^000000.";
		mes "Let me check your points...";
		next;
		mes "Tierra EoS : ^0000FF" + BG_EoE + "^000000";
		mes "Tierra Boss : ^0000FF" + BG_Boss + "^000000";
		mes "Tierra Dom : ^0000FF" + BG_DOM + "^000000";
		mes "Flavius CTF : ^0000FF" + BG_CTF + "^000000";
		mes "Flavius TDM : ^0000FF" + BG_TDM + "^000000";
		mes "Flavius SC : ^0000FF" + BG_SC + "^000000";
		mes "Conquest : ^0000FF" + BG_CON + "^000000";
		mes "Rush : ^0000FF" + BG_RUSH + "^000000";
		mes "Triple Inferno : ^0000FF" + BG_TI + "^000000";
		next;
		if( BG_EoE > 0 && BG_Boss > 0 && BG_CTF > 0 && BG_TDM > 0 && BG_SC > 0 && BG_TI > 0 && BG_CON > 0 && BG_RUSH > 0 && BG_DOM > 0 )
		{
			set BG_EoE, BG_EoE - 1;
			set BG_Boss, BG_Boss - 1;
			set BG_DOM, BG_DOM - 1;
			set BG_CTF, BG_CTF - 1;
			set BG_TDM, BG_TDM - 1;
			set BG_SC, BG_SC - 1;
			set BG_CON, BG_CON - 1;
			set BG_RUSH, BG_RUSH - 1;
			set BG_TI, BG_TI - 1;
			getitem 5000,1;
			mes "[Telma]";
			mes "Here is one Box for you!!";
			mes "I hope you can find inside it a big surprise.";
			mes "Talk to me if you want to exchange more.";
		}
		else
		{
			mes "[Telma]";
			mes "To exchange your points for a Box, you need at least 2 one of each Battleground.";
			mes "Play all kinds of BG's!!.";
		}
		close;
	case 2: // Supply Store
		mes "[Telma]";
		mes "Close this window to open the Chronos Supply Store.";
		close2;
		callshop "ChronosShop",1;
		end;
	case 3: // BG Supply
		setarray .@Items[0],   547,  504,  505,  678, 7135, 7136, 7137, 7138, 7139,  715,  716,  717,12016, 1025, 7321,  662,12072,12077,12082,12087,12092,12097;
		setarray .@Amount[0],  150,  100,  100,   10,   40,   40,   30,   30,   25,   50,  100,  200,   10,   40,   25,   10,    3,    3,    3,    3,    3,    3;
		setarray .@Value[0],     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1 ,   1,    1,    1,    1,    1,    1,    1,    1,    1;
		set .@cID, getbattleflag("bg_reserved_char_id");
		set .@Tarjet$, "Battleground";
		break;
	case 4: // WoE Supply Boxs
		setarray .@Items[0],  8916, 8917, 8924, 8929, 8935, 8934,             8926, 8927, 8962, 8961, 8925, 8928, 8930;
		setarray .@Amount[0],    3,    1,    2,    2,    1,    1,                2,    1,    1,    1,    4,    1,    1;
		setarray .@Value[0],     8,    4,    4,    8,   10,   10,                8,    8,    4,    2,    8,   10,    8;
		set .@cID, 0;
		set .@Tarjet$, "War of Emperium or GvG";
		break;
	case 5: // WoE Supply Items
		setarray .@Items[0],  7137, 7138,  662,12072,12077,12082,12087,12092,12097,14287,14288;
		setarray .@Amount[0],   30,   30,   10,    6,    6,    6,    6,    6,    6,    5,    5;
		setarray .@Value[0],     4,    4,    4,    8,    8,    8,    8,    8,    8,    8,    8;
		set .@cID, getbattleflag("woe_reserved_char_id");
		set .@Tarjet$, "War of Emperium or GvG";
		break;
	case 6:
		setarray .@Items[0],  8918, 8919, 8960;
		setarray .@Amount[0],    1,    1,    1;
		setarray .@Value[0],    15,   15,   15;
		set .@cID, 0;
		set .@Tarjet$, "Everywhere";
		break;
	}

	set .@Menu$, "";
	for( set .@i, 0; .@i < getarraysize(.@Items); set .@i, .@i + 1 )
		set .@Menu$, .@Menu$ + .@Amount[.@i] + " " + getitemname(.@Items[.@i]) + " (" + .@Value[.@i] + " badges):";
	set .@j, select(.@Menu$) - 1;

	mes "[Telma]";
	mes "^0000FF" + .@Amount[.@j] + " " + getitemname(.@Items[.@j]) + "^000000";
	mes "It will cost you " + .@Value[.@j] + " badges per pack.";
	mes "Remember this can only be used on " + .@Tarjet$ + ".";
	next;
	
	mes "[Telma]";
	mes "But tell me first, where do you want to receive the items?";
	next;
	set .@Destiny, select("Here, in my Inventory:Direct to my Storage") - 1;

	mes "[Telma]";
	mes "How many packets do you want to buy? (1..50)";
	next;

	input .@total;
	if( .@total < 1 || .@total > 50 )
	{
		mes "[Telma]";
		mes "I am sorry, please input a value from 1 to 50.";
		mes "Talk to me again when you do your selections.";
		close;
	}
	
	set .@vtotal, .@total * .@Value[.@j]; // Value of all Packages
	set .@total, .@total * .@Amount[.@j]; // Total Amount of Items

	if( .@Destiny )
	{
	// Check Storage Space Limit
		if( .@cID )
		{
			if( checkspace(.@Items[.@j],.@total,1,0,0,254,0,.@cID&0xffff,(.@cID>>16)&0xffff) == 0 )
			{
				mes "[Telma]";
				mes "It's seen your storage cannot accept more items.";
				mes "Go to your store and check the free space.";
				close;
			}
		}
		else
		{
			if( checkspace(.@Items[.@j],.@total,1,0,0,0,0,0,0) == 0 )
			{
				mes "[Telma]";
				mes "It's seen your storage cannot accept more items.";
				mes "Go to your store and check the free space.";
				close;
			}
		}
	}
	else
	{
	// Check Weight Limit
		if( checkweight(.@Items[.@j],.@total) == 0 )
		{
			mes "[Telma]";
			mes "It's seen you can't carry the stuff you want to buy.";
			mes "Go and store some items on your Kafra Storage.";
			close;
		}
	}

	if( countitem(7828) + countitem(7829) + countitem(7773) < .@vtotal )
	{
		mes "[Telma]";
		mes "Required Badges: ^0000FF" + .@vtotal + "^000000";
		mes "You do not have enough badges. Sorry...";
		mes "Participate in Battleground arenas to receive it.";
		close;
	}
	set .@vcount, .@vtotal;
	set .@i7828, 0;
	set .@i7829, 0;
	set .@i7773, 0;

	// Bravery Badges
	if( countitem(7828) > 0 )
	{
		mes "[Telma]";
		mes "Required Badges: ^0000FF" + .@vcount + "^000000";
		mes "Bravery Badges to expend:";
		next;
		input .@i7828;
		if( .@i7828 < 0 || .@i7828 > countitem(7828) )
		{
			mes "[Telma]";
			mes "Invalid number... Sorry.";
			close;
		}
		
		if( .@i7828 > .@vcount ) set .@i7828,.@vcount;
		set .@vcount, .@vcount - .@i7828;
	}

	// Valor Badges
	if( .@vcount && countitem(7829) > 0 )
	{
		mes "[Telma]";
		mes "Required Badges: ^0000FF" + .@vcount + "^000000";
		mes "Valor Badges to expend:";
		next;
		input .@i7829;
		if( .@i7829 < 0 || .@i7829 > countitem(7829) )
		{
			mes "[Telma]";
			mes "Invalid number... Sorry.";
			close;
		}
		
		if( .@i7829 > .@vcount ) set .@i7829,.@vcount;
		set .@vcount, .@vcount - .@i7829;
	}

	// Heroism Badges
	if( .@vcount && countitem(7773) > 0 )
	{
		mes "[Telma]";
		mes "Required Badges: ^0000FF" + .@vcount + "^000000";
		mes "Heroism Badges to expend:";
		next;
		input .@i7773;
		if( .@i7773 < 0 || .@i7773 > countitem(7773) )
		{
			mes "[Telma]";
			mes "Invalid number... Sorry.";
			close;
		}

		if( .@i7773 > .@vcount ) set .@i7773, .@vcount;
		set .@vcount, .@vcount - .@i7773;
	}

	// Final Checks
	if( .@vcount != 0 )
	{
		mes "[Telma]";
		mes "Sorry, not enough badges to pay the total value.";
		close;
	}

	mes "[Telma]";
	mes "Are you ready to pay and receive your items?";
	mes "Your payment details:";
	mes "^0000FF" + .@i7828 + "^000000 Bravery Badges";
	mes "^0000FF" + .@i7829 + "^000000 Valor Badges";
	mes "^0000FF" + .@i7773 + "^000000 Heroism Badges";
	next;

	if( select("Yes, let's do it:I am sorry... not this time") == 2 )
	{
		mes "[Telma]";
		mes "Ok, come again if you change your mind.";
		close;
	}

	if( .@Destiny )
	{ // Check Storage Space Limit
		if( .@cID )
		{
			if( checkspace(.@Items[.@j],.@total,1,0,0,254,0,.@cID&0xffff,(.@cID>>16)&0xffff) == 0 )
			{
				mes "[Telma]";
				mes "It's seen your storage cannot accept more items.";
				mes "Go to your store and check the free space.";
				close;
			}
		}
		else
		{
			if( checkspace(.@Items[.@j],.@total,1,0,0,0,0,0,0) == 0 )
			{
				mes "[Telma]";
				mes "It's seen your storage cannot accept more items.";
				mes "Go to your store and check the free space.";
				close;
			}
		}
	}
	else
	{ // Check Weight Limit
		if( checkweight(.@Items[.@j],.@total) == 0 )
		{
			mes "[Telma]";
			mes "It's seen you can't carry the stuff you want to buy.";
			mes "Go and store some items on your Kafra Storage.";
			close;
		}
	}

	if( .@i7828 > countitem(7828) || .@i7829 > countitem(7829) || .@i7773 > countitem(7773) )
	{
		mes "[Telma]";
		mes "What!?, are you a magician or a thief? What did you do with your badges!?";
		mes "Get out of here!";
		close;
	}

	delitem 7828,.@i7828;
	delitem 7829,.@i7829;
	delitem 7773,.@i7773;

	if( .@cID )
	{
		if( .@Destiny )
			storeitem2 .@Items[.@j],.@total,1,0,0,254,0,.@cID&0xffff,(.@cID>>16)&0xffff;
		else
			getitem2 .@Items[.@j],.@total,1,0,0,254,0,.@cID&0xffff,(.@cID>>16)&0xffff;
	}
	else
	{
		if( .@Destiny )
			storeitem .@Items[.@j],.@total;
		else
			getitem .@Items[.@j],.@total;
	}

	mes "[Telma]";
	mes "Here it is... Now take care and fight for the honor and glory of your prince.";
	close;
}

 

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hercules does not have a command to put items directly in storage so just use getitem/getitem2 and remove the storeitem/storeitem2. The use of checkweight guarantees it can be put in the inventory so you don't need to mess with storage anyway

Share this post


Link to post
Share on other sites
  • 0

the checkweight() command now checks for both weight and inventory space so you can use that instead of the custom checkspace()

 

Btw your terminal font makes it very hard to differentiate between parentheses and angle brackets. You could try the following:
https://github.com/adobe-fonts/source-code-pro
https://github.com/mozilla/Fira
 

If you use Powerline they also offer their own patched fonts:
https://github.com/powerline/fonts

Share this post


Link to post
Share on other sites
  • 0
47 minutes ago, meko said:

the checkweight() command now checks for both weight and inventory space so you can use that instead of the custom checkspace()

 

Btw your terminal font makes it very hard to differentiate between parentheses and angle brackets. You could try the following:
https://github.com/adobe-fonts/source-code-pro
https://github.com/mozilla/Fira
 

If you use Powerline they also offer their own patched fonts:
https://github.com/powerline/fonts

Hi, so I changed the checkspace custom command to checkweight and it solved the error I posted above but there's another error and I think it's because of the custom command storeitem/storeitem2.

Btw here's the new error,

Also, I am very sorry but I really do not know how to apply those fonts, bear with me please. Thank you!

Share this post


Link to post
Share on other sites
  • 0

The script works now except for storing items to storage after purchasing. It'd be nice to have it implemented tho, till then, I guess we'll just have to wait.

Thank you for helping me out!

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.