how do i make a tool that is a shop

[PIG] g55
Joined 26/08/2020
Posts 305
06:43 PM 24/11/2022
or how do i make currency, for example when u get a kill you get some currency or something, then u can spend that currency on the shop for a different weapon


[TRE] kringlePringles
Joined 25/06/2019
Posts 95
07:35 AM 02/12/2022
So I took way too long to make this.

My answer to your question is that you use an array to keep a reference of the items you want to sell.
You could make the GUI however you want, but to make it easier for you, just download this script from the link below:

https://drive.google.com/file/d/1S_FiSnjNHa6CvOvC1sqkAhw9DL3urLnQ/view?usp=sharing

This script MAY or MAY NOT be incompatible with other scripts, which would definitely suck if you just wanted to put this script into your game without it haphazardly breaking everything. I can only apologize for any inconveniences that may occur.


The shop GUI appears in printed text, and it lets you navigate it via keypress.


[TRE] kringlePringles
Joined 25/06/2019
Posts 95
07:35 AM 02/12/2022
Quote from kringlePringles , 07:35 AM 02/12/2022
So I took way too long to make this.

My answer to your question is that you use an array to keep a reference of the items you want to sell.
You could make the GUI however you want, but to make it easier for you, just download this script from the link below:

https://drive.google.com/file/d/1S_FiSnjNHa6CvOvC1sqkAhw9DL3urLnQ/view?usp=sharing

This script MAY or MAY NOT be incompatible with other scripts, which would definitely suck if you just wanted to put this script into your game without it haphazardly breaking everything. I can only apologize for any inconveniences that may occur.


The shop GUI appears in printed text, and it lets you navigate it via keypress.
Now how do you make items? My lazy answer is that you COULD just read the entire script and test how it works... but here's a sort of jump start on how to use it:


If you already created a tool outside the array, you just type down the model and the tool itself as an object inside an array like so:
let ToolBrickBuddyPlush = new Tool("Brick Buddy Plush"); //Brick Buddy Plush
ToolBrickBuddyPlush.on("activated", p => p.centerPrint("Aww...",2));

let daShopItems = [
{//this is normally what you write if you have already set the tools
Tool : ToolBrickBuddyPlush,
Name : ToolBrickBuddyPlush.name,
Desc : "So cute, so chic, and very cuddly!",
Cost : 1001,
Model : 344025
}
]


[TRE] kringlePringles
Joined 25/06/2019
Posts 95
07:37 AM 02/12/2022
Quote from kringlePringles , 07:35 AM 02/12/2022
Quote from kringlePringles , 07:35 AM 02/12/2022
So I took way too long to make this.

My answer to your question is that you use an array to keep a reference of the items you want to sell.
You could make the GUI however you want, but to make it easier for you, just download this script from the link below:

https://drive.google.com/file/d/1S_FiSnjNHa6CvOvC1sqkAhw9DL3urLnQ/view?usp=sharing

This script MAY or MAY NOT be incompatible with other scripts, which would definitely suck if you just wanted to put this script into your game without it haphazardly breaking everything. I can only apologize for any inconveniences that may occur.


The shop GUI appears in printed text, and it lets you navigate it via keypress.

Now how do you make items? My lazy answer is that you COULD just read the entire script and test how it works... but here's a sort of jump start on how to use it:


If you already created a tool outside the array, you just type down the model and the tool itself as an object inside an array like so:
let ToolBrickBuddyPlush = new Tool("Brick Buddy Plush"); //Brick Buddy Plush
ToolBrickBuddyPlush.on("activated", p => p.centerPrint("Aww...",2));

let daShopItems = [
{//this is normally what you write if you have already set the tools
Tool : ToolBrickBuddyPlush,
Name : ToolBrickBuddyPlush.name,
Desc : "So cute, so chic, and very cuddly!",
Cost : 1001,
Model : 344025
}
]
Well damn it that didn't work. Oh well I'll just remove the formatting.

But if you wanted to make consumables that let you carry as many of it as you want... or for whatever reason you just wanted to make the tool itself inside the array... you could just do this:

let daShopItems = [
{
Tool : new Tool("ToolItemTemplate"),
Name : "ToolItemTemplate",
Desc : "Allows you to write descriptions and flavor text!",
Cost : 1000,
Model : undefined,

Multi : true,

Equipped : function (p) {
p.bottomPrint("You equipped tool...",3);
},
Unequipped : function (p) {
p.bottomPrint("You unequipped tool...",3);
},
Activated : function (p, me){
p.bottomPrint("You activated tool...",2);
setTimeout(p.destroyTool(p.inventory.find(tool => tool.id === this.id && tool.name === this.name)), 2000);
}
}


[TRE] kringlePringles
Joined 25/06/2019
Posts 95
07:40 AM 02/12/2022
You could always read the script and see how it works, because we'd be here all day if I keep talking about it.

Just know that the player.setInterval() function will always handle interval stuff related to items.

And sorry for the long line of posts.

1