smbx communitypge projectsmw central

LunaLua Offical Thread

The second SMBX collab!

Shall I stream some LunaLua live development?

Yes
22
92%
No
2
8%
 
Total votes: 24

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaLua Offical Thread

Postby Kevsoft » 1 year ago

It's just a png with alpha channel in it. You can put those then in the episode folder (for overworld and global levels) or the custom level folder.

The advantage of this method is, that you can have partially transparany.

User avatar
Ivy
Posts: 1926
Joined: 3 years ago
Contact:

Re: LunaLua Offical Thread

Postby Ivy » 1 year ago

Kevsoft wrote:It's just a png with alpha channel in it. You can put those then in the episode folder (for overworld and global levels) or the custom level folder.
The advantage of this method is, that you can have partially transparany.
the GIF masks can do partial transparancy too, by giving the mask file shades of gray. idk how accurate it is or how it works, though.
3DS FC: 2793-0650-7690 | NNID: Ivysaur1996 | Steam: ivysaur1996 (that ivy guy)
Many thanks to GlitchedGhost and Rockythechao for the amazing paper Demo animation!

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

Ivy wrote:
Kevsoft wrote:It's just a png with alpha channel in it. You can put those then in the episode folder (for overworld and global levels) or the custom level folder.
The advantage of this method is, that you can have partially transparany.
the GIF masks can do partial transparancy too, by giving the mask file shades of gray. idk how accurate it is or how it works, though.
It distorts the colour though.
GIF:
[attachment=0]2015-09-19_14_23_28.png[/attachment]
PNG:
[attachment=1]2015-09-19_14_22_52.png[/attachment]
Attachments
2015-09-19_14_23_28.png
2015-09-19_14_23_28.png (10.81 KiB) Viewed 1166 times
2015-09-19_14_22_52.png
2015-09-19_14_22_52.png (11.99 KiB) Viewed 1166 times
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Ivy
Posts: 1926
Joined: 3 years ago
Contact:

Re: LunaLua Offical Thread

Postby Ivy » 1 year ago

i kinda like how the method used by the gifs looks, but now that there's both available, either can be used!
3DS FC: 2793-0650-7690 | NNID: Ivysaur1996 | Steam: ivysaur1996 (that ivy guy)
Many thanks to GlitchedGhost and Rockythechao for the amazing paper Demo animation!

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaLua Offical Thread

Postby Kevsoft » 1 year ago

Hey guys, there is a bug with 4-channels BMP pictures. Colors are mixed up and I am still investingating the cause. This color bug appeared with one, created with GIMP. If someone has a 4-channel BMP picture which was not created with GIMP I would appreciate if someone would send it to me, so I can do more tests.

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 152
Joined: 3 years ago

Re: LunaLua Offical Thread

Postby Wohlstand » 1 year ago

Kevsoft wrote:Hey guys, there is a bug with 4-channels BMP pictures. Colors are mixed up and I am still investingating the cause. This color bug appeared with one, created with GIMP. If someone has a 4-channel BMP picture which was not created with GIMP I would appreciate if someone would send it to me, so I can do more tests.
Are you mean 32-bit BMP? (I.e. full RGBA) (24-bit BMP uses 32 bits, but 4'th channel usually reserved)

User avatar
Axon
Posts: 29
Joined: 3 years ago
Location: At a place.

Re: LunaLua Offical Thread

Postby Axon » 1 year ago

TiKi wrote:
Axon wrote:Here's another thing I made: Tryclyde, the SMB2 boss:
https://www.dropbox.com/s/fbkaws4hap11v ... yclyde.rar

Image

I tried to make it relatively faithful to the original. If you have suggestions for improvement or would like me to explain some of/add more comments to the code, please tell me.

note: I've used clouds for the platforms, because block-502 is solid in SMBX. I could have replaced the cloud graphics, but I guess I forgot.
Could you please make a tutorial on how to put it in the level, and make it trigger an event on death?
I'm a little late to respond, but I guess I'll do it anyway for both Tryclyde and Fryguy:

- First, copy everything in the Axon-Tryclyde or Axon-Fryguy folder into your level folder.
- Open the lunadll.lua file.
- Scroll down to the end of the file and look for activeObjects:add(Tryclyde(-199120,-200320,activeObjects)); or activeObjects:add(Fryguy(-199968,-200448,activeObjects)); in the -- Main -- block.
- The two large negative numbers you see are the boss's initial position coordinates (top left of the sprite, if I recall correctly). Use the smbx editor to find these for the position where you want the boss to be, and replace the values in the .lua file.
- Right now, both bosses are active as soon as you enter the level, regardless of where you are in the level. To fix this, go again in the -- Main -- block at the end of the .lua file and look in function onLoop() for the line "activeObjects:process();". Modify it to include a condition for when the boss is active; for example, you could put

Code: Select all

if (Player(1).section==0) then
		activeObjects:process();
	end
to make it active only when you're in section 0 (which is section 1 in the smbx editor?). Note that this also affects the boss's fireballs.
- To do something when the boss dies, look for this code near the end of function Tryclyde:action():

Code: Select all

else --death
		self.deathSpeedY = self.deathSpeedY+self.deathG;
		self.x = self.x+self.deathSpeedX;
		self.y = self.y+self.deathSpeedY;
		self.deathTimer = self.deathTimer+1;
		if (self.deathTimer>=self.deathDelay) then
			return 1;
		end
	end
Modify the last part like this:

Code: Select all

if (self.deathTimer>=self.deathDelay) then
			triggerEvent("nameofyourevent");
			return 1;
		end
and the event "nameofyourevent" should happen.
- Useful extra things:
1) You can change various parameters by going into function Tryclyde:init(ini_x,ini_y,ini_exTable) and modifying some numbers. For example, you can decide how much health Tryclyde has by modifying the line "self.health = 3;" or change the speed of his fireballs by changing "self.fireballSpeed = 3.5;". Similarly, parameters for Fryguy and the mini-Fryguys can be changed in function Fryguy:init(ini_x,ini_y,ini_exTable) and function SmallFry:init(ini_x,ini_y,ini_speedX,ini_speedY,ini_parent).
2) Any NPC thrown at Tryclyde will be destroyed unless it's an npc-154 (first type of mushroom block). You can specify more npcs that won't be destroyed by going into function Tryclyde:action() looking for the comment that says "--collision with an NPC that was thrown" and, a few lines under that, changing the line "if (v.id~=154) then" to include more npcs. For example, you could change it to

Code: Select all

if (v.id~=154 and v.id~=155 and v.id~=156 and v.id~=157) then
to account for all types of mushroom blocks.
3) Similarly, Tryclyde's fireballs interact with every real block except block-447 (a cloud block). If you want to specify more exceptions, go into function TryFireball:action() and change the line "if (val.id~=447) then" to specify more exceptions.
4) Also in TryFireball:action(), if you want the fireball to be destroyed by npcs other than npc-154 (for example, the other mushroom blocks), find the comment "-- collision with plain mushroom blocks (not grabbed by the player)" and, under it, copy-paste the code

Code: Select all

collisionTable = NPC.get(154,currentSection);
	for key,val in pairs(collisionTable) do
		if (val:mem(0x12C,FIELD_WORD)~=1 and val:overlapsWith(self.x,self.y,self.x+self.width,self.y+self.height)) then
			return 1;
		end
	end
for each NPC you want, changing the number in "NPC.get(154,currentSection);" each time. (I know it's not a very elegant solution, but that's the simplest thing that can be done right now)

Any other question?

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

Axon wrote:for each NPC you want, changing the number in "NPC.get(154,currentSection);" each time. (I know it's not a very elegant solution, but that's the simplest thing that can be done right now)
False. Using colliders you can simplify this massively.

Code: Select all

   hitbox = colliders.Box(self.x, self.y, self.width, self.height); --Note: if "self" is an NPC object, you can skip this and just pass the NPC directly.
   local _,_,collisionTable = colliders.collideNPC(hitbox,{154},currentSection); --Add more NPC IDs to the table to test more NPC types.
   for _,v in ipairs(collisionTable) do
   	 if (v:mem(0x12C,FIELD_WORD)~=1) then
   	 	return 1;
   	 end
   end
   
The collideNPC function is a fairly efficient way to test a collider against all NPCs of a given type or list of types. The third argument returned from the function is a table of NPC objects, which you can loop through to test the state afterwards. For example, to collide against NPC 154 and 155, you'd just change that line to:

Code: Select all

local _,_,collisionTable = colliders.collideNPC(hitbox,{154,155},currentSection);
Image
Image
Image
Image

User avatar
Axon
Posts: 29
Joined: 3 years ago
Location: At a place.

Re: LunaLua Offical Thread

Postby Axon » 1 year ago

Hoeloe wrote:
Axon wrote:for each NPC you want, changing the number in "NPC.get(154,currentSection);" each time. (I know it's not a very elegant solution, but that's the simplest thing that can be done right now)
False. Using colliders you can simplify this massively.

Code: Select all

   hitbox = colliders.Box(self.x, self.y, self.width, self.height); --Note: if "self" is an NPC object, you can skip this and just pass the NPC directly.
   local _,_,collisionTable = colliders.collideNPC(hitbox,{154},currentSection); --Add more NPC IDs to the table to test more NPC types.
   for _,v in ipairs(collisionTable) do
   	 if (v:mem(0x12C,FIELD_WORD)~=1) then
   	 	return 1;
   	 end
   end
   
The collideNPC function is a fairly efficient way to test a collider against all NPCs of a given type or list of types. The third argument returned from the function is a table of NPC objects, which you can loop through to test the state afterwards. For example, to collide against NPC 154 and 155, you'd just change that line to:

Code: Select all

local _,_,collisionTable = colliders.collideNPC(hitbox,{154,155},currentSection);
My post was meant in the context of the boss .lua file alone (which doesn't use external libraries other than the default stuff); but sure, if you have something like these colliders, you might want to use that.

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

Hoeloe wrote:
Hoeloe wrote:Been getting this ready for A2XT. I think it's almost there.


This library has now been released! Link is here.

I'll draw up a quick lunaworld.lua including it for A2XT.

EDIT: As it turns out, I don't believe this is actually complicated. This should serve the purpose for lunaworld:

Code: Select all

world_raocoin_lib = loadSharedAPI("raocoin2");
world_raocoin_currency = world_raocoin_lib.registerCurrency(274, true, 472, 66);

local levelFinished = false;

function onLoop()
	 if(mem(0x00B2C59E,FIELD_WORD) ~= 0 and not levelFinished) then --level is ending
		levelFinished = true;
		world_raocoin_currency:save();
	end
end
That should count raocoins and save them to the file when the level ends (thus stopping you from farming by repeatedly dying).
Just thought I'd mention this, but if you try to disable the HUD using LunaDLL, the raocoin counter will still appear. That might be something you'd want to fix.
EDIT: Also, if it's not done already, can we get a visual confirmation with the Leek Pillars wether or not someone has collected all the raocoins?
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

SAJewers wrote: Just thought I'd mention this, but if you try to disable the HUD using LunaDLL, the raocoin counter will still appear. That might be something you'd want to fix.
EDIT: Also, if it's not done already, can we get a visual confirmation with the Leek Pillars wether or not someone has collected all the raocoins?
You can disable the raocoin counter HUD item manually, but I can try and look into that.

As it stands here, this doesn't record individual collected raocoins - the same coin can be collected multiple times (but it's not saved unless you beat the level). There are a number of reasons for this. One is that the save files would become quite large quite quickly, but the main reason is that identifying individual NPCs consistently is currently an unsolved problem without it being set up manually by the level creator. It's reasonably easy if you assume that no raocoins are ever on moving layers or layers that are hidden and shown again, but we can't make that assumption. It also breaks if you introduce a raocoin generator (which I know we won't, but has the potential to exist in the more general case).

Also, update to multipoints to fix an error that appears when it runs on a level without any multipoints included.
Image
Image
Image
Image

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

I'd rather just have hud(false) and whatever the autocode equivalent is disable all HUD stuff, including the custom stuff we have like the raocoin counter.

Also, what I mean is a checkmark or something that says "You collected all the raocoins" with an X or something if you didn't collect them all. I wasn't expecting an x/5 counter. Just something so the player can easily see if they got all the raocoins or not. The Generator issue moot for this since any levels that use more than 5 raocoins (or 1-4 raocoins) will get auto-rejected anyway.
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
XerX
Untalented Pleb
Posts: 91
Joined: 2 years ago
First name: Colton
Pronouns: he/him/his
Location: Canada

Re: LunaLua Offical Thread

Postby XerX » 1 year ago

SAJewers wrote:I'd rather just have hud(false) and whatever the autocode equivalent is disable all HUD stuff, including the custom stuff we have like the raocoin counter.
I wouldn't like that at all since my SMB3 Overhaul mod depends on hud(false); disabling only the vanilla hud. If it worked how you described it, it would essentially break that mod. :/

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

The code change would just be checking to see if hud(false) was called, then opting not to draw in the raocoin counter if so (and Demo Counter when we get to that). That shouldn't affect that at all (unless you added that in as well to your API, but for that case, you could just create a different call to disable your custom HUD).
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

SAJewers wrote:I'd rather just have hud(false) and whatever the autocode equivalent is disable all HUD stuff, including the custom stuff we have like the raocoin counter.
So would I, but that's not currently possible. I've requested the feature in the next version of LunaLua. I'll also add an option to override this to force the HUD item to show even when the vanilla HUD is disabled.
SAJewers wrote: Also, what I mean is a checkmark or something that says "You collected all the raocoins" with an X or something if you didn't collect them all. I wasn't expecting an x/5 counter. Just something so the player can easily see if they got all the raocoins or not. The Generator issue moot for this since any levels that use more than 5 raocoins (or 1-4 raocoins) will get auto-rejected anyway.
But to do that you still need to track which raocoins you've collected, unless you limit it to "must collect all raocoins in one run without dying" and assume that all levels have exactly 5 raocoins (which I guess would work for this). In that circumstance, it's simply a check to see if, when ending a specific level, the raocoin counter has increased by exactly 5, but if you do that you remove the option for people to make use of the raocoin counter anywhere except in towns.

I'm just not sure it's worth the extra implementation hassle for something that is immediately obvious anyway (since you'd get a 1-up from the raocoins in this circumstance). I'm not sure it will add anything to the game. If we could make each raocoin a one-time collectible and keep track of which you have collected and which you haven't, then it might have a purpose. As it is, though, it's not really telling you anything useful.
Image
Image
Image
Image

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

Ah, I was under the impression that dragon coins in SMBX were like dragon coins in SMW, where they disappeared and were uncollectable in subsqeuent playthroughs of that level once you collected them all.
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
SAJewers
A2XT Guy
Posts: 1912
Joined: 4 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Postby SAJewers » 1 year ago

Kevsoft wrote:LunaLua v0.7.1.1 is out with following changes:

* Added PNG support for custom level items (i.e. npc-1.png)
Any chance of getting this to support the default graphics too?
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 152
Joined: 3 years ago

Re: LunaLua Offical Thread

Postby Wohlstand » 1 year ago

SAJewers wrote:
Kevsoft wrote:LunaLua v0.7.1.1 is out with following changes:

* Added PNG support for custom level items (i.e. npc-1.png)
Any chance of getting this to support the default graphics too?
Problem is: a lot of episodes which lacks masks for recolored sprites which directly using default masks, and problem was found with gifs2png which makes target image to have black background (mask was not found). I need to solve that with adding support of looking for default masks from defined path to smbx's graphics folder where gifs2png will find replacement for missed masks inside levels/episodes.

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

I made a new library to deal with an issue that I keep see emerging.

Lua random number generation is notoriously terrible, so I wrote a library that uses a MWC number generator to create a more usable alternative. It also has a few extra features to make things like picking random table elements a bit easier.

http://engine.wohlnet.ru/pgewiki/Rng.lua
Image
Image
Image
Image

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

I managed to finish off another thing I was working on. Should be fairly flexible, I think.

http://engine.wohlnet.ru/pgewiki/HUDofTime.lua

Image
Image
Image
Image
Image

JVyrn
Floof Incarnate
Posts: 26
Joined: 7 years ago

Re: LunaLua Offical Thread

Postby JVyrn » 1 year ago

Is it currently possible within Luna to: 1) make HTTP requests; 2) access and manipulate files within the current world directory? I have some Shiny Ideas that would make full use of this :3

(if either of those is impossible, I've seen that apparently a DLL can be referenced and used; could this be used to implement the necessary functionality?)

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaLua Offical Thread

Postby Kevsoft » 1 year ago

Giving access to HTTP requests is a bit dangerous. I do have the power to add that but I will add limits to that. Mainly to protect the abuse of this function. IO-access is limited, I want to give access to it, but limit it to the SMBX folder.

HTTP access is given by the HTTP library provided by windows. (It is already used for uploading crash logs to the wohlnet server).

User avatar
Hoeloe
One of them Lua people
Posts: 812
Joined: 5 years ago
Location: Spaaace

Re: LunaLua Offical Thread

Postby Hoeloe » 1 year ago

Kevsoft wrote:Giving access to HTTP requests is a bit dangerous. I do have the power to add that but I will add limits to that. Mainly to protect the abuse of this function. IO-access is limited, I want to give access to it, but limit it to the SMBX folder.

HTTP access is given by the HTTP library provided by windows. (It is already used for uploading crash logs to the wohlnet server).
IO access isn't really limited, only in how you can find the path. Using Lua standard stuff you can read and write files pretty easily (and that's a good thing to include because it opens a lot of doors), and in arbitrary locations (provided you have the permissions to do so). You just need to find the location to be able to do it.

Similarly, I expect that HTTP access will cause more good than harm, and if you're worried, you could implement something like a scan for HTTP accessors when you open an episode, and prompt the player with a request to allow it. That would prevent any uses of stealth-HTTP for questionable purposes.
Image
Image
Image
Image

JVyrn
Floof Incarnate
Posts: 26
Joined: 7 years ago

Re: LunaLua Offical Thread

Postby JVyrn » 1 year ago

Hoeloe wrote:Using Lua standard stuff you can read and write files pretty easily
I thought I read that that was disabled for Luna?

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaLua Offical Thread

Postby Kevsoft » 1 year ago

JVyrn wrote:
Hoeloe wrote:Using Lua standard stuff you can read and write files pretty easily
I thought I read that that was disabled for Luna?
It was disabled.


Return to “A2XT”

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron