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
TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Mon Jan 04, 2016 5:03 pm

Three Question:
1. How do I make an NPC not collide with other NPCs without making it friendly using LunaLua, similar to the 'noblockcollision' NPC code?
2. How I make upside-down venus fire trap, and is it possible to put normal and upside-down venus fire trap in the same level?
3. How do I make hammer bro throw more hammers?
Last edited by TDK on Mon Jan 04, 2016 5:47 pm, edited 1 time in total.

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 04, 2016 5:36 pm

For the first one it's easiest just to put npcblock=0.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Mon Jan 04, 2016 5:44 pm

PixelPest wrote:For the first one it's easiest just to put npcblock=0.
Wow... I forgot about that.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Wohlstand » Mon Jan 04, 2016 6:59 pm

Imaynotbehere4long wrote:
4matsy wrote:The original SMBX 1.3 used Windows' own built-in software renderer to draw all the graphics
Wohlstand wrote:Since OpenGL uses hardware to render, it uses texture buffer provided by video card, but it usually gives limits in a max width/height, be careful!
for example 4096x4096 is a max size on ATI Radeon 9200
So, in other words, there's nothing you can do about it and some 1.3 levels will be incompatible with LunaLua, correct? If so, this should be reported to the SMBX 2.0 devs since they think all 1.3 levels will be compatible with LunaLua.
SMBX 1.3's levels are COMPATIBLE with LunaLUA-SMBX. This case is only for super-long blocks which is a super-useless here (most of blocks are always <300x300 or some exceptions are fitting into 800x600 screen size or even 1024x1024 but not bigger), so, it's alone incompatibility case. Sizable blocks are not counting because there are repdering with piece-by-piece tiling, so, result drawing is pseudo-solid (because drawn in more than one draw step). Original SMBX 1.3 uses GDI, 4matsy, it's not "own renderer", it's built-in software Windows's drawing API used to draw fonts, images and other stuff. LunaLUA-SMBX uses OpenGL to draw stuff but for computers where OpenGL not works because shitty video card, LunaLUA-SMBX enables a GDI mode to keep ability to play LunaLUA-SMBX anyway.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Tue Jan 05, 2016 1:08 am

Hi everybody :D

I have a question about arg in function and variable, I'm trying to make vartest2 increment wich vartest2 is
an argument and I put a variable onto but the function work when I put the real local variable (that11) but when
I use vartest2 it not incrementing. i tested to see wich value vartest2 give and it give 0. any Idea ?

Code: Select all

function CheatsMenu_API.onLoopOverride()

ButtonPressed(2, 5, 0 , 50, that11)

ThistextAA(Atext, Increment, that11 )

end


Code: Select all

local AmountMin = 0
local AmountMax = 0

function ButtonPressed(Sec, Tick, Min, Max, vartest)
		
if (vartest <= Min ) then
vartest = Min
that11 = Min
AmountMin = 1
else
Tick = Tick
AmountMin = 0
end


if (vartest >= Max) then
vartest = Max
that11 = Max
AmountMax = 1
else

AmountMax = 0
end

 
 	if (SecondsRight <= 0) then
		SecondsRight = 0

	end
 
		if (ButtonR == 1)    then
  		SecAmountB = Sec 
		SecTickB = Tick
  
		
	 	SecondsRight = SecAmountB 
	end





	if (SecondsLeft <= 0) then
		SecondsLeft = 0

	end

		if (ButtonL == 1)    then
    	SecAmountA = Sec 
		SecTickA = Tick
  
	
		SecondsLeft = SecAmountA 
	end

	

 
 
   if (debugMenuText3 == 1) then 
     Text.print( "Test2: " .. vartest  , 518.9 + 67 , 264 + 48)
     Text.print( "Min: " .. Min  , 553 + 67, 264 + 48 + 24)
     Text.print( "Max: " .. Max  , 553 + 67, 264 + 48 + 24 + 24)
     Text.print( "A. Min: " .. AmountMin  , 553 + 14 , 264 + 48 + 24 + 24 + 24)
     Text.print( "A. Max: " .. AmountMax  , 553 + 14 , 264 + 48 + 24 + 24 + 24 + 24)

   else end   
   
   if (debugMenuText4 == 1) then 
    Text.print( "Test2: " .. vartest  , 518.9 + 70 , 264 + 24)
     Text.print( "Sec: " .. Sec  , 518.9 + 106 , 264 + 48)
     Text.print( "Tick: " .. Tick  , 553 + 54, 264 + 48 + 24)
     Text.print( "that11: " .. that11  , 553.8 + 17, 264 + 48 + 24 + 24)
  --   Text.print( "Max: " .. Max  , 553 + 67, 264 + 48 + 24 + 24)
   --  Text.print( "A. Min: " .. AmountMin  , 553 + 14 , 264 + 48 + 24 + 24 + 24)
    --  Text.print( "A. Max: " .. AmountMax  , 553 + 14 , 264 + 24 + 48 + 24 + 24 + 24)

   else end
 
 
 

 
 
  if (AmountMax == 1) then
  

		Sec = 0
		Tick = 0
		else
		Sec = Sec
		Tick = Tick
 end

 if (AmountMin == 1) then
		Sec = 0
		Tick = 0
		else
		Sec = Sec
		Tick = Tick
 end
		
 SecTickB = Tick
 SecTickA = Tick
 
 
 SecondsRight = SecondsRight - SecTickB
 SecondsLeft = SecondsLeft - SecTickA
 

end

Code: Select all

local addthis = 0 
local Increment = 0
local Decrement = 0
local vartest2 = 0
local vartest = 0

function ThistextAA( Atext , addthis, vartest2 )
 
 
  if (ButtonR == 1) then
    Increment = 1
   
	elseif (ButtonL == 1) then
		Increment = -1
	
	elseif (ButtonR == 0) and (ButtonL == 0) then 

   Increment = 0
 
end

 
  vartest2 = vartest2 + addthis
 
 
    if (debugMenuText3 == 1) then 
	   

	
  Text.print( Atext .. vartest2  , 518.9 + 25 , 264 + 24)
   
  
 else end
 
end

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Tue Jan 05, 2016 5:52 am

whelp no one ?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Tue Jan 05, 2016 10:40 am

You must understand the basic princible of how variables are passed:
Numbers and strings are passed by value, meaning that a copy is generated for that function.
Tables on the other hand are passed by references (but only the content).

Example:

Code: Select all

function passByVal(someVal)
someVal = 5
end

function passByRef(someTable)
someTable.i = 5
end

So if we call them both:

Code: Select all

someNumber = 0
passByVal(someNumber) -- someNumber will still stay with the value 0, because the value was copied

someTable = {}
someTable.i = 0
passByRef(someTable) -- Now someTable.i is 5. Remember you can only modify the content of the table, not the table itself.

But I would really recommend using the return statement rather than trying to pass by reference:

Code: Select all

function addValue(someValue)
return someValue + 1
end

Code: Select all

someValue = 0
someValue = addValue(someValue) -- Now you pass the copy of the variable and save it back to the variable through the return statement.

Imaynotbehere4long
Boomerang Bro
Boomerang Bro
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Imaynotbehere4long » Tue Jan 05, 2016 2:11 pm

Wohlstand wrote:This case is only for super-long blocks
That's not true; what about large NPCs with lots of frames? A good example are the cut-scenes in A2XT's EoW8; those sprites go up to 27000 pixels high. Levels like that, as rare as they may be, won't work with Lua for most people because even my video card only goes up to 16000 pixels.

Enjl is the only one to my knowledge who had a block that big.
Wohlstand wrote:for computers where OpenGL not works because shitty video card, LunaLUA-SMBX enables a GDI mode to keep ability to play LunaLUA-SMBX anyway.
That didn't happen for me, and I have the latest version. If it isn't automatic, how do I trigger it?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Tue Jan 05, 2016 3:47 pm

@ Kevsoft

Thanks for this information I will check this soon tonight :D

PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Wed Jan 06, 2016 11:27 pm

How do you disable the hud for a whole level?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Jan 07, 2016 12:59 am

@Kevsoft

Thanks also for the update :D

I damn love you about this one : onKeyboardPress :D
but how It work ?

Code: Select all

v0.7.3 BETA
  * Added new compareLunaVersion for version checking
  * Added new event onKeyboardPress which handles raw keyboard input
  * Added new draw function (Graphics.draw [Named args])
  * Added new OpenGL drawing system (Graphics.glDraw [Named args])
  * Added new lua based pause function: Misc.pause, Misc.unpause, Misc.isPausedByLua
  * Improvement [LunaLua]: Refactored mainV2.lua for better performance and smaller code
  * Added new function for better controlling the loop: onTick, onTickEnd, onDraw, onDrawEnd
  * Improvement [LunaLua]: onHUDDraw and onCameraUpdate now has the camera index as argument.
  * Improvement [LunaLua]: onMessageBox can now be cancelled
  * Added FIELD_BOOL which can be used for the mem-functions.
  * Added NPC.get overload with only the npc-id as argument.
  * Bugfix [LunaLua]: SMBX doesn't crash anymore, if you pass nil to some LunaLua functions.
  * Improvement [LunaLua]: The max npc id is now 300
  * Added NPC:harm
  * Bugfix [LunaLua]: Tiles can now correctly be replaced with PNGs.
  * Bugfix [LunaLua]: PlayerSetting.height was pointing to players width
  * Extended Camera class
  * Bugfix [LunaLua]: Cheat defines now don't reset.
  * Added registerCustomEvent, so you can create custom events from your APIs.
  * Added event onCameraUpdate and Camera.x, Camera.y is now writeable.
  * Added a lot of new world map classes.
  * Added Misc.doPSwitchRaw - You can now trigger the raw P-Switch effect.
  * Added Misc.doPSwitch - You can now trigger the full P-Switch effect.
  * Added Misc.doBombExplosion - You can now spawn bomb explosions.
  * Bugfix [LunaLua]: Misc.resolveFile and Misc.resolveDirectory don't crash anymore and works faster now.
  * Bugfix [LunaLua]: Some unreliability of Animation.spawn has been fixed.
  * Bugfix [LunaLua]: Level sounds.ini now works correctly when using from the main game
  * Bugfix [LunaLua]: Hitboxes and offsets are now reset before loading a new level or world
  * Bugfix [LunaLua]: Misc.loadEpisode now works also without Autostart ini file.
  * Added onStart - This event is the better "onLoad". This event will be executed, when SMBX is running the first frame.
  * Fixed music.ini bug which wasn't supported track number suffix for NSF/HES/etc. multi-track musics
  * NPCs can now be killed, even if they are hidden.
  * Add width/height properties to LuaImageResource.
  * Allow onNPCKill to be cancelled.

oh sorry it's not out :(
forgot to see lol

Creasion
Buster Beetle
Buster Beetle
Posts: 89
Joined: Sat Dec 19, 2015 9:58 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Creasion » Thu Jan 07, 2016 8:26 am

Image


Kev, how do I get lunalua to work.

Look I downloaded it for classic smbx not hexed.

here

but its still not working.
my version is 1.3.0.1

PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Thu Jan 07, 2016 12:31 pm

How do i make a cut scene happen before a level and then it only plays the cut scene once?

underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Thu Jan 07, 2016 12:38 pm

Creasion wrote:
Spoiler: show
Image

Kev, how do I get lunalua to work.

Look I downloaded it for classic smbx not hexed.

here

but its still not working.
my version is 1.3.0.1
If your version is 1.3.0.1, it's not with LunaLua.

Also, the contents of that LunaLUA _0.7.2.2-beta whatever folder need to go into the SMBX directory.
MosaicMario wrote:How do i make a cut scene happen before a level and then it only plays the cut scene once?
http://engine.wohlnet.ru/pgewiki/Data_(class)

Imaynotbehere4long
Boomerang Bro
Boomerang Bro
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Imaynotbehere4long » Thu Jan 07, 2016 3:40 pm

MosaicMario wrote:How do you disable the hud for a whole level?
Make a lunadll.txt file in your level's folder and put this code in it:

LunaControl,2,1,0,0,0,0
MosaicMario wrote:How do i make a cut scene happen before a level and then it only plays the cut scene once?
You have two non-Lua options:

1) Make the cutscene and the gameplay separate levels.
2) Check "Restart Last Level on Death," then make the cutscene's first event an Auto-Start event which hides a warp to the gameplay part. If the player dies, the Auto-Start event won't trigger and the warp will warp the player to the start of the gameplay part.

PersonNamedUser
Reznor
Reznor
Posts: 2882
Joined: Fri Feb 27, 2015 8:07 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PersonNamedUser » Thu Jan 07, 2016 3:46 pm

Imaynotbehere4long wrote: You have two non-Lua options:

1) Make the cutscene and the gameplay separate levels.
2) Check "Restart Last Level on Death," then make the cutscene's first event an Auto-Start event which hides a warp to the gameplay part. If the player dies, the Auto-Start event won't trigger and the warp will warp the player to the start of the gameplay part.
Thanks, but i mean with lunalua.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9887
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Thu Jan 07, 2016 3:48 pm

MosaicMario wrote:How do you disable the hud for a whole level?
Graphics.activateHud(false)

into onStart() or whereever you want to disable it.
MosaicMario wrote:How do i make a cut scene happen before a level and then it only plays the cut scene once?
Using the data class, set a value from 0 to 1 when the player completed the cutscene. In the beginning of the level, place an instant warp on a hidden layer which teleports past the cutscene. Then configure this layer to only show up when the value is 1. http://engine.wohlnet.ru/pgewiki/Layer_%28class%29

underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Thu Jan 07, 2016 3:49 pm

Imaynotbehere4long wrote:
MosaicMario wrote:How do i make a cut scene happen before a level and then it only plays the cut scene once?
You have two non-Lua options:

1) Make the cutscene and the gameplay separate levels.
2) Check "Restart Last Level on Death," then make the cutscene's first event an Auto-Start event which hides a warp to the gameplay part. If the player dies, the Auto-Start event won't trigger and the warp will warp the player to the start of the gameplay part.
>lunalua thread
>"non-lua options"

ok

h2643
Reznor
Reznor
Posts: 2890
Joined: Sat Dec 21, 2013 7:23 am
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby h2643 » Thu Jan 07, 2016 4:08 pm

Imaynotbehere4long wrote:
MosaicMario wrote:How do you disable the hud for a whole level?
Make a lunadll.txt file in your level's folder and put this code in it:

LunaControl,2,1,0,0,0,0
This code is wrong as you wrote it for LunaDLL. Author asked for a LunaLua code, not a LunaDLL one.

Creasion
Buster Beetle
Buster Beetle
Posts: 89
Joined: Sat Dec 19, 2015 9:58 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Creasion » Thu Jan 07, 2016 5:24 pm

Spinda wrote:
Creasion wrote:
Spoiler: show
Image

Kev, how do I get lunalua to work.

Look I downloaded it for classic smbx not hexed.

here

but its still not working.
my version is 1.3.0.1
If your version is 1.3.0.1, it's not with LunaLua.

Also, the contents of that LunaLUA _0.7.2.2-beta whatever folder need to go into the SMBX directory.


I dumped all the contents in the directory but now the HUD health won't show and Temmies shop isnt working...why is this stuff so complicated...


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari