English to FNLUA (FNF Psych Engine Lua) Translation
Original English:
whenever you hit a note, the playback changes randomly
FNLUA (FNF Psych Engine Lua) Translation:
-- Define a table of possible playback changes
local playbackChanges = {
{pitch = 0.8, speed = 1.2},
{pitch = 1.2, speed = 0.8},
{pitch = 1.0, speed = 1.5},
{pitch = 1.5, speed = 1.0},
{pitch = 0.9, speed = 0.9},
{pitch = 1.1, speed = 1.1}
}
-- Function to apply random playback change
local function applyRandomPlaybackChange()
local change = playbackChanges[math.random(#playbackChanges)]
setSoundPitch('', change.pitch) -- Set pitch for all sounds
setProperty('songSpeed', change.speed) -- Set song speed
end
-- Function called when a note is hit
function goodNoteHit(id, direction, noteType, isSustainNote)
if not isSustainNote then -- Only trigger on non-sustain notes
applyRandomPlaybackChange()
end
end
-- Function called when an opponent note is hit (for fairness)
function opponentNoteHit(id, direction, noteType, isSustainNote)
if not isSustainNote then -- Only trigger on non-sustain notes
applyRandomPlaybackChange()
end
end
Note:
This FNLUA script for FNF Psych Engine (version 0.6.3) implements the requested functionality. Here's a breakdown of what it does:
- Defines a table of possible playback changes, affecting both pitch and speed.
- Implements a function to apply a random playback change.
- Hooks into both the player's and opponent's note hit events to trigger the random change.
- Changes are only applied on non-sustain notes to prevent rapid fluctuations during held notes.
To use this script:
- Save it as a .lua file in your song's data folder (e.g., 'data/your-song-name/randomPlayback.lua').
- Enable the script in your song's JSON file by adding its filename to the "scripts" array.
Note that frequent pitch and speed changes might affect gameplay balance and audio quality. You may need to adjust the values in the 'playbackChanges' table for the best experience.