how to find or replicate PowerUDFreeze.lua?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
FlyingGym
Koopa
Koopa
Posts: 16
Joined: Sat Aug 17, 2019 3:28 pm
Flair: ok

how to find or replicate PowerUDFreeze.lua?

Postby FlyingGym » Wed Aug 21, 2019 6:59 pm

How would I (or someone else) create a time stop when you power up or down (I know PowerUDFreeze.lua does this,but it's dropbox is 404)? (https://wohlsoft.ru/pgewiki/PowerUDFreeze.lua)

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9731
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: how to find or replicate PowerUDFreeze.lua?

Postby Emral » Wed Aug 21, 2019 7:21 pm

Defines.levelFreeze = player.forcedState > 0
A simple > 0 check freezes even in tanooki transformation, while entering doors, etc...
A check that just checks stuff related to powerups would look a bit more like this:

local forcedStates = {
1 = true, -- powerup
2 = true, -- powerdown
4 = true, -- fire flower
5 = true, -- leaf
11 = true, -- tanooki
12 = true, -- hammer
41 = true, -- ice flower
227 = true, -- toad fire flower
228 = true -- toad ice flower
}

function onTick()
Defines.levelFreeze = forcedStates[player.forcedState]
end

https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets

FlyingGym
Koopa
Koopa
Posts: 16
Joined: Sat Aug 17, 2019 3:28 pm
Flair: ok

Re: how to find or replicate PowerUDFreeze.lua?

Postby FlyingGym » Wed Aug 21, 2019 7:57 pm

so would something like this work? (I'm also testing it myself)
local forcedStates = {
1 = true, -- powerup
2 = true, -- powerdown
}


function onTick()
Defines.levelFreeze = forcedStates[player.forcedState]
end
Update: it says expected } to close local forcedStates = { on the next line near =

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9731
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: how to find or replicate PowerUDFreeze.lua?

Postby Emral » Wed Aug 21, 2019 9:25 pm

I forgot to put the square brackets
each line in the table should read:
[number] = true,

rather than
number = true

Also you kinda want all the ones I listed, not just states 1 and 2.

FlyingGym
Koopa
Koopa
Posts: 16
Joined: Sat Aug 17, 2019 3:28 pm
Flair: ok

Re: how to find or replicate PowerUDFreeze.lua?

Postby FlyingGym » Thu Aug 22, 2019 12:40 pm

Thank you, it works. But there’s some error that happens only when I reset or exit testing and seems to have no effect on the episode.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9731
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: how to find or replicate PowerUDFreeze.lua?

Postby Emral » Thu Aug 22, 2019 4:33 pm

"Some error" is too vague for me to be able to help. Is there an error message? Can you share it?

FlyingGym
Koopa
Koopa
Posts: 16
Joined: Sat Aug 17, 2019 3:28 pm
Flair: ok

Re: how to find or replicate PowerUDFreeze.lua?

Postby FlyingGym » Thu Aug 22, 2019 6:52 pm

0t - warning: Overwriten handler onTick in worlds/episode/luna.lua
main.lua:445: in function '_newindex'
worlds/episode/luna.lua:44 in function 'codefile'
main.lua:470: in function 'loadCodeFile'
main.lua:597: in function <main.lua:520>
[C]: in function '_xpcall'
main.lua:520: <main.lua:519>

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9731
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: how to find or replicate PowerUDFreeze.lua?

Postby Emral » Thu Aug 22, 2019 7:02 pm

FlyingGym wrote:
Thu Aug 22, 2019 6:52 pm
0t - warning: Overwriten handler onTick in worlds/episode/luna.lua
main.lua:445: in function '_newindex'
worlds/episode/luna.lua:44 in function 'codefile'
main.lua:470: in function 'loadCodeFile'
main.lua:597: in function <main.lua:520>
[C]: in function '_xpcall'
main.lua:520: <main.lua:519>
"Overwritten handler onTick" means that you have two onTick functions in your code file. There can only be one function per function name. Merge the two by putting the contents of both into one of them and removing the other.

FlyingGym
Koopa
Koopa
Posts: 16
Joined: Sat Aug 17, 2019 3:28 pm
Flair: ok

Re: how to find or replicate PowerUDFreeze.lua?

Postby FlyingGym » Thu Aug 22, 2019 7:11 pm

Whoops, I had the default one still in it. Thank you for your help.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari