This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Mar 18, 2016 4:38 pm
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
Last edited by PixelPest on Thu May 05, 2016 5:49 pm, edited 2 times in total.
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Fri Mar 18, 2016 7:27 pm
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 
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Mar 18, 2016 9:59 pm
Thanks. I'm trying to see if I can get it as a default API for the next release of SMBX 2.0
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Sat Mar 19, 2016 7:28 am
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?
|
|
|
|
|
|
|
|
|
-
Trace
- Nipper

- Posts: 431
- Joined: Thu Jun 19, 2014 7:45 am
Postby Trace » Sat Mar 19, 2016 7:29 am
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 ._.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Mar 19, 2016 3:44 pm
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?
|
|
|
|
|
|
|
|
|
-
afanguy
- Spiny

- Posts: 28
- Joined: Sat Jan 09, 2016 6:09 pm
-
Contact:
Postby afanguy » Fri Mar 25, 2016 7:29 pm
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!
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Fri Mar 25, 2016 7:57 pm
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.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Mar 25, 2016 9:59 pm
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
|
|
|
|
|
|
|
|
|
-
afanguy
- Spiny

- Posts: 28
- Joined: Sat Jan 09, 2016 6:09 pm
-
Contact:
Postby afanguy » Sat Mar 26, 2016 8:21 am
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.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Mar 26, 2016 8:24 am
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...
|
|
|
|
|
|
|
|
|
-
Zipper
- Ripper II

- Posts: 354
- Joined: Wed Aug 12, 2015 11:31 am
-
Contact:
Postby Zipper » Sat Mar 26, 2016 8:29 am
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.
|
|
|
|
|
|
|
|
|
-
zlaker
- Reznor

- Posts: 2844
- Joined: Fri Dec 20, 2013 1:46 pm
Postby zlaker » Sat Mar 26, 2016 8:29 am
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.

|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Mar 26, 2016 6:36 pm
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.
|
|
|
|
|
|
|
|
|
-
HeroLinik
- Larry Koopa

- Posts: 3464
- Joined: Fri Dec 20, 2013 1:28 pm
-
Contact:
Postby HeroLinik » Thu Mar 31, 2016 12:08 pm
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?
|
|
|
|
|
|
|
|
|
-
h2643
- Reznor

- Posts: 2890
- Joined: Sat Dec 21, 2013 7:23 am
-
Contact:
Postby h2643 » Thu Mar 31, 2016 12:20 pm
Why are you putting that in a LunaDLL file and not LunaLua file..?
|
|
|
|
|
|
|
|
|
-
HeroLinik
- Larry Koopa

- Posts: 3464
- Joined: Fri Dec 20, 2013 1:28 pm
-
Contact:
Postby HeroLinik » Thu Mar 31, 2016 12:22 pm
h2643 wrote:Why are you putting that in a LunaDLL file and not LunaLua file..?
I meant lunadll.lua.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Thu Mar 31, 2016 12:25 pm
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")
|
|
|
|
|
|
|
|
|
-
HeroLinik
- Larry Koopa

- Posts: 3464
- Joined: Fri Dec 20, 2013 1:28 pm
-
Contact:
Postby HeroLinik » Thu Mar 31, 2016 12:53 pm
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.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Thu Mar 31, 2016 4:59 pm
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?
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 3 guests
|