Re: Need help with lua? - LunaLua General Help
Posted: Wed Apr 20, 2016 1:40 am
Just use Graphics.drawImageWP with the priority of the HUD - you can look up how to use it and what that priority is on the wiki.
Forums for SMBX
https://www.smbxgame.com/forums/
Camacho wrote:OK so i played some levels with custom HUD and this happens (I had this problem since i updated my Lunalua from 0.7.2.2 into 0.7.3) also this problem happens with Hudoftime and SMB3 OverhaulSpoiler: show
That's not how APIs work.RhysOwens wrote: I've copied the HealthPoint.lua file into my level folder.
Code: Select all
local myAPI = API.load("myAPI");
I changed my code to this:Hoeloe wrote:That's not how APIs work.RhysOwens wrote: I've copied the HealthPoint.lua file into my level folder.
You don't need to copy anything. You just need to load the API in your Lua file using API.load, like this:
Code: Select all
local myAPI = API.load("myAPI");
nono, "myAPI" has to be "healthpoint".RhysOwens wrote:I changed my code to this:Hoeloe wrote:That's not how APIs work.RhysOwens wrote: I've copied the HealthPoint.lua file into my level folder.
You don't need to copy anything. You just need to load the API in your Lua file using API.load, like this:
Code: Select all
local myAPI = API.load("myAPI");
And it still says the HealthPoint is a nil value error.Spoiler: show
"HealthPoint"*Spinda wrote:nono, "myAPI" has to be "healthpoint".RhysOwens wrote:I changed my code to this:Hoeloe wrote:
That's not how APIs work.
You don't need to copy anything. You just need to load the API in your Lua file using API.load, like this:
Code: Select all
local myAPI = API.load("myAPI");
And it still says the HealthPoint is a nil value error.Spoiler: show
I strongly suggest you read some Lua tutorials if you can't work out why this is happening. You're never going to be able to do anything if you have to resort to asking the forums for every small thing.RhysOwens wrote: And it still says the HealthPoint is a nil value error.
I'm copying from what it says in the HealthPoint lua.Hoeloe wrote:I strongly suggest you read some Lua tutorials if you can't work out why this is happening. You're never going to be able to do anything if you have to resort to asking the forums for every small thing.RhysOwens wrote: And it still says the HealthPoint is a nil value error.
I suggest you listen to Hoeloe. For the record, Lua is case-sensitive.RhysOwens wrote:I'm copying from what it says in the HealthPoint lua.Hoeloe wrote:I strongly suggest you read some Lua tutorials if you can't work out why this is happening. You're never going to be able to do anything if you have to resort to asking the forums for every small thing.RhysOwens wrote: And it still says the HealthPoint is a nil value error.
I tired Misc.npctocoins and that's a nil value as well.
Next I tried putting local next to both Misc.npctocoins and HealthPoint.setNPCHealth and it says 'unexpected symbol near '.''
The Fighterfly still dies in 1 hit and doesn't turn into coins.
That's not a Lua tutorial. You should learn the basics of how Lua works as a programming language if you need to do more than just copy and paste.RhysOwens wrote: I'm copying from what it says in the HealthPoint lua.
I was copying the functions in the lua file near the beginning.Hoeloe wrote:That's not a Lua tutorial. You should learn the basics of how Lua works as a programming language if you need to do more than just copy and paste.RhysOwens wrote: I'm copying from what it says in the HealthPoint lua.
But you didn't understand enough of what you were doing to know that you need to define variables before you use them.RhysOwens wrote: I was copying the functions in the lua file near the beginning.
Could you be more specific? Are the entries getting shuffled to the wrong NPC or something?Nat The Porcupine wrote:Has anyone else noticed that variables defined through pnpc's data property seem to have issues with generators & NPCs spawned from generators? Perhaps I'm using an outdated version?
Do I call the variable HealthPoint?Hoeloe wrote:But you didn't understand enough of what you were doing to know that you need to define variables before you use them.RhysOwens wrote: I was copying the functions in the lua file near the beginning.