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?
|
|
|
|
-
Nat The Porcupine
- Monty Mole

- Posts: 123
- Joined: Tue Nov 10, 2015 2:55 pm
Postby Nat The Porcupine » Mon Mar 21, 2016 4:27 pm
Silly question but... How does one remove a collider from existence? I have an API for a custom enemy that I'm working on and I can't figure out how to remove the colliders I attached to it after it dies.
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Mon Mar 21, 2016 4:28 pm
Mario_and_Luigi_55 wrote:
Why? The / is flipped it should be \
This is incorrect. Both / and \ will work, but \ is also the escape character (allowing characters like \n for newline), so to use it as a string it needs to be a double slash: \\. It's also worth noting that particles.lua is NOT included in the SMBX 2.0 beta by default (the update will, however, include it) because it was developed after the beta was released. It is likely that you simply do not have the "particles" folder included in your LuaScriptsLib folder.
Nat The Porcupine wrote:Silly question but... How does one remove a collider from existence? I have an API for a custom enemy that I'm working on and I can't figure out how to remove the colliders I attached to it after it dies.
You simply stop referencing the collider. Once you have no more references to a collider, Lua will destroy it for you. All you need to do is stop testing it, and set all the variables storing the colliders to nil.
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Mon Mar 21, 2016 4:32 pm
@Mario_and_Luigi_55: Try putting Misc.resolveFile() around the path.
Last edited by HenryRichard on Mon Mar 21, 2016 5:58 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
Nat The Porcupine
- Monty Mole

- Posts: 123
- Joined: Tue Nov 10, 2015 2:55 pm
Postby Nat The Porcupine » Mon Mar 21, 2016 5:14 pm
Hoeloe wrote:
You simply stop referencing the collider. Once you have no more references to a collider, Lua will destroy it for you. All you need to do is stop testing it, and set all the variables storing the colliders to nil.
Thanks. That helped me track down the issue I was having.
P.S. This API of yours is simply brilliant!
|
|
|
|
|
|
|
|
|
-
Alagirez
- Ludwig von Koopa

- Posts: 3617
- Joined: Tue Dec 02, 2014 2:28 am
- Flair: Legalize Awooo!
- Pronouns: He/Him/That wolf
-
Contact:
Postby Alagirez » Mon Mar 21, 2016 11:36 pm
Pls tell me how to change the fog color... (the fog comes from Particles.lua)
I mean fog this

|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 1:39 am
Hoeloe wrote:Mario_and_Luigi_55 wrote:
Why? The / is flipped it should be \
This is incorrect. Both / and \ will work, but \ is also the escape character (allowing characters like \n for newline), so to use it as a string it needs to be a double slash: \\. It's also worth noting that particles.lua is NOT included in the SMBX 2.0 beta by default (the update will, however, include it) because it was developed after the beta was released. It is likely that you simply do not have the "particles" folder included in your LuaScriptsLib folder.
Nat The Porcupine wrote:Silly question but... How does one remove a collider from existence? I have an API for a custom enemy that I'm working on and I can't figure out how to remove the colliders I attached to it after it dies.
You simply stop referencing the collider. Once you have no more references to a collider, Lua will destroy it for you. All you need to do is stop testing it, and set all the variables storing the colliders to nil.
I have particles in LuaScriptsLib and when I use \\ it gives me :
Debug
C:\Programy\SMBX 2 Open Beta \ LuaScriptsLitAparticles.lua:574: Could not open particle descriptor file C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini
(Path to p_snow.ini: "C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini"
and // - Can't fint file
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Mar 22, 2016 4:39 am
Mario_and_Luigi_55 wrote:
I have particles in LuaScriptsLib and when I use \\ it gives me :
Debug
C:\Programy\SMBX 2 Open Beta \ LuaScriptsLitAparticles.lua:574: Could not open particle descriptor file C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini
(Path to p_snow.ini: "C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini"
and // - Can't fint file
Please note that "particles.lua" is not the same thing as the "particles" folder. There should be a folder named "particles" in your LuaScriptsLib folder, with files such as "p_snow.ini" in it.
As I said before, \\ will give you the same result as /, but // makes no sense, as / isn't an escape character, which is why that doesn't work.
I suggest you try re-installing particles.
Camacho wrote:Pls tell me how to change the fog color... (the fog comes from Particles.lua)
I mean fog this

You can do this by copying the ini file into your level folder (from LuaScriptsLib/Particles) and adding a line into it. You need the hexadecimal colour code for the colour you want to use, and then add this line to the ini file:
This will tint it red, but if you fill in the hexadecimal colour code like this:
You will get any colour you like. It's also worth noting that when you copy the file into your level folder, you will need to change the path of the ini file in your code, as it will no longer be "particles/p_fog.ini", but just "p_fog.ini".
Alternatively, if you don't want to copy the ini file, you can do it from Lua too. When you create your fog particle system, just call:
Code: Select all fogEmitter:SetParam("col",particles.ColFromHexRGB(0x######));
Which will do exactly the same thing, but without copying the ini file.
|
|
|
|
|
|
|
|
|
-
Wohlstand
- Chargin' Chuck

- Posts: 2008
- Joined: Tue Feb 11, 2014 4:44 pm
- Flair: [ˈvoːlˌʃtant], 狐エンジニア
- Pronouns: he/him
-
Contact:
Postby Wohlstand » Tue Mar 22, 2016 5:29 am
HVMetal wrote:Hello!
So I decided to download LunaLua too... but when I wanted to test my level I got this error message:
Version of PGE is 0.3.1.8
Thanks for the help!
I see you placed PGE into folder with non-ASCII path, so, I fixed that bug and PGE can be placed in any folder with no dependency.
https://github.com/Wohlhabend-Networks/ ... 15b3abe7f5
|
|
|
|
|
|
|
|
|
-
Lukas Old Account
- Snifit

- Posts: 227
- Joined: Sat Mar 28, 2015 3:01 pm
Postby Lukas Old Account » Tue Mar 22, 2016 5:54 am
Greetings, I was having the idea of having a boss with a hp bar, but unfortunatly, I have no clue where to start, not even the slightest idea of how making the npc react to the hp bar. I need some help.
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 6:54 am
Hoeloe wrote:Mario_and_Luigi_55 wrote:
I have particles in LuaScriptsLib and when I use \\ it gives me :
Debug
C:\Programy\SMBX 2 Open Beta \ LuaScriptsLitAparticles.lua:574: Could not open particle descriptor file C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini
(Path to p_snow.ini: "C:\Programy\SMBX 2 Open Beta\LuaScriptsLib\particles\p_snow.ini"
and // - Can't fint file
Please note that "particles.lua" is not the same thing as the "particles" folder. There should be a folder named "particles" in your LuaScriptsLib folder, with files such as "p_snow.ini" in it.
As I said before, \\ will give you the same result as /, but // makes no sense, as / isn't an escape character, which is why that doesn't work.
I suggest you try re-installing particles.
Still doesn't work i tried copying to level folder. Could not open particle descriptor file.
Code: Select all local particles = loadAPI("particles");
local effect = particles.Emitter(0, 0, Misc.resolveFile("p_snow.ini"));
effect:AttachToCamera(Camera.get()[1]);
function onCameraUpdate()
effect:Draw();
end
Lua file
Code: Select all grad_1={0,0.2,1},{0,1,0}
colTime={0,0.5,1},{0xFFFFFF00,0xFFFFFF99,0xFFFFFF00}
limit=1000
rate=500:2000
xOffset=-800:800
yOffset=-600:600
rotation=40:45
speedX=-1:-200
speedY=1:250
texture=part_default.png
scale=0.25:0.5
lifetime=1
snow.ini (And yes, I copied texture file)
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Mar 22, 2016 6:57 am
Also make sure that you're using API.load instead of loadAPI
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 7:08 am
PixelPest wrote:Also make sure that you're using API.load instead of loadAPI
Attempt to index global 'API' (a nil value)
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Mar 22, 2016 7:09 am
Mario_and_Luigi_55 wrote:
Still doesn't work i tried copying to level folder. Could not open particle descriptor file.
Hoeloe wrote:
I suggest you try re-installing particles.
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 7:13 am
Hoeloe wrote:Mario_and_Luigi_55 wrote:
Still doesn't work i tried copying to level folder. Could not open particle descriptor file.
Hoeloe wrote:
I suggest you try re-installing particles.
I did that and still nothing...
It shows the error is in particles.lua in line 574 , so this:
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Mar 22, 2016 7:35 am
Mario_and_Luigi_55 wrote:PixelPest wrote:Also make sure that you're using API.load instead of loadAPI
Attempt to index global 'API' (a nil value)
AH. If this is your issue you probably have an outdated LunaLua version. Update it.
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 7:41 am
Hoeloe wrote:Mario_and_Luigi_55 wrote:PixelPest wrote:Also make sure that you're using API.load instead of loadAPI
Attempt to index global 'API' (a nil value)
AH. If this is your issue you probably have an outdated LunaLua version. Update it.
Now it's fine. Well, SMBX 2.0 has outdated Lua apparently.
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Mar 22, 2016 7:44 am
Mario_and_Luigi_55 wrote:
Now it's fine. Well, SMBX 2.0 has outdated Lua apparently.
Yes it does. There were a lot of changes made to LunaLua since the first beta was released. The updated version will have an up-to-date version.
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 11:20 am
Can I somehow save at the beggining of the level the powerup of the player and give it back to him after finishing the level?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Mar 22, 2016 11:31 am
Mario_and_Luigi_55 wrote:Can I somehow save at the beggining of the level the powerup of the player and give it back to him after finishing the level?
Use the parameter player.powerup
|
|
|
|
|
|
|
|
|
-
Mario_and_Luigi_55
- Spike

- Posts: 270
- Joined: Sat Feb 27, 2016 12:01 pm
Postby Mario_and_Luigi_55 » Tue Mar 22, 2016 11:38 am
PixelPest wrote:Mario_and_Luigi_55 wrote:Can I somehow save at the beggining of the level the powerup of the player and give it back to him after finishing the level?
Use the parameter player.powerup
Yes, but at the beggining I have to save the powerup. I made a custom powerup but the script is terrible I guess, because it uses powerup box. That's why I don't know how to save the powerup at the start of the level. Would that work
Code: Select all function onStart()
local savedpowerup=player.powerup
player.powerup=0
END
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 2 guests
|