Jump to content
  • 0

Card Exchanger help


spriggan92

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  1
  • Reputation:   0
  • Joined:  08/24/20
  • Last Seen:  

Hello

Everything is working fine with the script. I would like a small modification though.

At case 4:

Instead of accepting 5 card coins for a random card -> open a shop where I can use Gold Coins as currency

I would appreciate the help as Im sitting on this thingy since an hour and dunno what to do ?

//===== rAthena Script =======================================
//= Card Exchanger
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= [Official Conversion]
//= Exchange any card for a Card Coin, and 5 Card Coins for
//= a random card in exchange.
//=
//= NOTE: This NPC is only available in pRO and twRO.
//===== Additional Comments: =================================
//= 1.0 First version. [Euphy]
//============================================================

// Main NPC :: Card_Change_tw
//============================================================
prontera,158,179,4	script	Card Vendor Machine#pa08	10343,{
	if (checkweight(1201,1) == 0) {
		mes "You have too many items, please reduce it and come back later!";
		close;
	}
	if (MaxWeight - Weight < 1000) {
		mes "You are overweight now, please reduce it and come back later!";
		close;
	}
	mes "[Terminator RX1]";
	cutin "shiki01.bmp",2;
	mes "Text Explanation Begins:";
	mes "Press 1 for Cancel,";
	mes "Press 2 for Explanation,";
	mes "Press 3 for Coin Exchange,";
	mes "Press 4 for Card Exchange.";
	next;
	switch(select("1.Cancel:2.Explanation:3.Change Card into Coin:4.Change Coin into Card:^ffffff5.Start Security System^000000")) {
	case 1:
		mes "[Terminator RX1]";
		mes "You are welcome!";
		close;
	case 2:
		mes "[Terminator RX1]";
		mes "No.3, when you choose Coin Exchange, system will collect ONE card from your inventory randomly to exchange into ONE Coin.";
		next;
		mes "[Terminator RX1]";
		mes "No.4, when you choose Card Excahnge, system will collect FIVE coin from your inventory to exchange into ONE Card randomly.";
		next;
		mes "[Terminator RX1]";
		mes "You are welcome!";
		close;
	case 3:
		specialeffect2 EF_COIN;
		specialeffect2 EF_LOUD;
		progressbar "0xffff00",3;
		callsub L_Exchange,	// yes, this list is hardcoded in the official script...
 60137, 
 60138, 
 60139, 
 60140, 
 60141, 
 60142, 
 60143, 
 60147, 
 60148, 
 60149, 
 60150, 
 60151, 
 60152, 
 60153; 
        
		
		mes "[Terminator RX1]";
		mes "Card searching has finished!";
		next;
		mes "[Terminator RX1]";
		mes "Thank you for coming!";
		close;
	case 4:
		specialeffect2 EF_COIN;
		specialeffect2 EF_LOUD;
		progressbar "0xffff00",3;
		if (countitem(6379) < 5) {
			mes "[Terminator RX1]";
			mes "You do not have enough coins.";
			close;
		}
		delitem 6379,5; //Card_Coin
		.@r = rand(1,34261);
		     if (.@r <= 2001)  getitem 4001,1; //Poring_Card
		else if (.@r <= 34259) getitem 4440,1; //Necromancer_Card
		else if (.@r <= 34261) {
			if (rand(1,10) == 1)
				getitem 4396,1; //Tha_Odium_Card
			else
				getitem 4092,1; //Skel_Worker_Card
		}
		mes "[Terminator RX1]";
		mes "All cards have finished.";
		next;
		mes "[Terminator RX1]";
		mes "Thank you for coming!";
		close;
	case 5:
		mes "[Terminator RX1]";
		mes "Found unauthorized signal, starting security system...";
		close2;
		warp "comodo",263,286;
		end;
	}
	close;

L_Exchange:
	freeloop(1);
	.@args = getargcount();
	for (.@i = 0; .@i < .@args; .@i++) {
		if (countitem(getarg(.@i))) {
			mes "Found ^980078" + getitemname(getarg(.@i)) + "^000000,";
			mes "Do you want to exchange ONE Card into ONE Coin?";
			next;
			switch(select("No:Yes")) {
			case 1:
				mes "^980078Do you want search for other cards?^000000";
				next;
				if(select("No:Yes") == 1) {
					mes "^980078Card searching is interrupted^000000";
					close;
				}
				break;
			case 2:
				if (countitem(getarg(.@i))) {
					delitem getarg(.@i),1;
					getitem 6379,1; //Card_Coin
					mes "^980078" + getitemname(getarg(.@i)) + " has exchanged into Coin.^000000";
					next;
				} else {
					mes "^980078Your inventory does not contain the card for exchange.^000000";
					next;
				}
				break;
			}
		}
	}
	freeloop(0);
	return;
}

 

Edited by spriggan92
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  143
  • Reputation:   30
  • Joined:  12/23/11
  • Last Seen:  

You can define itemshop:

-%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}

where costitemid = 6379

And then just callshop this itemshop in case 4

callshop "<name>",<option>;

callshop "<name>",<option>;

 

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