Jump to content

Question

Posted

Hello anyone here can help me edit the Token to Zeny? I don't understand how it is working I want it to make 5m - 1 T,  50m - 10T, and  500m - 100T

Here's the script I use.

 

// Trades tokens
// getarg(0) - number of tokens to be traded
function	script	thqs_trade_token	{
	@type = getarg(0);
	if( @type == 4 )
		close;

	// 10^0, 10^1, 10^2
	@type -= 1;
	@price = (10 ** @type);

	// 10^3, 10^4, 10^5
	@type += 3; // So we can use pow later to determine the qt of Zeny
	@prize = (10 ** @type);

	if( #Treasure_Token < @price ) {
		mes "You don't have enough tokens!";
		close;
	}

	if( Zeny == MAX_ZENY ) {
		mes "You can't add more zeny to your character";
		close;
	}

	Zeny += @prize;
	#Treasure_Token -= @price;
	close;
}

// Main script
prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
	mes "[Ash]";
	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
	next;
	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
		case 1:
			mes "[Ash]";
			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
			mes " ";
			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
			mes " ";
			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
			mes " ";
			mes "Hope that solves your problem and questions.";
			close;
		case 2:
			break;
		case 3:
			close;
	}

	mes "[Ash]";
	mes "Ok here is our Big list of goods.";
	mes " ";
	mes "(Note T stands for a Treasure Token.)";
	next;
	mes "[Ash]";
	mes "This is what we have to offer.";
	next;
	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
		case 1:
			select("1000z - 1T","10000z - 10T","100000z - 100T","Nevermind");
			thqs_trade_token(@menu);
		case 2:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
			ths_menu_weapons(@menu);
		case 3:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
		case 4:
			close;
	}
	end;
}

 

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Here you go

 

// Trades tokens
// getarg(0) - number of tokens to be traded
function	script	thqs_trade_token	{

	// getarg(0) == Token Option
	.@index = getarg(0);

	// Number of Tokens
	.@token_count[0], 1, 10, 100;
	.@zeny_amt[0],5000000,50000000,500000000;

	// If Nevermind was selected
	if (.@index == 3) { close; }

	if (#Treasure_Token < .@token_count[.@index]) {
		mes "You don't have enough tokens!";
		close;
	}

	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
		mes "You are already at max Zeny or this trade will go over max zeny";
		close;
	}

	Zeny += .@zeny_amt[.@index];
	#Treasure_Token -= .@token_amount[.@index];
	close;
}

// Main script
prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
	mes "[Ash]";
	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
	next;
	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
		case 1:
			mes "[Ash]";
			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
			mes " ";
			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
			mes " ";
			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
			mes " ";
			mes "Hope that solves your problem and questions.";
			close;
		case 2:
			break;
		case 3:
			close;
	}

	mes "[Ash]";
	mes "Ok here is our Big list of goods.";
	mes " ";
	mes "(Note T stands for a Treasure Token.)";
	next;
	mes "[Ash]";
	mes "This is what we have to offer.";
	next;
	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
		case 1:
			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
			thqs_trade_token(.@choice);
		case 2:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
			ths_menu_weapons(.@choice);
		case 3:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
		case 4:
			close;
	}
	end;
}
 

 

Edited by Z3R0
Forgot to delete some stuff and added more comments
  • 0
Posted

Trying again...

// Trades tokens
// getarg(0) - number of tokens to be traded
function	script	thqs_trade_token	{

	// getarg(0) == Token Option
	.@index = getarg(0);

	// Number of Tokens
	.@token_count[0], 1, 10, 100;
	.@zeny_amt[0],5000000,50000000,500000000;

	// If Nevermind was selected
	if (.@index == 3) { close; }

	if (#Treasure_Token < .@token_count[.@index]) {
		mes "You don't have enough tokens!";
		close;
	}

	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
		mes "You are already at max Zeny or this trade will go over max zeny";
		close;
	}

	Zeny += .@zeny_amt[.@index];
	#Treasure_Token -= .@token_amount[.@index];
	close;
}

// Main script
prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
	mes "[Ash]";
	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
	next;
	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
		case 1:
			mes "[Ash]";
			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
			mes " ";
			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
			mes " ";
			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
			mes " ";
			mes "Hope that solves your problem and questions.";
			close;
		case 2:
			break;
		case 3:
			close;
	}

	mes "[Ash]";
	mes "Ok here is our Big list of goods.";
	mes " ";
	mes "(Note T stands for a Treasure Token.)";
	next;
	mes "[Ash]";
	mes "This is what we have to offer.";
	next;
	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
		case 1:
			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
			thqs_trade_token(.@choice);
		case 2:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
			ths_menu_weapons(.@choice);
		case 3:
			mes "[Ash]";
			mes "This is what we have to offer.";
			next;
			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
		case 4:
			close;
	}
	end;
}
 

 

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