ShopSystem.lua [v1.1] - in Episode/Level purchases!

Share and discuss custom LunaLua code and content packs for SMBX2.
Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

ShopSystem.lua [v1.1] - in Episode/Level purchases!

Postby Marioman2007 » Tue Mar 22, 2022 1:58 am

A basic shop library on which I've been working on for a while!
This script is based on anothercurrency.lua

GIF:
Spoiler: show
Image

Credits:
Me
Enjl

Special thanks:
Rednaxela - for helping me to add support for multiple shops
Enjl - for providing lots of useful feedback

Notes:
It is preferable to use anothercurrency.lua for your currencies, variable-based currencies are tedious to use in this shop system.

Documentation:
https://docs.google.com/document/d/1qJR ... sp=sharing

Download:
https://drive.google.com/file/d/1dR1Z3x ... sp=sharing

Enjoy and please give credits!
Last edited by Marioman2007 on Thu May 19, 2022 4:24 am, edited 2 times in total.

MegaDood
Torpedo Ted
Torpedo Ted
Posts: 1606
Joined: Wed Nov 01, 2017 2:43 am

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby MegaDood » Tue Mar 22, 2022 2:04 am

This is an amazing script! I'm glad to see it released.

georgespezi12
Dolphin
Dolphin
Posts: 88
Joined: Mon Jun 01, 2020 3:45 am

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby georgespezi12 » Tue Mar 22, 2022 4:58 am

An excellent thing about the shopsystem is that the music can be chosen for the shop itself to suit the theme of the episode!

POPME
Hoopster
Hoopster
Posts: 113
Joined: Mon Oct 25, 2021 11:04 pm
Flair: I like socializing with people online
Pronouns: He/Him
Contact:

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby POPME » Tue Mar 22, 2022 9:02 am

You have no idea how long I wanted an actually woking shop system

Thanks

AirShip
Ninji
Ninji
Posts: 972
Joined: Wed Jan 01, 2014 1:30 am
Flair: The Flying Ghost
Contact:

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby AirShip » Tue Mar 22, 2022 11:42 am

Incredible work! I will definitely use it in my next projects!

Bboyfergie
Goomba
Goomba
Posts: 1
Joined: Sun Mar 27, 2022 1:54 pm
Pronouns: he/him

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Bboyfergie » Tue Mar 29, 2022 4:23 pm

Thank you for this! It's super useful! How would I go about making a separate shop that only uses Dragon Coins?

Eric
Lakitu
Lakitu
Posts: 470
Joined: Sat Feb 10, 2018 2:17 am
Flair: Expectations are the seed for disappointment.
Pronouns: she/they
Contact:

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Eric » Tue Apr 05, 2022 1:40 pm

read the title and hoped i could finally add microtransactions to my episodes : (

Cool Script!

Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Marioman2007 » Wed Apr 06, 2022 9:48 am

Thanks everyone for the positive comments!!

Bboyfergie wrote:
Tue Mar 29, 2022 4:23 pm
Thank you for this! It's super useful! How would I go about making a separate shop that only uses Dragon Coins?
You can use anothercurrency.lua to create a currency for dragon coins and then use that currency for that shop.

POPME
Hoopster
Hoopster
Posts: 113
Joined: Mon Oct 25, 2021 11:04 pm
Flair: I like socializing with people online
Pronouns: He/Him
Contact:

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby POPME » Wed Apr 13, 2022 7:39 pm

Hey there

So this might be more of a thing with anothercurrency.lua, but whenever I use the shop in a level, there are two numbers in the top left that say either 0 or nil.

Is there a way to disable them?

Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Marioman2007 » Wed Apr 13, 2022 10:11 pm

POPME wrote:
Wed Apr 13, 2022 7:39 pm
Hey there

So this might be more of a thing with anothercurrency.lua, but whenever I use the shop in a level, there are two numbers in the top left that say either 0 or nil.

Is there a way to disable them?
The test level's luna.lua file is full of examples
Those two are examples for variable currencies
You can look for "Text.print" and remove the lines that have them.

Brian
Goomba
Goomba
Posts: 1
Joined: Thu Apr 28, 2022 10:49 pm

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Brian » Thu Apr 28, 2022 10:55 pm

Hello, first of all this script is just amazing.
I was just wondering, on the world map, the coins always stay at 0, while in the rest of my levels, the counter is correct. Is there any way to change the value of the coins for the world map?

Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: ShopSystem.lua [v1] - in Episode/Level purchases!

Postby Marioman2007 » Mon May 02, 2022 4:37 am

Brian wrote:
Thu Apr 28, 2022 10:55 pm
Hello, first of all this script is just amazing.
I was just wondering, on the world map, the coins always stay at 0, while in the rest of my levels, the counter is correct. Is there any way to change the value of the coins for the world map?

create a file called "map.lua" and put this code inside it:

Code: Select all

local HUDOverride = require("hudoverride")
local anothercurrency = require("anothercurrency")

HUDOverride.overworld.offsets.coins.value.y = -500

local coins = anothercurrency.registerCurrency("coins", true)
coins:registerLimit(9999, function() end)

local coinsY = 90
local coinsX = 190

function onDraw()
	Text.printWP(coins:getMoney(), 1, coinsX, coinsY, 5)
end

Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: ShopSystem.lua [v1.1] - in Episode/Level purchases!

Postby Marioman2007 » Thu May 19, 2022 4:26 am

Version 1.1 is out!

- Fixed the item drawing system
- added a new argument to registerItem that allows to change the color of the egg

Coldcolor900
Koopa
Koopa
Posts: 15
Joined: Tue Oct 23, 2018 1:15 pm
Pronouns: he/him

Re: ShopSystem.lua [v1.1] - in Episode/Level purchases!

Postby Coldcolor900 » Mon Jun 13, 2022 3:22 pm

i wonder if I can make this compatible with my Bowsers Fury Inventory library...

Ness-Wednesday
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 1514
Joined: Sun Jun 28, 2015 3:50 pm
Flair: Diverse Scouts
Pronouns: He/Him
Contact:

Re: ShopSystem.lua [v1.1] - in Episode/Level purchases!

Postby Ness-Wednesday » Mon Jun 13, 2022 4:55 pm

Such emotional poetry...
"a"
"b"
"c"
"gfhfghjfgkjghjkhvbgkjghkghjghjgcfydsrtawerftaewsygdrefuyhreuyraetgdrfyhdfjuyfcikjfiuypfuipluikhujkfgyujdt7yusrtesdtfgdsreyhftjuyo8uy9i56d7y43es5r3awr4eswfdxbvgmhj,iuj;89p7yg8uid4e52357569i7689itgjnhfcgbs5437r5ujgyhkhvgjdfgaew36547"

Jokes aside, this is a great API. I'm really excited to see how people use it

Marioman2007
Ripper II
Ripper II
Posts: 344
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: ShopSystem.lua [v1.1] - in Episode/Level purchases!

Postby Marioman2007 » Tue Jun 14, 2022 3:38 am

Coldcolor900 wrote:
Mon Jun 13, 2022 3:22 pm
i wonder if I can make this compatible with my Bowsers Fury Inventory library...
If you have a function to add items to the inventory, it will be pretty easy.


Return to “LunaLua”

Who is online

Users browsing this forum: smwturtlequest64 and 6 guests