Page 30 of 47

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Jan 04, 2016 5:03 pm
by TDK
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?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Jan 04, 2016 5:36 pm
by PixelPest
For the first one it's easiest just to put npcblock=0.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Jan 04, 2016 5:44 pm
by TDK
PixelPest wrote:For the first one it's easiest just to put npcblock=0.
Wow... I forgot about that.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Jan 04, 2016 6:59 pm
by Wohlstand
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Jan 05, 2016 1:08 am
by lotus006
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Jan 05, 2016 5:52 am
by lotus006
whelp no one ?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Jan 05, 2016 10:40 am
by Kevsoft
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Jan 05, 2016 2:11 pm
by Imaynotbehere4long
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?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Jan 05, 2016 3:47 pm
by lotus006
@ Kevsoft

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Wed Jan 06, 2016 11:27 pm
by PersonNamedUser
How do you disable the hud for a whole level?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 12:59 am
by lotus006
@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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 8:26 am
by Creasion
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 12:31 pm
by PersonNamedUser
How do i make a cut scene happen before a level and then it only plays the cut scene once?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 12:38 pm
by underFlo
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)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 3:40 pm
by Imaynotbehere4long
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 3:46 pm
by PersonNamedUser
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 3:48 pm
by Emral
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 3:49 pm
by underFlo
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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 4:08 pm
by h2643
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Thu Jan 07, 2016 5:24 pm
by Creasion
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...