Page 49 of 59

Re: LunaDLL/LunLUA help thread

Posted: 30 Aug 2015, 21:21
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?

Re: LunaDLL/LunLUA help thread

Posted: 30 Aug 2015, 21:39
by SAJewers
The P-switch jingle is music, not a sound.

Re: LunaDLL/LunLUA help thread

Posted: 30 Aug 2015, 22:22
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.

Re: LunaDLL/LunLUA help thread

Posted: 30 Aug 2015, 23:07
by SAJewers
Yeah, it's definitely what I want. I'd like the level music to continue uninterrupted, with a sound effect playing overtop.

Re: LunaDLL/LunLUA help thread

Posted: 31 Aug 2015, 06:07
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)

Re: LunaDLL/LunLUA help thread

Posted: 31 Aug 2015, 08:18
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

Re: LunaDLL/LunLUA help thread

Posted: 31 Aug 2015, 12:33
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.

Re: LunaDLL/LunLUA help thread

Posted: 05 Sep 2015, 18:16
by SAJewers
Any Luck with this?

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

Re: LunaDLL/LunLUA help thread

Posted: 05 Sep 2015, 20:15
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.

Re: LunaDLL/LunLUA help thread

Posted: 05 Sep 2015, 20:24
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.

Re: LunaDLL/LunLUA help thread

Posted: 05 Sep 2015, 22:20
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.

Re: LunaDLL/LunLUA help thread

Posted: 05 Sep 2015, 23:06
by SAJewers
Oh, good.

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

Re: LunaDLL/LunLUA help thread

Posted: 06 Sep 2015, 01:05
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

Re: LunaDLL/LunLUA help thread

Posted: 06 Sep 2015, 15:01
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

Re: LunaDLL/LunLUA help thread

Posted: 06 Sep 2015, 16:23
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.

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 08:52
by Willhart
How can I hide the hud for my level? I'm having hard time getting anything to work on the A2XT devkit.

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 09:29
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

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 09:44
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.

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 11:04
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)

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 11:14
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.

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 14:11
by XerX

Code: Select all

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

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 15:50
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

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 16:02
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.

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 16:37
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)

Re: LunaDLL/LunLUA help thread

Posted: 13 Sep 2015, 17:38
by Friendly Dictator
OK, nevermind, i fixed it by making them resprited fireballs instead of bullet bills