Jump to content
  • 0

Multiple Purchase Dynamic Shop


Question

Posted

Hi,

I would like to ask for a script that works like Euphy's Quest Shop but it lets player to purchase multiple items in the list instead of one at a time. Currency would be TCG.

 

For example, player clicks NPC, NPC gives a short dialogue then shop opens. Item exchange rate for Yggberry would be 2TCG : 10 Berry(4:20 and so on) while Yggseeds would be 1TCG:10 Seeds(2:20 and so on)

I managed to do the exchange rates right on Euphy's Quest Shop except for the dialogue and the be able to purchase multiple items(Yggseeds and Berries) in 1 transaction.

I hope I explained it enough. Thank you!

11 answers to this question

Recommended Posts

  • 0
Posted (edited)

I can do this -- give me a little time (at work right now)

/edit/ Okay so I realize now you need to make your own custom item "box". For example, player will buy the 10 count berry box for 2 TCG, open the box and get 10 berry. I'll give you my shop code but it's nothing special... you will need to create your own item ID for the box and put it into this script.

MAP,X,Y,Z	script	YGG Trader#spiritD	SPRITE,{

	mes "[YGG Trader]";
	mes "Would you like to buy some";
	mes "yggdrasil items?";
	if (countitem(7227) < 1) {
		mes "I only accept TCG Card as payment.";
		mes "Please come back when you have TCG Cards.";
		close;
	}
	switch(select("No:Yes")){
	case 1:
		close;
	case 2:
		callshop "YGG_SHOP",1;
		end;
	}

}
-	itemshop	YGG_SHOP	-1,7227,<itemid>:<price>,<itemid>:<price>

 

Edited by SpiritD
  • 0
Posted
1 hour ago, SpiritD said:

I can do this -- give me a little time (at work right now)

/edit/ Okay so I realize now you need to make your own custom item "box". For example, player will buy the 10 count berry box for 2 TCG, open the box and get 10 berry. I'll give you my shop code but it's nothing special... you will need to create your own item ID for the box and put it into this script.


MAP,X,Y,Z	script	YGG Trader#spiritD	SPRITE,{

	mes "[YGG Trader]";
	mes "Would you like to buy some";
	mes "yggdrasil items?";
	if (countitem(7227) < 1) {
		mes "I only accept TCG Card as payment.";
		mes "Please come back when you have TCG Cards.";
		close;
	}
	switch(select("No:Yes")){
	case 1:
		close;
	case 2:
		callshop "YGG_SHOP",1;
		end;
	}

}
-	itemshop	YGG_SHOP	-1,7227,<itemid>:<price>,<itemid>:<price>

 

Thank you for responding! But, is there another way for it to work w/o having to create custom boxes? I mean the existing one already does the job it's just that I am only able to purchase 1 of them and not both.

Also there's an error on the script,

[Error]: npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in f
ile 'npc/custom/sample.txt', line '20'. Skipping line...
 * w1=-
 * w2=itemshop
 * w3=YGG_SHOP
 * w4=-1,7227,607:1,608:1

 

  • 0
Posted (edited)
Quote

[Error]: npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in file 'npc/custom/sample.txt', line '20'. Skipping line...

Like the error said you have missing or extra TAB it means you added SPACE instead of TAB.

-<TAB>itemshop<TAB>YGG_SHOP<TAB>-1,7227,607:1,608:1

 

Edited by Lelouch vi Britannia
  • 0
Posted
18 minutes ago, Lelouch vi Britannia said:

Like the error said you have missing or extra TAB it means you added SPACE instead of TAB.


-<TAB>itemshop<TAB>YGG_SHOP<TAB>-1,7227,607:1,608:1

 

Hi, I am aware and already did this but the error still persist.

  • 0
Posted
10 hours ago, Skorm said:

Post the code you're testing in full.

Here you go, please take a look

prontera,150,150,0	script	YGG Trader#spiritD	1_F_MERCHANT_02,{

	mes "[YGG Trader]";
	mes "Would you like to buy some";
	mes "yggdrasil items?";
	if (countitem(7227) < 1) {
		mes "I only accept TCG Card as payment.";
		mes "Please come back when you have TCG Cards.";
		close;
	}
	switch(select("No:Yes")){
	case 1:
		close;
	case 2:
		callshop "YGG_SHOP",1;
		end;
	}

}
-	itemshop	YGG_SHOP	-1,7227,607:1,608:1

 

  • 0
Posted
9 hours ago, Zelek said:

Here you go, please take a look


prontera,150,150,0	script	YGG Trader#spiritD	1_F_MERCHANT_02,{

	mes "[YGG Trader]";
	mes "Would you like to buy some";
	mes "yggdrasil items?";
	if (countitem(7227) < 1) {
		mes "I only accept TCG Card as payment.";
		mes "Please come back when you have TCG Cards.";
		close;
	}
	switch(select("No:Yes")){
	case 1:
		close;
	case 2:
		callshop "YGG_SHOP",1;
		end;
	}

}
-	itemshop	YGG_SHOP	-1,7227,607:1,608:1

 

I just tested the exact script you posted it works fine on my server np.

  • 0
Posted

I'm also trying to create 1 npc like this, but mine is pretty simple, just like normal npc shop.

I have this npc, but it does not buy, nor does it sell, nor does it count the rate

 

Spoiler

//============================================================

// shop to insert items into:
-    shop    dyn_shop1    -1,501:50.

prontera,181,200,4    script    Dynamic Shop    123,{
    callshop "dyn_shop1",0;
    npcshopattach "dyn_shop1";
    end;

OnSellItem:
    // Stores the amount of tax the clan can withdraw.
    set $taxes1, $taxes1+@price*10;
    mes "Imposto Coletado.";
    end;

OnBuyItem:
    // Stores the amount of tax the clan can withdraw.
    set $taxes1, $taxes1+@price*10;
    //mes "Tax collected successfully!";
    dispbottom "Tax "+$taxes1+",";
    end;

OnInit:
    //npcshopitem "dyn_shop1", 501,40,502,200;
    npcshopitem "dyn_shop1", 611,40,1750,1,501,50,502,200,503,550,504,1200,506,40,645,800,656,1500,601,60,602,300,1065,100,2239,10000;
    $@rpotsleft = 10;
    $@opotsleft = 10;
    end;
}

prontera,181,198,6    script    tax collector#1    952,{
    
    mes "[taxes]";
    mes "You have: "+$taxes1+" Zenys to collect";
    next;
    mes "Would you like to collect this money now?";
    if(select("Coletar","Não") == 2) close;
    mes "Tax collected successfully";
    set Zeny, Zeny+$taxes1;
    set $taxes1, 0;
    close;
}

 

could anyone help me with this?

thanks

  • 0
Posted
On 9/23/2017 at 1:25 PM, clold157 said:

I'm also trying to create 1 npc like this, but mine is pretty simple, just like normal npc shop.

I have this npc, but it does not buy, nor does it sell, nor does it count the rate

 

  Reveal hidden contents

//============================================================

// shop to insert items into:
-    shop    dyn_shop1    -1,501:50.

prontera,181,200,4    script    Dynamic Shop    123,{
    callshop "dyn_shop1",0;
    npcshopattach "dyn_shop1";
    end;

OnSellItem:
    // Stores the amount of tax the clan can withdraw.
    set $taxes1, $taxes1+@price*10;
    mes "Imposto Coletado.";
    end;

OnBuyItem:
    // Stores the amount of tax the clan can withdraw.
    set $taxes1, $taxes1+@price*10;
    //mes "Tax collected successfully!";
    dispbottom "Tax "+$taxes1+",";
    end;

OnInit:
    //npcshopitem "dyn_shop1", 501,40,502,200;
    npcshopitem "dyn_shop1", 611,40,1750,1,501,50,502,200,503,550,504,1200,506,40,645,800,656,1500,601,60,602,300,1065,100,2239,10000;
    $@rpotsleft = 10;
    $@opotsleft = 10;
    end;
}

prontera,181,198,6    script    tax collector#1    952,{
    
    mes "[taxes]";
    mes "You have: "+$taxes1+" Zenys to collect";
    next;
    mes "Would you like to collect this money now?";
    if(select("Coletar","Não") == 2) close;
    mes "Tax collected successfully";
    set Zeny, Zeny+$taxes1;
    set $taxes1, 0;
    close;
}

 

could anyone help me with this?

thanks

I suggest you make your own thread and follow the format by explaining what exactly you are trying to do (I will probably end up re-writing the script). Otherwise, you should post the script in the "Script Support" section so people will test and attempt to fix your existing script.

  • 0
Posted
-	shop	TCG123	-1,501:10000

prontera,255,55,5	script	TCG SHOP#TCG123	123,{
	mes "I Sell Items For TCG!";
	next;
	switch(select("Open Shop:Nothing")){
		case 1:
			callshop "TCG123",1;
			npcshopattach "TCG123";
			end;
		case 2:
			mes "Okay have a nice day";
			close;
			}

OnBuyItem:
	set .@TotalCost,0;
		for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
			for(set .@j,0; .@j < getarraysize( .item ); set .@j,.@j+1)
				if( .item[.@j] == @bought_nameid[.@i] )
					set .@TotalCost,.@TotalCost + ( .price[.@j] * @bought_quantity[.@i] );
						if(countitem(.currency) >= .@TotalCost ){
							delitem .currency,.@TotalCost;
							for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
							getitem @bought_nameid[.@i],(@bought_quantity[.@i] * .amount[.@i]);
							end;
							} else {
								mes "Your "+getitemname(.currency)+" is not enough";
								close;
								}
OnInit:
	set .currency,7227; //set tax here
	setarray .item[0],607,608;
	setarray .price[0],2,1;
	setarray .amount[0],10,10;
	npcshopitem "TCG123",607,2;

for(set .@i,0; .@i < getarraysize( .item ); set .@i,.@i+1)
	npcshopadditem "TCG123",.item[.@i],.price[.@i];
	end;
	}

 

  • Upvote 1
  • 0
Posted
On 25/09/2017 at 2:07 AM, SpiritD said:

Sugiro que você faça seu próprio tópico e siga o formato, explicando o que exatamente você está tentando fazer (provavelmente acabarei reescrevendo o script). Caso contrário, você deve postar o script na seção "Support de Script" para que as pessoas testem e tentam corrigir seu script existente.

Yes, crazyarashi has already helped me solve this problem.

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