LunaLua Offical Thread - SMBX Usermod Framework

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?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Hoeloe » Sat Jan 16, 2016 6:59 pm

HenryRichard wrote:Like, make a new variable for health and update it based on the player's conditions so you can make the powerup whatever you want. I'm working on a HUD that has the health redone, so when I'm done with it I'll let you know and you can look at it.
*cough* http://engine.wohlnet.ru/pgewiki/HUDofTime.lua

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sat Jan 16, 2016 8:42 pm

Hoeloe wrote:
HenryRichard wrote:Like, make a new variable for health and update it based on the player's conditions so you can make the powerup whatever you want. I'm working on a HUD that has the health redone, so when I'm done with it I'll let you know and you can look at it.
*cough* http://engine.wohlnet.ru/pgewiki/HUDofTime.lua
...forgot about that.
Is it possible for us to get some image manipulation functions in a later version? Not in 0.7.3, but maybe in 0.7.4 or 0.8, or dare I say 1.0?

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sun Jan 17, 2016 2:13 am

AeroMatter wrote:Forgive me if this sounds like a dumb question, but is any modding of netplay possible?
Nope, the built-in netplay system is unstable anyway.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Jan 17, 2016 4:43 am

@Kevsoft

I tried "Misc.pause()" and I have a bug when I do this the game make disappearing the hud but certain "palcesprite"
stay and some "Graphics.drawImage" is not showing, and that why I cant do unpause game , I think the input for drawimage is locked too :(

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sun Jan 17, 2016 6:55 am

You have to use the event "onDraw". This event is not affected by Misc.pause

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Jan 17, 2016 7:24 am

thnx I will check this soon :)
but how work "onDraw" and "onThick" and "onStart"
I'm little confused about those one :S

but onLoop and onLoad its ok i understand better now those one since i tried to do my inventory mod since a month :P

thanks

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Sun Jan 17, 2016 8:50 am

Could somebody please explain whats wrong with this code and how to fix it? I can't for the life of me figure out what's wrong with it.

Code: Select all

function onTick()
	tableOfShiny = NPC.get(10, -1); --get all smb3 coins in level
		
	if (table.getn(tableOfShiny) > 1) then
		for i=1,table.getn(tableOfShiny) do
			table.getn(tableOfShiny).id = 210; --change all smb3 coins into rinkas
		end
	end
end

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Jan 17, 2016 9:26 am

try this :

Code: Select all

MyNpcTest = 10
for k, v in pairs(NPC.get(MyNpcTest, -1)) do
 v.id = 210; --change all smb3 coins into rinkas
     end
thanks to you hehe I just learn this my self
I didnt know this one can change the things already in game
I wanna think only thing we spawn in game :P

But I tested this onLoop section for now

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Sun Jan 17, 2016 9:48 am

PixelPest wrote:Could somebody please explain whats wrong with this code and how to fix it? I can't for the life of me figure out what's wrong with it.

Code: Select all

function onTick()
	tableOfShiny = NPC.get(10, -1); --get all smb3 coins in level
		
	if (table.getn(tableOfShiny) > 1) then
		for i=1,table.getn(tableOfShiny) do
			table.getn(tableOfShiny).id = 210; --change all smb3 coins into rinkas
		end
	end
end
The onTick function only works with v.0.7.3 (the nightly/dev build).

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Sun Jan 17, 2016 9:51 am

lotus006 wrote:try this :

Code: Select all

MyNpcTest = 10
for k, v in pairs(NPC.get(MyNpcTest, -1)) do
 v.id = 210; --change all smb3 coins into rinkas
     end
thanks to you hehe I just learn this my self
I didnt know this one can change the things already in game
I wanna think only thing we spawn in game :P

But I tested this onLoop section for now
Thanks for trying to help but that code doesn't seem to work and it's a mess. There's really no reason to have
MyNpcTest = 10 when inside the brackets you can just write (10, -1). The form of the code itself is also a mess. It should be formatted as:

Code: Select all

function onTick()
	for k, v in pairs(NPC.get(10, -1)) do
		v.id = 210; --change all smb3 coins into rinkas
	end
end
TheDinoKing432 wrote:The onTick function only works with v.0.7.3 (the nightly/dev build).
Which I have.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Jan 17, 2016 9:55 am

PixelPest wrote:
lotus006 wrote:try this :

Code: Select all

MyNpcTest = 10
for k, v in pairs(NPC.get(MyNpcTest, -1)) do
 v.id = 210; --change all smb3 coins into rinkas
     end
thanks to you hehe I just learn this my self
I didnt know this one can change the things already in game
I wanna think only thing we spawn in game :P

But I tested this onLoop section for now
Thanks for trying to help but that code doesn't seem to work and it's a mess. There's really no reason to have
MyNpcTest = 10 when inside the brackets you can just write (10, -1). The form of the code itself is also a mess. It should be formatted as:

Code: Select all

function onTick()
	for k, v in pairs(NPC.get(10, -1)) do
		v.id = 210; --change all smb3 coins into rinkas
	end
end
I dont know why is not working on your side, on my is work well but I think the way you put the Id. 10 could work too :D
did you put it on onLoop section ?


and

I have the 0.7.3 , and I got this error index on the first code of PixelPest
table.getn(tableOfShiny).id = 210; --change all smb3 coins into rinkas
attempt to index a number value

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Sun Jan 17, 2016 9:59 am

Lotus, could you please post exactly what you tested with the function and everything?

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Jan 17, 2016 10:02 am

PixelPest wrote:Lotus, could you please post exactly what you tested with the function and everything?
try this in your lunaworld.lua it should work too, just for testing:

Code: Select all

function onLoop()
for k, v in pairs(NPC.get(10, -1)) do
	 v.id = 210; --change all smb3 coins into rinkas
end
end
     
Edit : it work also with (NPC.get(10, -1)) see above instead of MyNPCTest

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sun Jan 17, 2016 12:50 pm

lotus006 wrote:thnx I will check this soon :)
but how work "onDraw" and "onThick" and "onStart"
I'm little confused about those one :S

but onLoop and onLoad its ok i understand better now those one since i tried to do my inventory mod since a month :P

thanks
Basically:

Code: Select all

function onDraw()
...
end
... is called before SMBX draws anything.

Code: Select all

function onTick()
...
end
The new "onLoop", just with another name

Code: Select all

function onStart()
...
end
Is the first frame of SMBX running. The advantage over onLoad, is that it is guranteed that everything is initialized.

Axiom
Phanto
Phanto
Posts: 1471
Joined: Tue Dec 24, 2013 2:23 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Axiom » Sun Jan 17, 2016 5:52 pm

so can i play the sims in smbx yet

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Mon Jan 18, 2016 9:10 pm

Here's a fun little API I made--my first real Lua project:
http://www.mediafire.com/download/ibbdv ... kafest.lua

It turns all coins in a level into Rinkas.
Example:
Spoiler: show
Image
Image
Image

jamai3636
Shy Guy
Shy Guy
Posts: 7
Joined: Sun Jan 17, 2016 12:47 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby jamai3636 » Wed Jan 20, 2016 3:49 pm

Having worked on software for a large retail chain I feel I could pick this up very easily - however - whether or not I will use for my next level depends on whether or not there is an event that triggers on death.

That means if there is a way to have something trigger when you die. It would also have to be death from a specific enemy/projectile from the enemy. I guess something like the onNPCKill event but for the player instead.

I looked around but didn't see anything of the sort, maybe I just missed it? Maybe it is also a little too niche to have been implemented. Hopefully not :<

Thanks~

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Jan 20, 2016 7:27 pm

I found a way to see if we alive and it's look working well for now maybe need to verify with all way when the player die because i dont know if all stuff who hurt
is the same for all things :S


for debuging

Code: Select all

 Text.print(  "isAlive:"  .. player:mem(0x13E, FIELD_WORD) , 100, 100)
and the code to use

Code: Select all

player:mem(0x13E, FIELD_WORD) -- Player death animation timer

just put condition bigger than 1 and you will see when the player is dead
enjoy :D

Axiom
Phanto
Phanto
Posts: 1471
Joined: Tue Dec 24, 2013 2:23 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Axiom » Fri Jan 22, 2016 8:45 pm

lotus006 wrote:I found a way to see if we alive and it's look working well for now maybe need to verify with all way when the player die because i dont know if all stuff who hurt
is the same for all things :S


for debuging

Code: Select all

 Text.print(  "isAlive:"  .. player:mem(0x13E, FIELD_WORD) , 100, 100)
and the code to use

Code: Select all

player:mem(0x13E, FIELD_WORD) -- Player death animation timer

just put condition bigger than 1 and you will see when the player is dead
enjoy :D
yup, these fields are how i made my death counter.

https://github.com/Luigifan/lunaluascri ... er.lua#L29

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Fri Jan 22, 2016 9:25 pm

You can also just use player.DeathTimer

I prefer to use these fields when I can instead of player:mem.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari