Jump to content
  • 0

Question

Posted

Hello and good day. I would like to request a Limited stocks shop.
Heres how this npc should work..

Currency to be used on the NPC : Custom TCG Card - 30705
A gm can set u items for the shop/NPC to sell for a limited stocks example:
the NPC sells 3 thanatos cards when player buys a card only 2 cards will be left for sale. whenever all the stocks are sold you have to wait for a GM to restock the shop.- ( GM's should set what items should be sold next and has the option to restock instantly or remove certain items that is being sold.).

I really hope u understand the mechanics of this npc im requesting. thank you :)

16 answers to this question

Recommended Posts

Posted
prontera,150,150,6	script	Test	100,{

switch( select( ( getgmlevel() > 98 )?"^FF0000GM Menu^000000":"",
				"Player Menu")){
	case 1:
		for(set .@a,0; .@a < getarraysize(.TradeID); set .@a, .@a +1){
			if(.TradeID[.@a] != 0) {
				set .@menu$, .@menu$ + "> ^0000FF "+getitemname(.TradeID[.@a])+" ^000000 x"+.TradeCount[.@a]+" x"+.TradeTCG[.@a]+"";
				set .@menu$, .@menu$ + ":";	
			}
		}		
			set @Edit,select(.@menu$)-1;

		mes "How much cards add?";
		input .addhw;
		mes "done.";
		.TradeCount[@Edit] += .addhw;
		close;
				
	
	case 2:
		for(set .@i,0; .@i < getarraysize(.TradeID); set .@i, .@i +1){
			if(.TradeID[.@i] != 0) {
				set .@menu$, .@menu$ + "> ^0000FF "+getitemname(.TradeID[.@i])+" ^000000 x"+.TradeCount[.@i]+" x"+.TradeTCG[.@i]+"";
				set .@menu$, .@menu$ + ":";	
			}
		}		
			set @Buy,select(.@menu$)-1;
			
			mes "how much?";
			input .hw;
			if(.TradeCount[@Buy] < .hw) {
				mes "I do not have as many cards";
				close;
			}
			if(countitem(.TCGID) < .TradeTCG[@Buy]*.hw){
				mes "You don't have TCG.";
				close;
			}
			
			delitem .TCGID, .TradeTCG[@Buy]*.hw;
			getitem .TradeID[@Buy], .hw;
			mes "complete!";
			close;
}
OnInit:
setarray .TradeID[0], 4031; //your cards id
setarray .TradeCount[0], 1; //card count
setarray .TradeTCG[0], 2; //card cost in tcg
set .TCGID, 12345; //your tcg id
end;
}

Not tested.

Posted (edited)

havent tested it yet, giving it a go right now. :)

everything is working fine except, the shop menu seems to be too small.

Untitled.jpg

Anyway to fix it?

up!

bump!

nope. also you can remove the ">" and spaces. maybe this help you :)

 

I forgot to add this :  .TradeCount[@buy] -= .hw; - after getitem function.

For deleting card count after buying.

 

земляк?:D

Edited by ocelote
Posted (edited)

Ill try it out. Sorry if u thought I was from ukraine :) I really love that country, Im actually from ph. 

/no1

 

write me if you need help

Edited by ocelote
Posted (edited)

Hi, just wondering with this script. Can it be updated daily automatically? Like it has a set of list of items already it and it randomly chooses those items and puts it on their list (max of 5) for a day, and after a 24 hour period, it refreshes into a new set of items.

 

I'm not sure if I explained it quite well xD

 

Maybe OnClock0000: and then it would automatically set .hw or something like that to 5 again? I dunno xD

Edited by PandaRapesHamster
Posted (edited)

Hi, just wondering with this script. Can it be updated daily automatically? Like it has a set of list of items already it and it randomly chooses those items and puts it on their list (max of 5) for a day, and after a 24 hour period, it refreshes into a new set of items.

 

I'm not sure if I explained it quite well xD

 

Maybe OnClock0000: and then it would automatically set .hw or something like that to 5 again? I dunno xD

that's totally a cool idea. I hope someone can make it. 

bumping this one up!

Edited by SevySevSevy
Posted

some like this?

OnClock0000:
setarray .TradeID[0], 4031; //your cards id
setarray .TradeCount[0], 1; //card count
setarray .TradeTCG[0], 2; //card cost in tcg
end;

sorry but i don't understand your post at all (my bad english :<)

Posted

some like this?

OnClock0000:
setarray .TradeID[0], 4031; //your cards id
setarray .TradeCount[0], 1; //card count
setarray .TradeTCG[0], 2; //card cost in tcg
end;

sorry but i don't understand your post at all (my bad english :<)

Yes, I think this is good. Now have to figure out how to make it choose 5 random items from the .TradeID[0] and put it on the sale list or something, is that possible?

Posted

 

some like this?

OnClock0000:
setarray .TradeID[0], 4031; //your cards id
setarray .TradeCount[0], 1; //card count
setarray .TradeTCG[0], 2; //card cost in tcg
end;

sorry but i don't understand your post at all (my bad english :<)

Yes, I think this is good. Now have to figure out how to make it choose 5 random items from the .TradeID[0] and put it on the sale list or something, is that possible?

 

OnClock2000:
.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = 5; // amount?
.SaleCost = 1; // cost?
end;

mes "Today sale : "+getitemname(.SaleID);
if(.SaleAmount == 0) {
     mes "No items for sale :<";
     close;
}

mes "It will cost you : "+yourid+" x "+.SaleCost;
mes "I have : "+.SaleAmount+" items!";
next;
if(select("Buy it:Nop") == 2) close;
if(countitem(yourid) < .SaleCost) close;
getitem .SaleID, 1;
.SaleAmount -= 1;
close;
Posted (edited)

OMG Thanks! I think this would work pretty well! It's pretty much an I idea I got from online web browser games. And I think from that can also put multiple item cost/what item is needed to buy it. Thanks alot :)

 

 

Managed to build this script up without errors, though haven't tested in-game. If someone can verify, I'd be really glad. If someone can also clean it up or optimize, I'd really be grateful. Hoping to use this soon if this works.

EDIT: Okay tested it on my server, it does work, but only for the first item. The next 4 items are all null. I guess this works if it only has one item to be sold, however I wanted it to sell 5 items total daily. I'm still looking for ways to make it that way.

EDIT 2: Okay, it lets me purchase without any Proof of Donations. It does register that Proof of Donations is the needed item, however it would not check if I have Proof of Donation in my inventory or not.

EDIT 3: Screenshot
 

post-30740-0-80753300-1433366479_thumb.jpg

 

EDIT 4: It now only limits player to purchase only 1 item per transaction. It still does not check for the required items.

prontera,150,150,6    script    Daily Item Sale    100,{


        for(set .@i,0; .@i < getarraysize(.TradeID); set .@i, .@i +1){
            if(.TradeID[.@i] != 0) {
                set .@menu$, .@menu$ + "^0000FF "+getitemname(.SaleID[.@i])+" ^000000 x "+.SaleAmount[.@i]+" x "+.TradeTCG[.@i]+"";
                set .@menu$, .@menu$ + ":";    
            }
        }        
            set @Buy,select(.@menu$)-1;
            mes "[Daily Item Sale]";
            mes "How many do you want to buy?";
            mes "Store now accepts: "+getitemname(.TCGID)+"";
            input .hw;
            if(.SaleAmount[@Buy] < .hw) {
                mes "[Daily Item Sale]";
                mes "I do not have that much items remaining.";
                close;
            }

            if(.hw > 1) {
                mes "[Daily Item Sale]";
                mes "You can only buy 1 item per transaction.";
                close;
            }
            
            if(countitem(.TCGID) < .TradeTCG[@Buy]*.hw){
                mes "[Daily Item Sale]";
                mes "You don't have enough "+getitemname(.TCGID)+".";
                close;
            }
            
            delitem .TCGID, .SaleCost[@Buy]*.hw;
            getitem .SaleID[@Buy], .hw;
            .SaleAmount -= 1;
            mes "[Daily Item Sale]";
            mes "Thank you for buying.";
            close;


OnClock0000:
.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
    set .TCGID, 7179;
    setarray .TradeTCG,3,3,10,15,15;
    end;
}
else if(.SaleReq == 7539){
    set .TCGID, 7539;
    setarray .TradeTCG,30,30,40,50,50;
    end;
}
else{
    set .TCGID, 7711;
    setarray .TradeTCG,50,50,75,90,90;
    end;
}
end;

/*

What this needs:

1. Checking if it works appropriately, I haven't checked it in-game. It compiles without any errors.

*/

OnInit:
setarray .TradeID[0], 12210,14533,14545,7619,7620; //your cards id
setarray .TradeCount[0], 5,5,5,3,3; //card count
setarray .TradeItemsReq, 7179,7539,7711; //pod, poring coin, event ticket

.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
    set .TCGID, 7179;
    setarray .TradeTCG,3,3,10,15,15;
    end;
}
if(.SaleReq == 7539){
    set .TCGID, 7539;
    setarray .TradeTCG,30,30,40,50,50;
    end;
}
else{
    set .TCGID, 7711;
    setarray .TradeTCG,50,50,75,90,90;
    end;
}
end;

end;
}
Edited by PandaRapesHamster
Posted (edited)

 

OMG Thanks! I think this would work pretty well! It's pretty much an I idea I got from online web browser games. And I think from that can also put multiple item cost/what item is needed to buy it. Thanks alot :)

 

 

Managed to build this script up without errors, though haven't tested in-game. If someone can verify, I'd be really glad. If someone can also clean it up or optimize, I'd really be grateful. Hoping to use this soon if this works.

EDIT: Okay tested it on my server, it does work, but only for the first item. The next 4 items are all null. I guess this works if it only has one item to be sold, however I wanted it to sell 5 items total daily. I'm still looking for ways to make it that way.

EDIT 2: Okay, it lets me purchase without any Proof of Donations. It does register that Proof of Donations is the needed item, however it would not check if I have Proof of Donation in my inventory or not.

EDIT 3: Screenshot
 

attachicon.gifscreenFlamesRO018.jpg

 

EDIT 4: It now only limits player to purchase only 1 item per transaction. It still does not check for the required items.

prontera,150,150,6    script    Daily Item Sale    100,{


        for(set .@i,0; .@i < getarraysize(.TradeID); set .@i, .@i +1){
            if(.TradeID[.@i] != 0) {
                set .@menu$, .@menu$ + "^0000FF "+getitemname(.SaleID[.@i])+" ^000000 x "+.SaleAmount[.@i]+" x "+.TradeTCG[.@i]+"";
                set .@menu$, .@menu$ + ":";    
            }
        }        
            set @Buy,select(.@menu$)-1;
            mes "[Daily Item Sale]";
            mes "How many do you want to buy?";
            mes "Store now accepts: "+getitemname(.TCGID)+"";
            input .hw;
            if(.SaleAmount[@Buy] < .hw) {
                mes "[Daily Item Sale]";
                mes "I do not have that much items remaining.";
                close;
            }

            if(.hw > 1) {
                mes "[Daily Item Sale]";
                mes "You can only buy 1 item per transaction.";
                close;
            }
            
            if(countitem(.TCGID) < .TradeTCG[@Buy]*.hw){
                mes "[Daily Item Sale]";
                mes "You don't have enough "+getitemname(.TCGID)+".";
                close;
            }
            
            delitem .TCGID, .SaleCost[@Buy]*.hw;
            getitem .SaleID[@Buy], .hw;
            .SaleAmount -= 1;
            mes "[Daily Item Sale]";
            mes "Thank you for buying.";
            close;


OnClock0000:
.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
    set .TCGID, 7179;
    setarray .TradeTCG,3,3,10,15,15;
    end;
}
else if(.SaleReq == 7539){
    set .TCGID, 7539;
    setarray .TradeTCG,30,30,40,50,50;
    end;
}
else{
    set .TCGID, 7711;
    setarray .TradeTCG,50,50,75,90,90;
    end;
}
end;

/*

What this needs:

1. Checking if it works appropriately, I haven't checked it in-game. It compiles without any errors.

*/

OnInit:
setarray .TradeID[0], 12210,14533,14545,7619,7620; //your cards id
setarray .TradeCount[0], 5,5,5,3,3; //card count
setarray .TradeItemsReq, 7179,7539,7711; //pod, poring coin, event ticket

.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
    set .TCGID, 7179;
    setarray .TradeTCG,3,3,10,15,15;
    end;
}
if(.SaleReq == 7539){
    set .TCGID, 7539;
    setarray .TradeTCG,30,30,40,50,50;
    end;
}
else{
    set .TCGID, 7711;
    setarray .TradeTCG,50,50,75,90,90;
    end;
}
end;

end;
}

OK. I will update it today ;)

Don't have time now.


bump, it's works now : 

prontera,150,150,6	script	Daily Item Sale	100,{

	mes "Hi";
	next;
	if(select("Sale!:All items") == 2) {
        for(set .@i,0; .@i < getarraysize(.TradeID); set .@i, .@i +1){
            if(.TradeID[.@i] != 0) {
                set .@menu$, .@menu$ + "^0000FF "+getitemname(.TradeID[.@i])+" ^000000 x "+.TradeCount[.@i]+" x "+.TradeItemsAmm[.@i]+"";
                set .@menu$, .@menu$ + ":";    
            }
        }        
		set .@Select, select(.@menu$) - 1;

		if(.TradeCount[.@Select] < 1) {
			mes "I don't have this item.";
			close;
		}
		
		mes "Do you want buy it?";
		mes "I need - "+getitemname(.TradeItemsReq[.@Select]);
		mes " x"+.TradeItemsAmm[.@Select];
		next;
		if(countitem(.TradeItemsReq[.@Select]) < .TradeItemsAmm[.@Select]) {
			mes "Where is my "+getitemname(.TradeItemsReq[.@Select]);
			close;
		}
		
		delitem .TradeItemsReq[.@Select], .TradeItemsAmm[.@Select];
		getitem .TradeID[.@Select], 1;
		.TradeCount[.@Select] -= 1;
		close;
	}
	
	for(set .@i,0; .@i < getarraysize(.TodaySale); set .@i, .@i +1){
		if(.TodaySale[.@i] != 0) {
			set .@menu$, .@menu$ + "^0000FF "+getitemname(.TodaySale[.@i])+" ^000000 x "+.TodayCount[.@i]+" x "+.TradeItemsAmm[.@i]+"";
			set .@menu$, .@menu$ + ":";    
		}
	} 
	
	set .@Select, select(.@menu$) - 1;

	if(.TodayCount[.@Select] < 1) {
		mes "I don't have this item.";
		close;
	}
	
	mes "Do you want buy it?";
	mes "I need - "+getitemname(.TradeItemsReq[.@Select]);
	mes " x"+.TradeItemsAmm[.@Select];
	next;
	if(countitem(.TradeItemsReq[.@Select]) < .TradeItemsAmm[.@Select]) {
		mes "Where is my "+getitemname(.TradeItemsReq[.@Select]);
		close;
	}
	
	delitem .TradeItemsReq[.@Select], .TradeItemsAmm[.@Select];
	getitem .TodaySale[.@Select], 1;
	.TodayCount[.@Select] -= 1;
	close;
	
OnInit:
setarray .TradeID[0], 12210, 14533, 14545, 7619, 7620, 7227, 7228, 7229, 7230; //your cards id
setarray .TradeCount[0], 5, 5, 5, 3, 3, 3, 2, 1, 3; //card count
setarray .TradeItemsReq[0], 7179, 7539, 7711, 7179, 7539, 7227, 7228, 7229, 7230; //pod, poring coin, event ticket
setarray .TradeItemsAmm[0], 1, 2, 3, 4, 5, 2, 3, 5, 4; // amount of ^ items

for(.i = 0; .i < 5; .i ++) { // 5 items
	if(.TradeID[.i] != 0) {
		.TodaySale[.i] += .TradeID[rand(getarraysize(.TradeID))];
		.TodayCount[.i] += .TradeCount[rand(getarraysize(.TradeCount))];
	}
}
end;

OnClock0000:
for(.i = 0; .i < 5; .i ++) { // 5 items
	if(.TradeID[.i] != 0) {
		.TodaySale[.i] += .TradeID[rand(getarraysize(.TradeID))];
		.TodayCount[.i] += .TradeCount[rand(getarraysize(.TradeCount))];
	}
}
}
Edited by ocelote
Posted

Sorry for necro-posting, but I'm still having trouble with my NPC. Anyone interested in helping me out?

 

//Original By: ocelote
//Modified By: Panda - GM Kazehaya

prontera,150,150,6	script	Daily Item Sale	100,{


		for(set .@i,0; .@i < 2; set .@i, .@i +1){
			if(.TradeID[.@i] != 0) {
				set .@menu$, .@menu$ + "^0000FF "+getitemname(.SaleID[.@i])+" ^000000 x"+.SaleAmount[.@i]+" x"+.TradeTCG[.@i]+"";
				set .@menu$, .@menu$ + ":";	
			}
		}		
			set @Buy,select(.@menu$)-1;
			mes "[Daily Item Sale]";
			mes "How many do you want to buy?";
			mes "Store now accepts: "+getitemname(.TCGID)+"";
			input .hw;
			if(.SaleAmount[@Buy] < .hw) {
				mes "[Daily Item Sale]";
				mes "I do not have that much items remaining.";
				close;
			}

			if(countitem(.TCGID) < .TradeTCG[@Buy]*.hw){
				mes "[Daily Item Sale]";
				mes "You don't have enough "+getitemname(.TCGID)+".";
				close;
			}
			
			delitem .TCGID, .TradeTCG[@Buy]*.hw;
			getitem .SaleID[@Buy], .hw;
			.SaleAmount -= 1;
			mes "[Daily Item Sale]";
			mes "Thank you for buying.";
			close;


OnClock0000:
.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
	set .TCGID, 7179;
	setarray .TradeTCG,3,3,10,15,15;
	end;
}
else if(.SaleReq == 7539){
	set .TCGID, 7539;
	setarray .TradeTCG,30,30,40,50,50;
	end;
}
else{
	set .TCGID, 7711;
	setarray .TradeTCG,50,50,75,90,90;
	end;
}
end;

/* 

What this needs:

1. Checking if it works appropriately, I haven't checked it in-game. It compiles without any errors.

*/

OnInit:
setarray .TradeID[0], 12210,14533,14545,7619,7620; //your cards id
setarray .TradeCount[0], 5,5,5,3,3; //card count
setarray .TradeItemsReq[0], 7179,7539,7711; //pod, poring coin, event ticket

.SaleID = .TradeID[rand(getarraysize(.TradeID))]; // get random id for sale
.SaleAmount = .TradeCount[rand(getarraysize(.TradeCount))]; // amount?
.SaleReq = .TradeItemsReq[rand(getarraysize(.TradeItemsReq))]; //item req. to buy

if(.SaleReq == 7179){
	set .TCGID, 7179;
	setarray .TradeTCG,3,3,10,15,15;
	end;
}
else if(.SaleReq == 7539){
	set .TCGID, 7539;
	setarray .TradeTCG,30,30,40,50,50;
	end;
}
else{
	set .TCGID, 7711;
	setarray .TradeTCG,50,50,75,90,90;
	end;
}
end;

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