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?
|
|
|
|
-
IttaBaby
- Bot

- Posts: 55
- Joined: Sat Apr 08, 2017 8:19 pm
Postby IttaBaby » Sat Jul 22, 2017 6:47 pm
PixelPest wrote:
Just copy the files into the level/episode folder
Doing that causes glitches in the death effects.
For some reason. It didn't used to, actually.
Edit: I think I know what's wrong now, it's probably because of having more than one character costumed, and the costume.luas cannot coexist. How do I solve this conundrum?
Edit:
Actually, it'd probably be smart to just learn how to change the death size, in case I go on to tweak something I should probably have that be separate from the costume system. (It's a worldwide costume force, just makin' everyone Mario World-y. I made cool Peach sprites custom too~)
Last edited by IttaBaby on Sun Jul 23, 2017 9:24 am, edited 2 times in total.
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Sun Jul 23, 2017 6:03 am
You can force a costume from Lua. If you load the playerManager API, you can call setCostume with a character ID and costume name.
|
|
|
|
|
|
|
|
|
-
squp
- Snifit

- Posts: 211
- Joined: Sat Aug 12, 2017 10:10 pm
- Flair: worm
- Pronouns: she/it
-
Contact:
Postby squp » Wed Aug 16, 2017 7:12 pm
How to make a boss have custom HP?
(please put the ENTIRE command as i have no idea how lua works
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Thu Sep 07, 2017 10:06 pm
Hey is there a way to pause the npcs on screen when the player dies? Like in NSMBWii U if the player is killed for whatever reason all moving npcs stop moving... I would post code but I don't know where to even begin with this.
|
|
|
|
|
|
|
|
|
-
Inspirited
- Snifit

- Posts: 242
- Joined: Sun Oct 30, 2016 5:58 pm
Postby Inspirited » Thu Sep 07, 2017 10:14 pm
CC_Comedic_Comentator wrote:Hey is there a way to pause the npcs on screen when the player dies? Like in NSMBWii U if the player is killed for whatever reason all moving npcs stop moving... I would post code but I don't know where to even begin with this.
Found this: http://wohlsoft.ru/pgewiki/PowerUDFreeze.lua though, it says "Does not yet work in mp" whatever that means.
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Thu Sep 07, 2017 10:23 pm
Thanks but that actually creates an annoyance that the traditional games have but this one doesn't. I usually don't have an problem getting Mario out of the way when he gets hurt by a npc. I'm asking about when he dies, does that api make it where if Mario dies all npcs, scrolling screen, moving plaforms will stop moving? I will post a reference video if needed.
Also the lua file is gone, its not in the dropbox link. So thanks but I can't even use that.
Edit: I figured out the functions Misc.pause and Misc.unpause do work for what I want but now I need to figure out how to determine when the player is dead so I can trigger those fuctions.
Edit2: Ok here is what I have,
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
Misc.pause();
end
Unfortunately this freezes everything including the dead player, soft-locking the game since the dead player never exits the screen via the bottom edge the game does nothing. So now how can I get the dead player to the bottom edge of the screen so the rest of the death event can occur or isolate the pausing to only the npcs? It doesn't freeze the entire game, I see animated objects still animate so its just soft-locked and not frozen. Also note in the code I did actually put it in an ontick even but I'm not showing function names as this is for a project of mine and the rest of the code doesn't pertain to this issue.
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Fri Sep 08, 2017 3:11 am
Try Defines.levelFreeze. That mimics the effect of the stopwatch, without the music.
Misc.pause() simualtes the pause menu, which also stops onTick from running.
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 3:49 pm
Hoeloe wrote:Try Defines.levelFreeze. That mimics the effect of the stopwatch, without the music.
Misc.pause() simualtes the pause menu, which also stops onTick from running.
Ok using Defines.levelFreeze = true causes the game to play the death sfx then end the death event like it is designed and all npcs freeze as intended. EXCEPT now the dead character freezes as well on screen.
Ex. What should happen:
Mario runs off of cliff/into lava or dies while little, death animation plays all other npcs are frozen and level exits or restarts (depending on world file preset)
Ex. What is happening instead:
Mario runs off of cliff/into lava or dies while little, death animation freezes in place all other npcs are frozen and level exits or restarts (depending on world file preset)
So how do I make Mario do his death animation (the up slightly than down thing) while Defines,levelFreeze is in effect or is this beyond LunaLua's current limits?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Sep 08, 2017 3:54 pm
You can do that but it's easier to just to freeze the NPCs (via NPC.dontMove) and also lock the animation frame
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 4:01 pm
PixelPest wrote:You can do that but it's easier to just to freeze the NPCs (via NPC.dontMove) and also lock the animation frame
ok well I was unaware of that, would I need to get a table of EVERY single npc in order to use that or would NPC.dontMove just work if I set it to true?
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
NPC.dontMove = true;
NPC.speedX = 0;
NPC.speedY = 0;
end
Will that freeze the NPCs as intended?
Edit: Tested, it does not work.
Edit2: Attempting to put all npcs in a single table:
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
tableOfNPCs = NPC.get();
if(table.getn(tableOfNPCs) > 0) then
for i=1,table.getn(tableOfNPCs) do
tableofNPCs.dontMove = true;
tableofNPCs.speedX = 0;
tableofNPCs.speedY = 0;
end
end
Gives: "has more thna 60 upvalues" error, so do I need a table for every single npc in this game for the npc class to work as desired??
Last edited by Chaotic Gaming on Fri Sep 08, 2017 4:21 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
The0x539
- Eerie

- Posts: 751
- Joined: Fri Jan 22, 2016 8:02 pm
Postby The0x539 » Fri Sep 08, 2017 4:20 pm
CC_Comedic_Comentator wrote:PixelPest wrote:You can do that but it's easier to just to freeze the NPCs (via NPC.dontMove) and also lock the animation frame
ok well I was unaware of that, would I need to get a table of EVERY single npc in order to use that or would NPC.dontMove just work if I set it to true?
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
NPC.dontMove = true;
NPC.speedX = 0;
NPC.speedY = 0;
end
Will that freeze the NPCs as intended?
Edit: Tested, it does not work.
The NPC class does not have those static fields, you would need to set those fields for each entry of the table output by NPC.get().
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 4:28 pm
The0x539 wrote:CC_Comedic_Comentator wrote:PixelPest wrote:You can do that but it's easier to just to freeze the NPCs (via NPC.dontMove) and also lock the animation frame
ok well I was unaware of that, would I need to get a table of EVERY single npc in order to use that or would NPC.dontMove just work if I set it to true?
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
NPC.dontMove = true;
NPC.speedX = 0;
NPC.speedY = 0;
end
Will that freeze the NPCs as intended?
Edit: Tested, it does not work.
The NPC class does not have those static fields, you would need to set those fields for each entry of the table output by NPC.get().
Read my edit, do I need to get a table for every npc using npc get? You realize there is a lot of npcs in smbx, right?
So let me get this straight, for this to work I need a table for goombas, a table for koopas, a table for thwomps, a table for boos, a table for every gosh darn moving enemy I want to not move on the player's death!!? That's going to take forever!
Edit2: ok fine I will try to build an api to do this, I hope it doesn't crash SMBX.
|
|
|
|
|
|
|
|
|
-
The0x539
- Eerie

- Posts: 751
- Joined: Fri Jan 22, 2016 8:02 pm
Postby The0x539 » Fri Sep 08, 2017 4:37 pm
CC_Comedic_Comentator wrote:The0x539 wrote:CC_Comedic_Comentator wrote:
ok well I was unaware of that, would I need to get a table of EVERY single npc in order to use that or would NPC.dontMove just work if I set it to true?
Code: Select all --in a ontick event
if player:mem(0x13E, FIELD_WORD) >= 1 then
NPC.dontMove = true;
NPC.speedX = 0;
NPC.speedY = 0;
end
Will that freeze the NPCs as intended?
Edit: Tested, it does not work.
The NPC class does not have those static fields, you would need to set those fields for each entry of the table output by NPC.get().
Read my edit, do I need to get a table for every npc using npc get? You realize there is a lot of npcs in smbx, right?
So let me get this straight, for this to work I need a table for goombas, a table for koopas, a table for thwomps, a table for boos, a table for every gosh darn moving enemy I want to not move on the player's death!!? That's going to take forever!
Edit2: ok fine I will try to build an api to do this, I hope it doesn't crash SMBX.
NPC.get() with no arguments returns a table of all NPC objects. NPC.get(-1,sectionIDOrTableThereof) returns a table of all NPC objectss in a section or section selection.
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 4:47 pm
The0x539 wrote:CC_Comedic_Comentator wrote:The0x539 wrote:
The NPC class does not have those static fields, you would need to set those fields for each entry of the table output by NPC.get().
Read my edit, do I need to get a table for every npc using npc get? You realize there is a lot of npcs in smbx, right?
So let me get this straight, for this to work I need a table for goombas, a table for koopas, a table for thwomps, a table for boos, a table for every gosh darn moving enemy I want to not move on the player's death!!? That's going to take forever!
Edit2: ok fine I will try to build an api to do this, I hope it doesn't crash SMBX.
NPC.get() with no arguments returns a table of all NPC objects. NPC.get(-1,sectionIDOrTableThereof) returns a table of all NPC objectss in a section or section selection.
NPC.get() and NPC.get(-1,-1) produces the "has more than 60 upvalues" error! As stated in the Wiki if you set the section ID to -1 it will reference the current section.
There simply are too many npcs to place in one table! So I ask again, am I going to have to make a table for every type of NPC to possibly be encountered (that's well over 100 enemy npc types) for what I am trying to get to work, to work??
Last edited by Chaotic Gaming on Fri Sep 08, 2017 4:55 pm, edited 2 times in total.
|
|
|
|
|
|
|
|
|
-
The0x539
- Eerie

- Posts: 751
- Joined: Fri Jan 22, 2016 8:02 pm
Postby The0x539 » Fri Sep 08, 2017 4:52 pm
CC_Comedic_Comentator wrote:The0x539 wrote:CC_Comedic_Comentator wrote:
Read my edit, do I need to get a table for every npc using npc get? You realize there is a lot of npcs in smbx, right?
So let me get this straight, for this to work I need a table for goombas, a table for koopas, a table for thwomps, a table for boos, a table for every gosh darn moving enemy I want to not move on the player's death!!? That's going to take forever!
Edit2: ok fine I will try to build an api to do this, I hope it doesn't crash SMBX.
NPC.get() with no arguments returns a table of all NPC objects. NPC.get(-1,sectionIDOrTableThereof) returns a table of all NPC objectss in a section or section selection.
NPC.get() and NPC.get(-1,-1) produces the "has more than 60 upvalues" error! As stated in the Wiki if you set the section ID to -1 it will reference the current section.
There simply are too many npcs to place in one table!
Either something's wrong with your code, or you're placing way too many NPCs. Almost certainly the former. The wiki does not state that specifying a section ID of -1 references "the current section", and in fact when one considers multiplayer there is no "current section". -1 for either argument ignores any filtering that would be based on that argument.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Sep 08, 2017 5:01 pm
NPC.get() when left with nothing inside the brackets gets every NPC in the level. I also don't know why you're declaring it separately, checking if its length is greater than zero, and then never actually calling the methods on the NPC objects but on the table itself.
This is the way it should look and I've also added it so that it freezes the frame as well as the movement and explained each line:
Code: Select all local pnpc = API.load("pnpc"); --load the pnpc library which allows us to set special variables to individual NPC instances
function onDraw() --use the onDraw() event because we want to deal with animation frame
if player:mem(0x13E, FIELD_WORD) > 0 then --this is the same as >= 1 but shorter
for _, v in pairs(NPC.get()) do --for all NPCs set each NPC object in the table from NPC.get() to v one at a time and perform the following actions to each of these NPCs
local npc = pnpc.wrap(v); --give the NPC a special data wrapper which allows us to set special variables unique to each NPC instance
if npc.data.frame == nil then --if our special variable hasn't been set yet with this name
npc.data.frame = v.animationFrame; --set this variable to the NPC's current frame
end
v.animationFrame = npc.data.frame; --make the NPC have the frame which we set the number of in our special variable
end
end
end
function onTick() --use the onTick() event because we want to deal with physics and general logic
if player:mem(0x13E, FIELD_WORD) > 0 then
for _, v in pairs(NPC.get()) do
v.dontMove = true;
v.speedX = 0;
v.speedY = -1*Defines.npc_grav; --in the vertical axis 0 doesn't indicate no movement because gravity is still acting on the NPCs so we check to see what the gravity acting on the NPCs is (by default about 0.26) so we multiple it by -1 to push the NPCs upward against gravity to hold them in place
end
end
end
Also btw when you have an error try to report what it is saying and post your code. This also shouldn't be an API and at this point you're not ready to make one so I'd suggest just dropping the code into a lunadll.lua file and putting that in your custom graphics/assets folder.
EDIT: Also that documentation's out of date but you also forgot the square brackets with the i in them in front of the table which says to access the object in the array in place i
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 5:09 pm
I made an API HUD (which is a visual aid) so don't tell me what I can and cannot make, I just cannot make an API for this type of situation is all. It would help if there wasn't so many broken pages in the wiki for a majority of the code, most of the links in red lead to broken pages. Half of this is like a secret or something and it should be shareable knowledge if that stuff is out of date, where are you all hiding the up to date documentation because I can't find anywhere else that has LunaLua documentation. Thank you anyway for the help. If you want to see the HUD API in action I am mentioning, subscribe to my YouTube channel and watch my next play-though of SMBX2, it will be in action in the video!
Last edited by Chaotic Gaming on Fri Sep 08, 2017 5:13 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Sep 08, 2017 5:12 pm
CC_Comedic_Comentator wrote:I made an API HUD (which is a visual aid) so don't tell me what I can and cannot make, I just cannot make an API for this type of situation is all. It would help if there wasn't so many broken pages in the wiki for a majority of the code, most of the links in red lead to broken pages. Half of this is like a secret or something and it should be shareable knowledge. Thank you anyway for the help. If you want to see the HUD API in action I am mentioning, subscribe to my YouTube channel and watch my next play-though of SMBX2, it will be in action in the video!
I was just suggesting that based on my perception of your inability to perform basic loops that the logical conclusion is that something more difficult (APIs) would not be achievable, but if you've done one alright. There aren't broken pages on the wiki; red links just don't lead to pages that have been created but are listed as possible links in the future. Also I'm not interested in your advertising or your channel
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Fri Sep 08, 2017 5:17 pm
I wasn't advertising I was just saying, if you want to see I am capable of writting APIs then there will be proof over there.
I've used JavaScript and GML (Game Maker Markup Language), lua is new to me so please don't make assumptions like that. I do know how to do simple loops in code, its just different in lua. (to continue this discussion without dragging off topic any further pm me please) On topic: Thank you again for helping me, I will use this as a learning experience as I am new to lua.
Edit: Ok now I need to stop the level from scrolling on levels that scroll because now stuff seems to float in place as the level continues to scroll on death. Also enemies that spawn things like item, hammers, and pellets still throw them and the produced projectile just stays in mid air lol. Can that be easily fixed?
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: Semrush [Bot] and 0 guests
|