Page 1 of 2
Alternate Power-up Systems
Posted: Fri Mar 18, 2016 4:38 pm
by PixelPest
After many fails and crashes today, I have successfully created a stable API that forces the power-up system in SMBX to act like the power-up systems in New Super Mario Bros. Wii, New Super Mario Bros. DS, and SMW. When the player loses their power-up (if that power-up is a Fire flower, Leaf, etc., and not a mushroom) they return to Big Mario instead of going straight from Fire Mario, Ice Mario, etc. back to Small Mario, as is the default system in SMBX. Write local altpsystem = API.load("altpsystem") in your lunadll.lua file to use this API after placing it in Lua Scripts Lib or your level folder. The SMW system makes the reserve power-up drop automatically when the player is hit.
Download altpsystem.lua:
https://www.dropbox.com/s/y2x3715f55ko0 ... m.lua?dl=0
Re: NSMB-style Power-up System
Posted: Fri Mar 18, 2016 7:27 pm
by lotus006
PixelPest wrote:After many fails and crashes today, I have successfully created a stable API that forces the power-up system in SMBX to act like the power-up systems in New Super Mario Bros. Wii, New Super Mario Bros. DS, etc. When the player loses their power-up (if that power-up is a Fire flower, Leaf, etc., and not a mushroom) they return to Big Mario instead of going straight from Fire Mario, Ice Mario, etc. back to Small Mario, as is the default system in SMBX. Write local altpsystem = API.load("altpsystem") in your lunadll.lua file to use this API after placing it in Lua Scripts Lib or your level folder.
Download altpsystem.lua:
https://www.dropbox.com/s/y2x3715f55ko0 ... m.lua?dl=0
Nice one, I hope this one will be in options too choose it in the 2.0

Re: NSMB-style Power-up System
Posted: Fri Mar 18, 2016 9:59 pm
by PixelPest
Thanks. I'm trying to see if I can get it as a default API for the next release of SMBX 2.0
Re: NSMB-style Power-up System
Posted: Sat Mar 19, 2016 7:28 am
by Mario_and_Luigi_55
That's strange! I did something similar yesterday and just today saw this thread

.
Well, mine is a bit different and not that good as yours. The main difference is that if I would use this in episode i would have to paste it in every level's lunadll.lua
Code: Select all
local mozliwazmiana = 0
local mozliwazmiana2 = 0
local potrzebnazmiana = 0
function onLoop()
if player.powerup == PLAYER_FIREFLOWER or player.powerup == PLAYER_LEAF or player.powerup == PLAYER_TANOOKIE or player.powerup == PLAYER_HAMMER or player.powerup == PLAYER_ICE then
mozliwazmiana = 1
end
if player:mem(0x122,FIELD_WORD) == 2 and mozliwazmiana == 1 then
potrzebnazmiana = 1
end
if player:mem(0x122,FIELD_WORD) == 1 or player:mem(0x122,FIELD_WORD) == 3 or player:mem(0x122,FIELD_WORD) == 4 or player:mem(0x122,FIELD_WORD) == 5 or player:mem(0x122,FIELD_WORD) == 7 or player:mem(0x122,FIELD_WORD) == 8 or player:mem(0x122,FIELD_WORD) == 11 player:mem(0x122,FIELD_WORD) == 12 or player:mem(0x122,FIELD_WORD) == 41 or player:mem(0x122,FIELD_WORD) == 500 then
if potrzebnazmiana == 1 then
mozliwazmiana2 = 1
end
end
if mozliwazmiana2 == 1
if potrzebnazmiana == 1 then
player.powerup = PLAYER_BIG
mozliwazmiana2 = 0
potrzebnazmiana = 0
mozliwazmiana = 0
end
end
end
It's super strange that we did something similar in one day isn't it?
Re: NSMB-style Power-up System
Posted: Sat Mar 19, 2016 7:29 am
by Trace
Awesome, ive always wanted something like this, this will be really good if you make hard levels but still want to make them easy without making them completly empty, and also without having toad the main playable ._.
Re: NSMB-style Power-up System
Posted: Sat Mar 19, 2016 3:44 pm
by PixelPest
Mario_and_Luigi_55 wrote:That's strange! I did something similar yesterday and just today saw this thread

.
Well, mine is a bit different and not that good as yours. The main difference is that if I would use this in episode i would have to paste it in every level's lunadll.lua
Code: Select all
local mozliwazmiana = 0
local mozliwazmiana2 = 0
local potrzebnazmiana = 0
function onLoop()
if player.powerup == PLAYER_FIREFLOWER or player.powerup == PLAYER_LEAF or player.powerup == PLAYER_TANOOKIE or player.powerup == PLAYER_HAMMER or player.powerup == PLAYER_ICE then
mozliwazmiana = 1
end
if player:mem(0x122,FIELD_WORD) == 2 and mozliwazmiana == 1 then
potrzebnazmiana = 1
end
if player:mem(0x122,FIELD_WORD) == 1 or player:mem(0x122,FIELD_WORD) == 3 or player:mem(0x122,FIELD_WORD) == 4 or player:mem(0x122,FIELD_WORD) == 5 or player:mem(0x122,FIELD_WORD) == 7 or player:mem(0x122,FIELD_WORD) == 8 or player:mem(0x122,FIELD_WORD) == 11 player:mem(0x122,FIELD_WORD) == 12 or player:mem(0x122,FIELD_WORD) == 41 or player:mem(0x122,FIELD_WORD) == 500 then
if potrzebnazmiana == 1 then
mozliwazmiana2 = 1
end
end
if mozliwazmiana2 == 1
if potrzebnazmiana == 1 then
player.powerup = PLAYER_BIG
mozliwazmiana2 = 0
potrzebnazmiana = 0
mozliwazmiana = 0
end
end
end
It's super strange that we did something similar in one day isn't it?
This is terribly inefficient. Why test for all of those things when you could just test to see if it isn't something?
Re: NSMB-style Power-up System
Posted: Fri Mar 25, 2016 7:29 pm
by afanguy
So, I tested it, but I have one TINY complain:
Whenever you collect items like: Fire Flower, Ice Flower, etc. you still get an extra-Mushroom for your item slot.
Other than that it is perfect!
Re: NSMB-style Power-up System
Posted: Fri Mar 25, 2016 7:57 pm
by HenryRichard
afanguy wrote:So, I tested it, but I have one TINY complain:
Whenever you collect items like: Fire Flower, Ice Flower, etc. you still get an extra-Mushroom for your item slot.
Other than that it is perfect!
That's the way it works in NSMB, but I imagine you could easily change that if you wanted to.
Re: NSMB-style Power-up System
Posted: Fri Mar 25, 2016 9:59 pm
by PixelPest
afanguy wrote:So, I tested it, but I have one TINY complain:
Whenever you collect items like: Fire Flower, Ice Flower, etc. you still get an extra-Mushroom for your item slot.
Other than that it is perfect!
That was intentionally left in, although I may consider changing it. It would be a quick fix
Re: NSMB-style Power-up System
Posted: Sat Mar 26, 2016 8:21 am
by afanguy
HenryRichard wrote:afanguy wrote:So, I tested it, but I have one TINY complain:
Whenever you collect items like: Fire Flower, Ice Flower, etc. you still get an extra-Mushroom for your item slot.
Other than that it is perfect!
That's the way it works in NSMB, but I imagine you could easily change that if you wanted to.
Really? Man I gotta play the game again, I might have forgotten that after playing all those Mario Maker Levels where you don't have an item slot.
Re: NSMB-style Power-up System
Posted: Sat Mar 26, 2016 8:24 am
by PixelPest
afanguy wrote:HenryRichard wrote:afanguy wrote:So, I tested it, but I have one TINY complain:
Whenever you collect items like: Fire Flower, Ice Flower, etc. you still get an extra-Mushroom for your item slot.
Other than that it is perfect!
That's the way it works in NSMB, but I imagine you could easily change that if you wanted to.
Really? Man I gotta play the game again, I might have forgotten that after playing all those Mario Maker Levels where you don't have an item slot.
NSMB games don't have a power-up slot in-game though...
Re: NSMB-style Power-up System
Posted: Sat Mar 26, 2016 8:29 am
by Zipper
PixelPest wrote:
NSMB games don't have a power-up slot in-game though...
NSMB DS allows you to store an item in the bottom screen.
Re: NSMB-style Power-up System
Posted: Sat Mar 26, 2016 8:29 am
by zlaker
PixelPest wrote:afanguy wrote:HenryRichard wrote:
That's the way it works in NSMB, but I imagine you could easily change that if you wanted to.
Really? Man I gotta play the game again, I might have forgotten that after playing all those Mario Maker Levels where you don't have an item slot.
NSMB games don't have a power-up slot in-game though...
They actually do have power-up slot in game, but that's only for the handheld games.

Re: NSMB-style Power-up System
Posted: Sat Mar 26, 2016 6:36 pm
by PixelPest
zlakergirl357 wrote:PixelPest wrote:afanguy wrote:
Really? Man I gotta play the game again, I might have forgotten that after playing all those Mario Maker Levels where you don't have an item slot.
NSMB games don't have a power-up slot in-game though...
They actually do have power-up slot in game, but that's only for the handheld games.

Thanks for mentioning that. Soon I'm going to update this. The following will be added to the previous system:
1. NSMBDS: Player can use item box, but when collecting a power-up from the Big Mario state, a mushroom will not be added to the item box.
2. NSMBWII: Player has no item box.
They will still be included as one Lua file.
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 12:08 pm
by HeroLinik
Thanks for this. It's something I've really wanted to add. However, it doesn't seem to be working when I try to put it into the LunaDLL file. Here's the code I've got:
Code: Select all
local storedpower = false --true if player has power-up other than mushroom
local canchange = false --true if it is safe to change the player's power-up
local needchange = false --true if the player's power-up needs to be changed
local altpsystem = API.load("altpsystem")
function altpsystem.onInitAPI()
registerEvent(altpsystem, "onTick", "onTick", false)
end
function onTick()
if player.powerup ~= PLAYER_BIG and player.powerup ~= PLAYER_SMALL then --if the player has a power-up other than a mushroom
storedpower = true
end
if player:mem(0x122,FIELD_WORD) == 2 and storedpower == true then --if the player is powering down (hit by an ememy but not killed)
needchange = true --the player's power-up needs to be changed from default, but cannot be yet, as it will cause an error while powering down
end
if player:mem(0x122,FIELD_WORD) ~= 2 and needchange == true then --if the player is not powering down
canchange = true --deem that it is safe to change the player's power-up
end
if canchange == true and needchange == true then --if the player's power-up needs to be changed and it is safe to change it
player.powerup = PLAYER_BIG --the player is now Big Mario
canchange = false --reset all values to false
needchange = false
storedpower = false
end
end
return altpsystem
What am I doing wrong, and how can it be fixed?
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 12:20 pm
by h2643
Why are you putting that in a LunaDLL file and not LunaLua file..?
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 12:22 pm
by HeroLinik
h2643 wrote:Why are you putting that in a LunaDLL file and not LunaLua file..?
I meant lunadll.lua.
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 12:25 pm
by PixelPest
Linik wrote:Thanks for this. It's something I've really wanted to add. However, it doesn't seem to be working when I try to put it into the LunaDLL file. Here's the code I've got:
Code: Select all
local storedpower = false --true if player has power-up other than mushroom
local canchange = false --true if it is safe to change the player's power-up
local needchange = false --true if the player's power-up needs to be changed
local altpsystem = API.load("altpsystem")
function altpsystem.onInitAPI()
registerEvent(altpsystem, "onTick", "onTick", false)
end
function onTick()
if player.powerup ~= PLAYER_BIG and player.powerup ~= PLAYER_SMALL then --if the player has a power-up other than a mushroom
storedpower = true
end
if player:mem(0x122,FIELD_WORD) == 2 and storedpower == true then --if the player is powering down (hit by an ememy but not killed)
needchange = true --the player's power-up needs to be changed from default, but cannot be yet, as it will cause an error while powering down
end
if player:mem(0x122,FIELD_WORD) ~= 2 and needchange == true then --if the player is not powering down
canchange = true --deem that it is safe to change the player's power-up
end
if canchange == true and needchange == true then --if the player's power-up needs to be changed and it is safe to change it
player.powerup = PLAYER_BIG --the player is now Big Mario
canchange = false --reset all values to false
needchange = false
storedpower = false
end
end
return altpsystem
What am I doing wrong, and how can it be fixed?
I have no idea what you're trying to do, but try putting this into your Lunadll.lua instead:
Code: Select all
local storedpower = false --true if player has power-up other than mushroom
local canchange = false --true if it is safe to change the player's power-up
local needchange = false --true if the player's power-up needs to be changed
function onTick()
if player.powerup ~= PLAYER_BIG and player.powerup ~= PLAYER_SMALL then --if the player has a power-up other than a mushroom
storedpower = true
end
if player:mem(0x122,FIELD_WORD) == 2 and storedpower == true then --if the player is powering down (hit by an ememy but not killed)
needchange = true --the player's power-up needs to be changed from default, but cannot be yet, as it will cause an error while powering down
end
if player:mem(0x122,FIELD_WORD) ~= 2 and needchange == true then --if the player is not powering down
canchange = true --deem that it is safe to change the player's power-up
end
if canchange == true and needchange == true then --if the player's power-up needs to be changed and it is safe to change it
player.powerup = PLAYER_BIG --the player is now Big Mario
canchange = false --reset all values to false
needchange = false
storedpower = false
end
end
It's best just to put the API in the same folder as your Lunadll.lua and use local altpsystem = API.load("altpsystem")
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 12:53 pm
by HeroLinik
PixelPest wrote:I have no idea what you're trying to do, but try putting this into your Lunadll.lua instead:
Code: Select all
local storedpower = false --true if player has power-up other than mushroom
local canchange = false --true if it is safe to change the player's power-up
local needchange = false --true if the player's power-up needs to be changed
function onTick()
if player.powerup ~= PLAYER_BIG and player.powerup ~= PLAYER_SMALL then --if the player has a power-up other than a mushroom
storedpower = true
end
if player:mem(0x122,FIELD_WORD) == 2 and storedpower == true then --if the player is powering down (hit by an ememy but not killed)
needchange = true --the player's power-up needs to be changed from default, but cannot be yet, as it will cause an error while powering down
end
if player:mem(0x122,FIELD_WORD) ~= 2 and needchange == true then --if the player is not powering down
canchange = true --deem that it is safe to change the player's power-up
end
if canchange == true and needchange == true then --if the player's power-up needs to be changed and it is safe to change it
player.powerup = PLAYER_BIG --the player is now Big Mario
canchange = false --reset all values to false
needchange = false
storedpower = false
end
end
It's best just to put the API in the same folder as your Lunadll.lua and use local altpsystem = API.load("altpsystem")
Even that is still not working. I've also tried using API.Load(string altpsystem) but that doesn't seem to work either.
Re: NSMB-style Power-up System
Posted: Thu Mar 31, 2016 4:59 pm
by PixelPest
Linik wrote:PixelPest wrote:I have no idea what you're trying to do, but try putting this into your Lunadll.lua instead:
Code: Select all
local storedpower = false --true if player has power-up other than mushroom
local canchange = false --true if it is safe to change the player's power-up
local needchange = false --true if the player's power-up needs to be changed
function onTick()
if player.powerup ~= PLAYER_BIG and player.powerup ~= PLAYER_SMALL then --if the player has a power-up other than a mushroom
storedpower = true
end
if player:mem(0x122,FIELD_WORD) == 2 and storedpower == true then --if the player is powering down (hit by an ememy but not killed)
needchange = true --the player's power-up needs to be changed from default, but cannot be yet, as it will cause an error while powering down
end
if player:mem(0x122,FIELD_WORD) ~= 2 and needchange == true then --if the player is not powering down
canchange = true --deem that it is safe to change the player's power-up
end
if canchange == true and needchange == true then --if the player's power-up needs to be changed and it is safe to change it
player.powerup = PLAYER_BIG --the player is now Big Mario
canchange = false --reset all values to false
needchange = false
storedpower = false
end
end
It's best just to put the API in the same folder as your Lunadll.lua and use local altpsystem = API.load("altpsystem")
Even that is still not working. I've also tried using API.Load(string altpsystem) but that doesn't seem to work either.
What error are you getting and what version of LunaLua do you have?