Closed Average-FNF-Modder closed 8 months ago
Try using a local variable. For example:
function onSongStart()
local RandomNumber = getRandomInt(1, 3)
if RandomNumber == 1 then --If your random number is one it will triger this line
debugPrint('RandomNumber = 1')
elseif RandomNumber == 2 then --If your random number is two it will triger this line
debugPrint('RandomNumber = 2')
elseif RandomNumber == 3 then --If your random number is three it will triger this line
debugPrint('RandomNumber = 3')
end
end
I'm not 100% sure about your other issues... All your code looks right, but I could be wrong.
I think I got something that can prevent looping. It worked in all my testing. Here is an example:
local RandomNumber = nil;
local LastRandomNumber = nil;
function onBeatHit()
RandomNumber = getRandomInt(1, 3, LastRandomNumber) --Exclude the last generated number
if RandomNumber == 1 then --If your random number is one it will triger this line
debugPrint('RandomNumber = 1')
elseif RandomNumber == 2 then --If your random number is two it will triger this line
debugPrint('RandomNumber = 2')
elseif RandomNumber == 3 then --If your random number is three it will triger this line
debugPrint('RandomNumber = 3')
end
LastRandomNumber = RandomNumber
end
Thank you bro, huge help.
I'll try to figure out the camHUD glitch some other way.
Describe your problem here.
Hi. I'm a relatively newbie coder, trying to improve songs with new art, event charts and such in the FNF Sour demo. Cause the editor is locked, I'm doing everything in Lua, and editing the Json's manually. For that one sick part in Pulp, I want to do a fancy light show where 30% opacity screen flashes of random colors go across the screen. For this, I've implemented the 'getRandomInt((min), (max), true)' function. It looks cool, but sometimes none of the 3 get there values hit and nothing happen's on the beat hit, which I don't want. I'm unsure of how to strutcure my code to allow one getRandomInt() to apply to multiple outcomes, so I'm coming here. Attached below is a chunk of my code that handles the random flashing. If anyone knows how to do this it would be greatly appreciated.
P.S. Bonus points if you can somehow figure out how to prevent the same color from looping twice in a row, I have no clue where to even start on that...
Are you modding a build from source or with Lua?
Lua
What is your build target?
Windows x64
Did you edit anything in this build? If so, mention or summarize your changes.
Well... I didn't. The FNF Sour team might've, Idk. The custom menus probably required source because I don't see any scripts for it, but that seems to be the extent of the team's changes if I had to guess.