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:

To use this script:

  1. Save it as a .lua file in your song's data folder (e.g., 'data/your-song-name/randomPlayback.lua').
  2. 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.

Translate Another Code