Page 32 of 47

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Jan 16, 2016 6:59 pm
by Hoeloe
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Jan 16, 2016 8:42 pm
by HenryRichard
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?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 2:13 am
by Kevsoft
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 4:43 am
by lotus006
@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 :(

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 6:55 am
by Kevsoft
You have to use the event "onDraw". This event is not affected by Misc.pause

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 7:24 am
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 8:50 am
by PixelPest
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 9:26 am
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 9:48 am
by TDK
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).

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 9:51 am
by PixelPest
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 9:55 am
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 9:59 am
by PixelPest
Lotus, could you please post exactly what you tested with the function and everything?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 10:02 am
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 12:50 pm
by Kevsoft
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Jan 17, 2016 5:52 pm
by Axiom
so can i play the sims in smbx yet

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Jan 18, 2016 9:10 pm
by PixelPest
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Wed Jan 20, 2016 3:49 pm
by jamai3636
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~

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Wed Jan 20, 2016 7:27 pm
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Fri Jan 22, 2016 8:45 pm
by Axiom
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Fri Jan 22, 2016 9:25 pm
by HenryRichard
You can also just use player.DeathTimer

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