Page 1 of 1
how to find or replicate PowerUDFreeze.lua?
Posted: Wed Aug 21, 2019 6:59 pm
by FlyingGym
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)
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Wed Aug 21, 2019 7:21 pm
by Emral
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
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Wed Aug 21, 2019 7:57 pm
by FlyingGym
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 =
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Wed Aug 21, 2019 9:25 pm
by Emral
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.
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Thu Aug 22, 2019 12:40 pm
by FlyingGym
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.
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Thu Aug 22, 2019 4:33 pm
by Emral
"Some error" is too vague for me to be able to help. Is there an error message? Can you share it?
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Thu Aug 22, 2019 6:52 pm
by FlyingGym
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>
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Thu Aug 22, 2019 7:02 pm
by Emral
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.
Re: how to find or replicate PowerUDFreeze.lua?
Posted: Thu Aug 22, 2019 7:11 pm
by FlyingGym
Whoops, I had the default one still in it. Thank you for your help.