Page 36 of 76
Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 04, 2016 12:12 pm
by Reign
I might have been a bit unclear in my previous message. The fact that there are no updates is fine, as long as nothing else breaks in the future. Since even the generators worked with healthpoint.lua in an earlier versio of Lunalua.
I don't want somebody to download my episode in 2018 and encounter errors that were not there in the 2016 LunaLua.

Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 04, 2016 3:36 pm
by SpoonyBardOL
Enjl wrote:If that doesn't work, there's a bug I noticed with LunaTester in PGE regarding episode-wide sounds.ini
For some reason sounds.ini sometimes does not work unless a level-wise sounds.ini was loaded before (I don't know if this was fixed yet). Try sounds/smw-exit.ogg (or your new filename format) once more, but test it from the main game if possible. Though not being able to properly hear the sound when testing is a nuisance, you can confirm that it works this way.
Ok, this worked. I probably should have tried this first, but it's good to know. Thanks.
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 10:19 am
by Ness-Wednesday
Where would be a good place to learn about the npc's animation timer?
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 10:41 am
by PixelPest
Ness-Wednesday wrote:Where would be a good place to learn about the npc's animation timer?
http://wohlsoft.ru/pgewiki/NPC_(class)
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 8:35 pm
by loop
I can't get customLotus.lua to load for some reason. Here is the code:
Code: Select all
local npcParse = API.load("npcParse");
local customLotus = API.load("NPCs\\customLotus")
What am I doing wrong or missing??

Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 8:38 pm
by PixelPest
Jayce 777 wrote:I can't get customLotus.lua to load for some reason. Here is the code:
Code: Select all
local npcParse = API.load("npcParse");
local customLotus = API.load("NPCs\\customLotus")
What am I doing wrong or missing??

I don't think "NPCs" is the name of the folder, if I remember correctly? I also always use "/" instead of "\\", however I'm not sure that'll make a difference
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 8:45 pm
by loop
PixelPest wrote:Jayce 777 wrote:I can't get customLotus.lua to load for some reason. Here is the code:
Code: Select all
local npcParse = API.load("npcParse");
local customLotus = API.load("NPCs\\customLotus")
What am I doing wrong or missing??

I don't think "NPCs" is the name of the folder, if I remember correctly? I also always use "/" instead of "\\", however I'm not sure that'll make a difference
I got it from the level Shogun from the demo stages, and that was what was in it.

Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 8:49 pm
by PixelPest
Well, do you have any other code that could be the issue?
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 9:05 pm
by loop
Don't worry, PixelPest. I solved the issue.
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 10, 2016 9:07 pm
by PixelPest
Jayce 777 wrote:Don't worry, PixelPest. I solved the issue.
Just wondering, what was the issue?
Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 11, 2016 6:17 am
by loop
PixelPest wrote:Jayce 777 wrote:Don't worry, PixelPest. I solved the issue.
Just wondering, what was the issue?
customLotus.Lua not loading. I was a little vague.
Re: Need help with lua? - LunaLua General Help
Posted: Sun Oct 16, 2016 9:21 pm
by Ghostly_Guy
Can I set an event to permanently trigger once I get a certain number of stars?
Re: Need help with lua? - LunaLua General Help
Posted: Sun Oct 16, 2016 9:33 pm
by PixelPest
Ghostly_Guy wrote:Can I set an event to permanently trigger once I get a certain number of stars?
You'll need to refer to the global memory value 0x00B251E0 for stars. You could use triggerEvent(), although there's a good chance there's a more efficient way to do what you're trying to do with the event. What does it do?
Re: Need help with lua? - LunaLua General Help
Posted: Sun Oct 16, 2016 9:52 pm
by Ghostly_Guy
PixelPest wrote:Ghostly_Guy wrote:Can I set an event to permanently trigger once I get a certain number of stars?
You'll need to refer to the global memory value 0x00B251E0 for stars. You could use triggerEvent(), although there's a good chance there's a more efficient way to do what you're trying to do with the event. What does it do?
The event would create a generator where there wasn't one earlier. I'm trying to make it so that anytime that you enter the level with "X" or more stars, the generator is active.
Re: Need help with lua? - LunaLua General Help
Posted: Sun Oct 16, 2016 9:54 pm
by PixelPest
Then don't worry about events. Use Layer:show() instead:
http://wohlsoft.ru/pgewiki/Layer_(class)
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 17, 2016 5:06 pm
by DeMuZ
I'm looking for a CinematX.lua tutorial (I'd like to make a boss fight). Could you give me a link to it? (Don't even try to link a pgewiki page about it :v)
Re: Need help with lua? - LunaLua General Help
Posted: Mon Oct 17, 2016 5:31 pm
by Hoeloe
DeMuZ wrote:I'm looking for a CinematX.lua tutorial (I'd like to make a boss fight). Could you give me a link to it? (Don't even try to link a pgewiki page about it :v)
It's not at all recommended to use CinematX. It's very outdated, and actually mostly broken.
It's best to use these three libraries, which are more stable, and have some of the things you need:
http://wohlsoft.ru/pgewiki/Pnpc.lua
http://wohlsoft.ru/pgewiki/Colliders.lua
http://wohlsoft.ru/pgewiki/Eventu.lua
Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 18, 2016 5:38 am
by DeMuZ
Thank you very much!

Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 18, 2016 9:37 pm
by Ghostly_Guy
Thanks! This worked!
Anyways, how do you set a player offset? I tried this:
Code: Select all
function onLoop()
if player:mem(PC+0x154, FIELD_WORD) == 87 then
player:mem(PC+0x154,FIELD_WORD) = 17;
end
end
And I got this:

(I blacked out parts of the location because I'm going to use this for a contest.)
Re: Need help with lua? - LunaLua General Help
Posted: Tue Oct 18, 2016 9:48 pm
by PixelPest
It's not PC+0x154, just 0x154. Also use onTick() instead of onLoop(); the latter is deprecated