Page 38 of 47

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:04 pm
by PixelPest
Okay, so how would I do that only for NPC 229 or how would I teleport it off of the screen?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:19 pm
by snoruntpyro
PixelPest wrote:Okay, so how would I do that only for NPC 229 or how would I teleport it off of the screen?
For teleporting it offscreen you could probably just do v.x = 0.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:21 pm
by lotus006

Code: Select all

function onLoop()
   for _,v in pairs(NPC.get(229,player.section)) do
      if #Block.getIntersecting(v.x,v.y,v.x + v.width,v.y + v.height) > 0 then
         v:kill(7)
         Audio.sounds[9].muted = true  -- for muting the death song of the npc 229
      end
   end
end

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:30 pm
by PixelPest

Code: Select all

function onLoop()
	for _,v in pairs(NPC.get(229,player.section)) do
		if #Block.getIntersecting(v.x,v.y,v.x + v.width,v.y + v.height) > 0 then
			v:x=0
		end
	end
end
Is it just as simple as that Pyro?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:52 pm
by lotus006
PixelPest wrote:

Code: Select all

function onLoop()
	for _,v in pairs(NPC.get(229,player.section)) do
		if #Block.getIntersecting(v.x,v.y,v.x + v.width,v.y + v.height) > 0 then
			v:x=0
		end
	end
end
Is it just as simple as that Pyro?

Code: Select all

	v.x = 0
or this to mute the sound you wanted to do on first:

Code: Select all

  Audio.sounds[9].muted = true  -- for muting the death song of the npc 229

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:56 pm
by PixelPest
Okay. Thanks lotus006. The issue I'm wondering about with muting the audio there, is will it remove the death sound for all NPCs?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 9:58 pm
by lotus006
PixelPest wrote:Okay. Thanks lotus006. The issue I'm wondering about with muting the audio there, is will it remove the death sound for all NPCs?
nope only for this command and this fish

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sat Feb 13, 2016 10:00 pm
by PixelPest
lotus006 wrote:
PixelPest wrote:Okay. Thanks lotus006. The issue I'm wondering about with muting the audio there, is will it remove the death sound for all NPCs?
nope only for this command and this fish
Awesmazing; thanks.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 2:23 am
by Kevsoft
Some corrections here:
1.) If you mute sound id 9 you have to unmute it afterwards. Yes it is global.
2.) If you just want to "vanish" an npc (meaning no sound and no effects), then you can use npc:kill(9)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 6:36 am
by lotus006
like this ?

Code: Select all

function onLoop()
  if (player.runKeyPressing) then
   for _,v in pairs(NPC.get(229,player.section)) do
      if #Block.getIntersecting(v.x,v.y,v.x + v.width,v.y + v.height) > 0 then
  Audio.sounds[9].muted = true  -- for muting the death song of the npc 229
      end
   end
   else
     Audio.sounds[9].muted = false -- for unmuting the death song of the npc 229
   end
end

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 7:40 am
by PixelPest
Kevsoft wrote:Some corrections here:
1.) If you mute sound id 9 you have to unmute it afterwards. Yes it is global.
2.) If you just want to "vanish" an npc (meaning no sound and no effects), then you can use npc:kill(9)
Thanks. npc:kill(9) will make things so much easier.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 8:01 am
by TDK
When using the multipoints API, the checkpoint is still active even after the level is finished. Is there a way to deactive the checkpoint after finishing the level?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 2:20 pm
by Hoeloe
TheDinoKing432 wrote:When using the multipoints API, the checkpoint is still active even after the level is finished. Is there a way to deactive the checkpoint after finishing the level?
This shouldn't be the case. The checkpoints are activated by the SMBX checkpoint code, so they should only activate if a regular SMBX midpoint would be active in that level.

Which version of the API are you using? (You can find this out by opening multipoints.lua and looking at the version number)

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 6:01 pm
by Nat The Porcupine
I am yet again having issues with this standing animation for Mario. It keeps saying something to the effect of 'sprites' is a nil value in the Graphics class.

source code:

Code: Select all

loadHitboxes(1, 2, "mario-2.ini")

local imgSuperMarioStand = {}

function onLoad()
  imgSuperMarioStand = Graphics.loadImage("SuperMarioStand.png")
end

function onLoop()

	if player.speedX == 0 and player.speedY == 0 and player:mem(0x114,FIELD_WORD) == 1 then
		Graphics.sprites.mario[2].img = imgSuperMarioStand
	else
		Graphics.sprites.mario[2].img = nil
	end

end
help me out?

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 6:29 pm
by Hoeloe
Nat The Porcupine wrote: help me out?
This sounds like you have an older version of LunaLua. The newest version is 0.7.3.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Sun Feb 14, 2016 6:33 pm
by Nat The Porcupine
Oops... Updating now. Thanks.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Feb 15, 2016 1:54 am
by lotus006
I have just a question if is possible to emulate with a value offsets like the player is pushing the shell and the shell will
do the normal way when collide on stuff ? (or just more simple like the click button in the animation intro of the hand ?)

Thanks

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Mon Feb 15, 2016 6:42 pm
by PixelPest
How do I define variables in my lunaworld.lua, such as:

Code: Select all

firsttime = true
...and then use and redefine the value held in lunaworld.lua in my lunadll.lua file for a level in an episode:

Code: Select all

function onLoad
	if firsttime == true then
		firsttime = false
		player.Powerup = 2
	end
end

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Feb 16, 2016 12:56 am
by Kevsoft
You can use _G variable:

Code: Select all

_G["firsttime"] = true

Re: LunaLua Offical Thread - SMBX Usermod Framework

Posted: Tue Feb 16, 2016 6:35 am
by PixelPest
Kevsoft wrote:You can use _G variable:

Code: Select all

_G["firsttime"] = true
Okay. Thank you. Where do I define this variable (lunadll.lua or lunaworld.lua)?