Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sat Feb 13, 2016 9:04 pm
Okay, so how would I do that only for NPC 229 or how would I teleport it off of the screen?
Forums for SMBX
https://www.smbxgame.com/forums/
For teleporting it offscreen you could probably just do v.x = 0.PixelPest wrote:Okay, so how would I do that only for NPC 229 or how would I teleport it off of the screen?
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
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
PixelPest wrote:Is it just as simple as that Pyro?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
Code: Select all
v.x = 0
Code: Select all
Audio.sounds[9].muted = true -- for muting the death song of the npc 229
nope only for this command and this fishPixelPest 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?
Awesmazing; thanks.lotus006 wrote:nope only for this command and this fishPixelPest 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?
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
Thanks. npc:kill(9) will make things so much easier.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)
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.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?
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
This sounds like you have an older version of LunaLua. The newest version is 0.7.3.Nat The Porcupine wrote: help me out?
Code: Select all
firsttime = true
Code: Select all
function onLoad
if firsttime == true then
firsttime = false
player.Powerup = 2
end
end
Code: Select all
_G["firsttime"] = true
Okay. Thank you. Where do I define this variable (lunadll.lua or lunaworld.lua)?Kevsoft wrote:You can use _G variable:Code: Select all
_G["firsttime"] = true