Page 14 of 32
Re: Need help with lua? - LunaLua General Help
Posted: Sun Jul 26, 2020 6:44 pm
by Goldenemerl64
oh ok, Thanks Again
Re: Need help with lua? - LunaLua General Help
Posted: Wed Jul 29, 2020 3:26 am
by Goldenemerl64
Quick Question: can i add harm types in Npc.txt?
Trying to make the spark slime not be killed by a spinjump.
Sorry for the Terrible Gif
Re: Need help with lua? - LunaLua General Help
Posted: Wed Jul 29, 2020 4:18 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Wed Jul 29, 2020 8:46 am
by Goldenemerl64
ok, Thanks
Re: Need help with lua? - LunaLua General Help
Posted: Fri Jul 31, 2020 7:22 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 01, 2020 10:16 am
by Goldenemerl64
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?
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 01, 2020 10:22 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 08, 2020 7:40 am
by lolcode
so... how do i make multi hp npcs?
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 08, 2020 9:00 am
by Fuyu
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 08, 2020 9:37 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 08, 2020 10:39 am
by Hoeloe
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Aug 08, 2020 10:57 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Tue Aug 25, 2020 7:06 pm
by MarioLover64
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
Re: Need help with lua? - LunaLua General Help
Posted: Wed Aug 26, 2020 12:58 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Wed Aug 26, 2020 1:58 am
by MarioLover64
What sections? This is for the world map
Re: Need help with lua? - LunaLua General Help
Posted: Wed Aug 26, 2020 2:42 am
by Emral
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.
Re: Need help with lua? - LunaLua General Help
Posted: Wed Aug 26, 2020 9:14 am
by MarioLover64
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
Re: Need help with lua? - LunaLua General Help
Posted: Tue Sep 15, 2020 8:43 pm
by baenyth
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.
Re: Need help with lua? - LunaLua General Help
Posted: Sat Sep 26, 2020 2:20 pm
by ShadowXeldron
I tried to load a font from
this page, specificaly the Superstar Saga one and then I got an error.
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
Re: Need help with lua? - LunaLua General Help
Posted: Sat Sep 26, 2020 2:54 pm
by Hoeloe
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.
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