Quantcast
Channel: Super Mario Bros. X Forums
Viewing all articles
Browse latest Browse all 2929

LunaLua Help • Re: Need help with lua? - LunaLua General Help

$
0
0
I simply have great difficulty understanding codehaus or rather the syntax (as a non-coder that is). It almost never clicks for me before I at least see a practical example. I don't think I need to explain what I want to do here. This is like officialese, for real. There are a few small examples here and there and I would really like to see more of them.

Code:

function onSectionChange()if (sectionIdx == 0) thenDefines.earthquake = 20Audio.playSFX(37)endend

Code:

function onSectionChange(sectionIdx, playerIdx)if (sectionIdx == 0 and playerIdx ==1) thenDefines.earthquake = 20Audio.playSFX(37)endend
Does not work.

Code:

function onSectionChange()Defines.earthquake = 20Audio.playSFX(37)end
Does work, but then for every section change, which I do not want. I owe it largely to Emral and deice that I still understand anything at all.
For a new level (BTW: I actually ... finished one 100 %, hardly to believe but yes, this is for an other one) I actually need something to check, if a player enters a section and whatever happens then should only happen, once the player enters the section (can happen again, if (s)he re-enters later).
Yes I could very likely with something like
if player.x == blabla and player.section == blabla then
but at the end I would need a variable then which I could reset so it would work again if player enters the section again. onSectionChange seems to look more promising for what I want to do.

Statistics: Posted by Just_Thomas — Sun Mar 24, 2024 6:44 am



Viewing all articles
Browse latest Browse all 2929

Trending Articles