Need help with lua? - LunaLua General Help

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
Goldenemerl64
Koopa Troopa
Koopa Troopa
Posts: 20
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Sun Jul 26, 2020 6:44 pm

oh ok, Thanks Again

User avatar
Goldenemerl64
Koopa Troopa
Koopa Troopa
Posts: 20
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Wed Jul 29, 2020 3:26 am

Quick Question: can i add harm types in Npc.txt?

Trying to make the spark slime not be killed by a spinjump.
Image

Sorry for the Terrible Gif

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Wed Jul 29, 2020 4:18 am

Harm types can only be set in lua. Think for example:
NPC.config[id].vulnerableharmtypes = {whatever you'd also put here in an npc-n.lua}
Also worth noting is that for IDs under 292, harm types can only be added, not replaced.
Ideas are useless if you can't make them real.
Image

User avatar
Goldenemerl64
Koopa Troopa
Koopa Troopa
Posts: 20
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Wed Jul 29, 2020 8:46 am

ok, Thanks

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Fri Jul 31, 2020 7:22 am

Goldenemerl64 wrote:
Wed Jul 29, 2020 8:46 am
ok, Thanks
Quick addendum: I was wrong in my previous message. The table isn't actually what you put in lua.
Basically, you know about npcManager.registerHarmTypes(id, harmList, effectTable), right?
The value contained in vulnerableharmtypes would be the harmList. If you also want to manipulate the effectTable, you have to use registerHarmTypes instead.
Ideas are useless if you can't make them real.
Image

User avatar
Goldenemerl64
Koopa Troopa
Koopa Troopa
Posts: 20
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Sat Aug 01, 2020 10:16 am

Quick addendum: I was wrong in my previous message. The table isn't actually what you put in lua.
Basically, you know about npcManager.registerHarmTypes(id, harmList, effectTable), right?
The value contained in vulnerableharmtypes would be the harmList. If you also want to manipulate the effectTable, you have to use registerHarmTypes instead.
Oh ok, Thanks for the Information.
Basically, you know about npcManager.registerHarmTypes(id, harmList, effectTable), right?
I Actually kinda know about that, but not to much about it.
The value contained in vulnerableharmtypes would be the harmList. If you also want to manipulate the effectTable, you have to use registerHarmTypes instead.
Where are those Located?

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Aug 01, 2020 10:22 am

Goldenemerl64 wrote:
Sat Aug 01, 2020 10:16 am
Where are those Located?
They are located in the previous quote. You can look at any npc-n.lua file for reference. registerHarmTypes gets the npc's ID, a list of harm types, and then a table of effect ids mapped to the respective harm type. Those correspond to the arguments and function in the previous quote.
Ideas are useless if you can't make them real.
Image

User avatar
the lolie
Koopa Troopa
Koopa Troopa
Posts: 27
Joined: Sat Jul 11, 2020 7:55 pm

Re: Need help with lua? - LunaLua General Help

Postby the lolie » Sat Aug 08, 2020 7:40 am

so... how do i make multi hp npcs?

User avatar
Fuyu
Wart
Wart
Posts: 3059
Joined: Sat Dec 21, 2013 2:40 pm

Re: Need help with lua? - LunaLua General Help

Postby Fuyu » Sat Aug 08, 2020 9:00 am

I don't know if I should make a thread for this or not since this is more of a suggestion rather than me asking for help. I've been playing Celeste lately, and I think it shows considering my last two levels, but something caught my attention and that is how it handles beat blocks.

If the player is colliding with the off version of the beat block said block doesn't turn solid until the player stops colliding with it. This of course in tandem with the music rhythm. I thought maybe the blinking blocks we have in SMBX 2.0 could work the same way, since I want to believe I am not alone when I think the player being pushed upon having the blocks become solid looks weird and wrong.

Keep in mind Celeste doesn't just not switch the blocks, it only switches those where the player isn't colliding with, and as soon as the player stops colliding with them it becomes solid.
Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Aug 08, 2020 9:37 am

Might be fun as an optional flag. By default I personally wouldn't wanna remove the possibilities in design put forth by killing players by crushing them in a timer challenge.
If you wanna do it on your own time, you can do a getIntersecting check over overlapping blocks to tag them with a variable that prevents them from transforming, and turning them into what they're supposed to be when the overlap stops (if the block was in the list from last frame but not the list from this frame). A way to blacklist such blocks from transforming that would work with an unmodified basegame beat block system might be to change their IDs temporarily to ones not registered to the transformation table, that merely look the same as the ones that actually switch. To figure out what Id they SHOULD have when overlap ends, I think there are some switch state variables you can use in the library that manages the beat rhythm.
Ideas are useless if you can't make them real.
Image

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1242
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Sat Aug 08, 2020 10:39 am

Enjl wrote:
Sat Aug 08, 2020 9:37 am
you can do a getIntersecting check over overlapping blocks to tag them with a variable that prevents them from transforming
No you can't. Beat blocks don't "transform" between different IDs, they change their state, so you'd have to prevent the state from changing for all blocks of this type, which is much more complicated and will drastically throw off the timing.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Aug 08, 2020 10:57 am

Hoeloe wrote:
Sat Aug 08, 2020 10:39 am
Enjl wrote:
Sat Aug 08, 2020 9:37 am
you can do a getIntersecting check over overlapping blocks to tag them with a variable that prevents them from transforming
No you can't. Beat blocks don't "transform" between different IDs, they change their state, so you'd have to prevent the state from changing for all blocks of this type, which is much more complicated and will drastically throw off the timing.
Ah, well, in that case, what I described is probably doable with the older library at the very least.
Ideas are useless if you can't make them real.
Image

User avatar
MarioLover64
Blooper
Blooper
Posts: 191
Joined: Fri Apr 26, 2019 6:09 pm

Re: Need help with lua? - LunaLua General Help

Postby MarioLover64 » Tue Aug 25, 2020 7:06 pm

MarioLover64 wrote:
Thu Aug 22, 2019 9:11 pm
ok so camLock refuses to work at all. it does absolutely nothing. There aren't even any errors.

Added in 36 seconds:
Oh yeah, here's my code

Code: Select all

--------------------------------------------------
-- World map code
-- Created 10:40 2020-8-25
--------------------------------------------------
extMap = require("extended_map")
camLock = require("camLock")
-- Run code on first frame of the world map
function onStart()
    --Your code here
	camLock.addZone(96,320,1216,864,1)
end

-- Run code every frame (~1/65 second)
-- (code will be executed before game logic will be processed)
function onTick()
    --Your code here
end

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Wed Aug 26, 2020 12:58 am

96,320,1216,864´are coordinates somewhere in section 11. Is that intentional? Right-click an object in the editor in the top left corner of where you want the zone and copy the X/Y coordinates to check.
Ideas are useless if you can't make them real.
Image

User avatar
MarioLover64
Blooper
Blooper
Posts: 191
Joined: Fri Apr 26, 2019 6:09 pm

Re: Need help with lua? - LunaLua General Help

Postby MarioLover64 » Wed Aug 26, 2020 1:58 am

What sections? This is for the world map

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8741
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Wed Aug 26, 2020 2:42 am

You didn't say so I didn't know, sorry.
Depending on which version of camlock this is, it might not work on the map. Does the script file have an "onDrawWorld" function?
If yes, you can try inserting Text.print statements in camlock to see what parts of the code run and what variables display what. The for loop in checkVolumes should have a zone that passes the position if statement.
Ideas are useless if you can't make them real.
Image

User avatar
MarioLover64
Blooper
Blooper
Posts: 191
Joined: Fri Apr 26, 2019 6:09 pm

Re: Need help with lua? - LunaLua General Help

Postby MarioLover64 » Wed Aug 26, 2020 9:14 am

1) I did

Code: Select all

--------------------------------------------------
-- World map code
-- Created 10:40 2020-8-25
--------------------------------------------------
2) it is the one included with Beta 4 patch 2 by default

Baemajinn
Goomba
Goomba
Posts: 2
Joined: Mon Sep 07, 2020 6:34 pm

Re: Need help with lua? - LunaLua General Help

Postby Baemajinn » Tue Sep 15, 2020 8:43 pm

Question: Is it possible to edit the score in lunalua? Add from it, subtract from it, etc. I looked on the wiki and found no variable or mem location for it.

User avatar
Dragon0307
Bob-omb
Bob-omb
Posts: 32
Joined: Sun Dec 08, 2019 8:21 am
Flair: I am a big stupid dumb dumb

Re: Need help with lua? - LunaLua General Help

Postby Dragon0307 » Sat Sep 26, 2020 2:20 pm

I tried to load a font from this page, specificaly the Superstar Saga one and then I got an error.
Image

I am using this code to load it:

Code: Select all

textplus.loadFont("Fonts/superstarsaga-b.ini")
I also tried placing it in the root directory and ommiting the "Fonts/" and it still didn't load. What am I doing wrong?

Also, to solve Baemajinn's question while I'm at it:
Baemajinn wrote:
Tue Sep 15, 2020 8:43 pm
Question: Is it possible to edit the score in lunalua? Add from it, subtract from it, etc. I looked on the wiki and found no variable or mem location for it.
You can go here: https://docs.codehaus.moe/#/constants/score
This ForumPost® is the intellectual property (IP) of Kamekverse LTD. All rights reserved.
UNAUTHORIZED USAGE IS VIABLE FOR CRIMINAL CHARGES ON THE GROUNDS OF COPYRIGHT INFRINGEMENT
ForumPost® is a registered patent of Kamekverse LTD.
Spoiler: show
And WHY are all the best episodes in the Projects section?

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1242
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Sat Sep 26, 2020 2:54 pm

Dragon0307 wrote:
Sat Sep 26, 2020 2:20 pm
I tried to load a font from this page, specificaly the Superstar Saga one and then I got an error.
Image

I am using this code to load it:

Code: Select all

textplus.loadFont("Fonts/superstarsaga-b.ini")
I also tried placing it in the root directory and ommiting the "Fonts/" and it still didn't load. What am I doing wrong?

You need to use Misc.resolveFile on the path.
Dragon0307 wrote:
Sat Sep 26, 2020 2:20 pm
Also, to solve Baemajinn's question while I'm at it:
This is not an answer to that question. Those are just the constants for the score popup effect.

The real answer is to use Misc.score(newScore), as documented here: https://docs.codehaus.moe/#/reference/misc


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 2 guests