(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
S1eth
Posts: 291
Joined: 9 years ago

Re: LunaDLL/LunLUA help thread

Post by S1eth »

SAJewers wrote:Is there a way to fix "A World 1 Level" From Episode 1 by disallowing the player from entering the pause menu?

EDIT: Also, Is it possible to have no P-Switch music, like in ASMT/A2MT?
http://engine.wohlnet.ru/pgewiki/Player_%28class%2 has Player.pauseKeyPressing
True, if the player is pressing the pause key. Can be overwritten with the Event onInputUpdate, to lock or reverse controls (LunaLua ≥v0.7)
How To: Overwrite or lock player input

Code: Select all

function onInputUpdate()
   if(player.pauseKeyPressing) then
       player.pauseKeyPressing  = false;
   end
end
This should do it. (not tested)

Doesn't sound replacement work the same way as with sprites? Can't you put a silent sound file with the same name as the P-switch sound file into your level folder?
Image
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

The P-switch jingle is music, not a sound.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
S1eth
Posts: 291
Joined: 9 years ago

Re: LunaDLL/LunLUA help thread

Post by S1eth »

SAJewers wrote:The P-switch jingle is music, not a sound.
You can use:

Code: Select all

function onEvent(eventName)
  if eventName == "P Switch - Start" then
    Audio.MusicStop();
  end
end
So when you hit a P-switch, the music is immediately stopped, and is completely silent for the duration.
But this is probably not exactly what you want, because with this, you have no idea how long the P-switch effect actually lasts.
Image
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

Yeah, it's definitely what I want. I'd like the level music to continue uninterrupted, with a sound effect playing overtop.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL/LunLUA help thread

Post by Rednaxela »

SAJewers wrote:Is there a way to fix "A World 1 Level" From Episode 1 by disallowing the player from entering the pause menu?
1) I've given it a try disabling the pause menu but no real luck thus far. I'll look further into it some time. Worst case, I'll have to modify LunaDLL to add some extra functionality for control of allowing/disallowing pausing, since my initial attempt of blocking the control input failed.
2) How does disallowing the player from entering the pause menu help "A World 1 Level" from Ep 1? I don't recall that level or what's wrong with it.
SAJewers wrote:EDIT: Also, Is it possible to have no P-Switch music, like in ASMT/A2MT?
I'm unaware of what was done in ASMT/A2MT for no P-Switch music (was it just have no music file or a silent music file?), but any reason the same can't be done?

I'm now however thinking that in the next few days I may look into adding a "p-switch settings" thing to LunaLua, so various things about p-switches could be set from Lua, which would be via the lunaworld.lua file for making something episode-wide. Might think about making it so in addition to silent or not, maybe allowing the duration to be changed by Lua code (not super relevant to A2XT stuff at the episode level but maybe some level creators would find it handy)
User avatar
Wohlstand
Moondust and TheXTech developer
Posts: 186
Joined: 10 years ago
First name: Vitaly
Pronouns: he/him/his
Location: Moscow, Russia

Re: LunaDLL/LunLUA help thread

Post by Wohlstand »

I have a way: music will not be overwritten by others while you have seized music stream:

Code: Select all

Audio.SeizeStream(int sectionID)
-- Seizing control of music stream from SMBX Engine for specific section ID (from 0 to 20. If -1, then will be seized music stream for all sections).
If section has been seized, SMBX Engine will be not able control music engine while player inside current section, so, is possible to manipulate with music via lua code with no bugs
I wasn't tried that with P-Switches, but must work
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

Rednaxela wrote:
SAJewers wrote:Is there a way to fix "A World 1 Level" From Episode 1 by disallowing the player from entering the pause menu?
1) I've given it a try disabling the pause menu but no real luck thus far. I'll look further into it some time. Worst case, I'll have to modify LunaDLL to add some extra functionality for control of allowing/disallowing pausing, since my initial attempt of blocking the control input failed.
2) How does disallowing the player from entering the pause menu help "A World 1 Level" from Ep 1? I don't recall that level or what's wrong with it.
SAJewers wrote:EDIT: Also, Is it possible to have no P-Switch music, like in ASMT/A2MT?
I'm unaware of what was done in ASMT/A2MT for no P-Switch music (was it just have no music file or a silent music file?), but any reason the same can't be done?

I'm now however thinking that in the next few days I may look into adding a "p-switch settings" thing to LunaLua, so various things about p-switches could be set from Lua, which would be via the lunaworld.lua file for making something episode-wide. Might think about making it so in addition to silent or not, maybe allowing the duration to be changed by Lua code (not super relevant to A2XT stuff at the episode level but maybe some level creators would find it handy)
the P-switch thingy in ASMT was an ASM patch that replaced the P-switch music with a ticking sound effect that played over the level music. Here's an example from raocow's ASMT LP, or a TAS of that level if you don't want commentary. I can easily grab that sound effect.

EDIT: If it's any use to you, here's the ASMT resources pack, which includes the ASM patch for the ticking p-switch (\patches\ticking.asm)

As for "A World 1 Level", the main part the level uses events that sync up with the music. Pausing the game causes the events to stop until you unpause, which causes the music and the events to desync.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

Any Luck with this?

Also, while I'm posting, is it possible to increase the Demo counter in Lua?
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL/LunLUA help thread

Post by Kevsoft »

SAJewers wrote:Any Luck with this?
Red and me is working on that.
SAJewers wrote:Also, while I'm posting, is it possible to increase the Demo counter in Lua?
Horikawa made a demo counter in lua, might ask her.
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

I don't mean creating the Demo Counter again (I think someone is looking after that), I mean adding a Demo to the counter upon a certain event happening.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunLUA help thread

Post by Hoeloe »

SAJewers wrote:I don't mean creating the Demo Counter again (I think someone is looking after that), I mean adding a Demo to the counter upon a certain event happening.
In the lua based one, definitely.
Image
Image
Image
Image
Image
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

Oh, good.

This will probably make my Fairy/Angel Girl level idea much less annoying.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

OK, how do I make the player always be a fairy? Using this in an onLoop doesn't seem to work:

Code: Select all

	if (player:mem(0x0C, FIELD_WORD) == 0x0) then
		player:mem(0x0C, FIELD_WORD, 0xFFFFFF);

	end
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

Nevermind, this works:

Code: Select all

Ship = {}
Ship.npc = nil;
Ship.timer = 20
function Ship:onLoop()
	if (player:mem(0x0C, FIELD_WORD) == 0x0) then
		if (Ship.timer == 0) then
			Ship.npc = spawnNPC(254, player.x, player.y, 1)
			Ship.timer = 20
		else
			Ship.timer = Ship.timer - 1
		end

	end

end
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Post by SAJewers »

OK, now How Do I use Warp.get and Warp.EnteranceX/Warp.enteranceY to get the coords of a warp, and teleport the player to there?

EDIT: To be clear, What I'm looking for is to reposition the player in an autoscroll section. I figure the best way to do that is to have a Warp, moving with the autoscroll. The problem is, I can't figure out how to retrieve the coordinates of that warp.



Nevermind, I got it to work somehow.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Post by Willhart »

How can I hide the hud for my level? I'm having hard time getting anything to work on the A2XT devkit.
User avatar
Mabel
Just west of wierd
Posts: 302
Joined: 10 years ago
https://marbels.talkhaus.com/

Re: LunaDLL/LunLUA help thread

Post by Mabel »

Willhart wrote:How can I hide the hud for my level? I'm having hard time getting anything to work on the A2XT devkit.
dunno about doing it with Lua, but this autocode still works

Code: Select all

#0
LunaControl,2,1,0,0,0,0
#END
Image
Image
Image Image
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Post by Willhart »

Mabel wrote:
Willhart wrote:How can I hide the hud for my level? I'm having hard time getting anything to work on the A2XT devkit.
dunno about doing it with Lua, but this autocode still works

Code: Select all

#0
LunaControl,2,1,0,0,0,0
#END
Thank you. I was remembering there was a code for that somewhere.

Edit: It did not work. I wonder if the devkit is on the way somehow. I tried it as an episode too, and that did not help.
S1eth
Posts: 291
Joined: 9 years ago

Re: LunaDLL/LunLUA help thread

Post by S1eth »

Willhart wrote:
Mabel wrote:
Willhart wrote:How can I hide the hud for my level? I'm having hard time getting anything to work on the A2XT devkit.
dunno about doing it with Lua, but this autocode still works

Code: Select all

#0
LunaControl,2,1,0,0,0,0
#END
Thank you. I was remembering there was a code for that somewhere.

Edit: It did not work. I wonder if the devkit is on the way somehow. I tried it as an episode too, and that did not help.
Does this not work?: Graphics.activateHud(false)
Image
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Post by Willhart »

S1eth wrote:
Willhart wrote:Does this not work?: Graphics.activateHud(false)
I tried that, and "hud (false)" since I saw someone use that on a level too.
Neither of them caused an error, or removed the hud.
XerX
Untalented Pleb
Posts: 91
Joined: 9 years ago
First name: Colton
Pronouns: he/him/his
Location: Canada

Re: LunaDLL/LunLUA help thread

Post by XerX »

Code: Select all

hud(false);
Should work, as I use it for my overhaul API.
User avatar
Friendly Dictator
rad
Posts: 140
Joined: 12 years ago
Pronouns: he/him/his
Location: Underground Pudding Destoryer
Contact:

Re: LunaDLL/LunLUA help thread

Post by Friendly Dictator »

using lunalua, is it possible to make it so Mario constantly fires bullet bills like he's holding a billy gun? i tried this code but the bullets it spawns don't move:

Code: Select all

direct = 1;
timer = 0;
function onLoopSection1()
	if (player.speedX > 0) then
		direct = 1;
	end
	if (player.speedX < 0) then
		direct = -1;
	end
	timer = timer+1;
	if (timer==15) then
		timer = 0;
		local bill = NPC.spawn(17, player.x+direct*32,player.y,1);
		bill.speedX = player.speedX+direct*4;
	end
	player:mem(0x16E, FIELD_WORD, -1)
end
XerX
Untalented Pleb
Posts: 91
Joined: 9 years ago
First name: Colton
Pronouns: he/him/his
Location: Canada

Re: LunaDLL/LunLUA help thread

Post by XerX »

I skimmed your code and, sadly, from my previous experimentation, you cannot modify the speed value of a bullet bill. That might be a reason why they aren't moving.
S1eth
Posts: 291
Joined: 9 years ago

Re: LunaDLL/LunLUA help thread

Post by S1eth »

I tried your code, and looking at differences between a normal Bullet Bill and Billygun Bullet Bills (in their memory), but also couldn't find a way to change the speed.

Instead of speed, you could try to manually move them by 8 pixels (the speed they have when shot out of a billy gun) every tick in the direction the bullet bill is currently facing. (also, set "collides with NPCs" to -1)
Image
User avatar
Friendly Dictator
rad
Posts: 140
Joined: 12 years ago
Pronouns: he/him/his
Location: Underground Pudding Destoryer
Contact:

Re: LunaDLL/LunLUA help thread

Post by Friendly Dictator »

OK, nevermind, i fixed it by making them resprited fireballs instead of bullet bills
Post Reply