Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Dec 20, 2015 4:31 pm
Thank you guys for the help, hopefully (and probably) it'll succeed. 

Forums for SMBX
https://www.smbxgame.com/forums/
This is an issue, which is already solved in the dev version. You can still activate godmode with the cheat "donthurtme".TheDinoKing432 wrote:God Mode doesn't seem to work when I use LunaLua on the editor.
http://hastebin.com/ezenekehej.luaPixelPest wrote:Can someone please help me with this? I have no idea where to start. I'm trying to create a system where you talk to NPCs, and then they disappear. After you talk to x number of NPCs (increasing amount in each level), an event is triggered.
So pretty much, I know I need some code called when an NPC is talked to and then a counter of some type that has a value of +1 added to it each time you talk to an NPC, then when the value is equal to a set number, the event is triggered.
Please help. I have no idea how to code this. (You will be given credit on the episode for your help.)
That looks amazing!Spinda wrote: Also, I did a thing:
Spoiler: show
I guess it's the battle system from Undertale.ShadowStarX wrote:That looks amazing!Spinda wrote: Also, I did a thing:
Spoiler: show
Is it going to be a quiz show?
Code: Select all
local Coins = 0;
local Counter = Graphics.loadImage("coincounter.png")
function onLoop()
Text.print(Coins, 280, 80)
end
function onHUDDraw()
Graphics.drawImage(Counter, 230, 80)
end
function onNPCKill(eventObj,npcID,killReason)
if npcID.id == 10 then
Coins = Coins + 1;
end
UserData.save()
end
Code: Select all
local Coins = 0;
local Counter = Graphics.loadImage("coincounter.png")
function onLoop()
Text.print(Coins, 280, 80)
Coins = Data(Data.DATA_WORLD)
Data:set("Coins", 0;)
end
function onHUDDraw()
Graphics.drawImage(Counter, 230, 80)
end
function onNPCKill(eventObj,npcID,killReason)
if npcID.id == 10 then
Data:get(Coins + 1;)
end
Data.save()
end
Thanks Spinda. That actually makes sense!Spinda wrote:http://hastebin.com/ezenekehej.luaPixelPest wrote:Can someone please help me with this? I have no idea where to start. I'm trying to create a system where you talk to NPCs, and then they disappear. After you talk to x number of NPCs (increasing amount in each level), an event is triggered.
So pretty much, I know I need some code called when an NPC is talked to and then a counter of some type that has a value of +1 added to it each time you talk to an NPC, then when the value is equal to a set number, the event is triggered.
Please help. I have no idea how to code this. (You will be given credit on the episode for your help.)
Also, I did a thing:
Spoiler: show
Code: Select all
events = {"count"}
counter = 0
gotRun = false
function onEvent(eventname)
for _,v in pairs(events) do
if eventname = v then
counter = counter + 1
end
end
end
function onLoop()
if counter == 1 and not gotRun then
gotRun = true
end
end
if gotRun = true
then ...
end
http://hastebin.com/ruzuzitoya.luaPixelPest wrote:So now that I have this (the first level only has one NPC that needs to be talked to), how do I trigger an event to happen? I have an event named "end" that shows the SMB3 star to end the level. Or, would it be easier to spawn an SMB3 star; if so how would I do so?Code: Select all
events = {"count"} counter = 0 gotRun = false function onEvent(eventname) for _,v in pairs(events) do if eventname = v then counter = counter + 1 end end end function onLoop() if counter == 1 and not gotRun then gotRun = true end end if gotRun = true ... end
It's all starting to come together. Thanks for all of your help!Spinda wrote:http://hastebin.com/ruzuzitoya.luaPixelPest wrote:So now that I have this (the first level only has one NPC that needs to be talked to), how do I trigger an event to happen? I have an event named "end" that shows the SMB3 star to end the level. Or, would it be easier to spawn an SMB3 star; if so how would I do so?Code: Select all
events = {"count"} counter = 0 gotRun = false function onEvent(eventname) for _,v in pairs(events) do if eventname = v then counter = counter + 1 end end end function onLoop() if counter == 1 and not gotRun then gotRun = true end end if gotRun = true ... end
pretty much this.
also menues, oh my.Spoiler: show
Yes! It works!Spinda wrote:oh rip it should be == (as a matter of fact, = is used for declaring stuff and == is used for comparing stuff)