It looks like you're trying to create custom notes in Friday Night Funkin' (FNF) using Psych Engine 0.7.3, but with behaviors inspired by Project Diva. Project Diva features notes like taps, holds, slides, and flicks, which involve precise timing, gestures, or sustained inputs. Since FNF is primarily keyboard-based and Psych Engine uses Lua for scripting, we'll need to adapt these ideas by modifying the note system.
In Psych Engine, notes are managed through the game's Lua scripts (e.g., in the playstate.lua or custom scripts). You can add custom note types by:
- Defining new note properties (e.g., a custom
noteType like "projectDiva").
- Overriding functions like
goodNoteHit, noteMiss, or onUpdate to handle custom logic.
- Changing note visuals, animations, or input requirements.
Here's a step-by-step guide on how to do this, followed by a sample Lua script. This script assumes you're working in a mod's script file (e.g., scripts/yourCustomScript.lua). You'll need to place this in your mod's folder and ensure it's loaded via Psych Engine's script system.
Step-by-Step Guide:
-
Set Up Your Mod in Psych Engine:
- Open Psych Engine 0.7.3 and create a new mod or edit an existing one.
- In your mod's folder, go to
scripts/ and create a new file, e.g., customNotes.lua.
- Make sure your script is loaded. You can do this by adding it to the
data/scripts.txt file or using onCreate in playstate.lua.
-
Understand FNF Notes in Psych Engine:
- Notes in FNF are objects in a group called
notes. Each note has properties like noteData (direction: 0=left, 1=down, 2=up, 3=right), strumTime (when it should be hit), noteType (a string you can customize), and isSustainNote (for hold notes).
- To mimic Project Diva, you could:
- Add custom animations for "flick" or "slide" notes.
- Modify hit detection to require holding a key longer or pressing multiple keys.
- Change visuals (e.g., use custom sprites for notes).
-
Customize Notes:
- In your chart file (e.g.,
.json), add a custom noteType for notes you want to behave like Project Diva. For example, set "noteType": "projectDiva" in the note data.
- In the Lua script, use functions like
onCreatePost to modify notes after they're created, and goodNoteHit to handle custom input logic.
-
Potential Limitations:
- FNF doesn't natively support touch gestures like Project Diva, so we'll simulate them with keyboard inputs (e.g., hold for a sustain, or quick presses for a flick).
- This is for Psych Engine 0.7.3, so test thoroughly as newer versions might have changes.
- If you want more advanced features (e.g., custom input handlers), you might need to dig into the engine's source code.
-
How to Use the Script:
- Copy the script below into your
customNotes.lua file.
- In your song's chart, use notes with
"noteType": "projectDiva" to trigger the custom behavior.
- Customize the script as needed (e.g., change animations or sounds).
Sample Lua Script
Here's an example script that adds a custom note type called "projectDiva". It changes the note's appearance, plays a custom animation on hit, and adds simple custom logic (e.g., requiring a hold for certain notes). This is a starting point—you'll need to adjust paths, animations, and logic based on your assets.
-- Custom Notes Script for Psych Engine 0.7.3
-- Inspired by Project Diva: Adds custom note behavior for taps, holds, and simulated "flicks".
-- Place this in your mod's scripts folder (e.g., scripts/customNotes.lua)
function onCreatePost()
-- Loop through all notes and apply custom properties to notes with noteType "projectDiva"
for i = 0, getProperty('notes.length')-1 do
if getPropertyFromGroup('notes', i, 'noteType') == 'projectDiva' then
-- Change the note's texture to a custom one (e.g., a Project Diva-style sprite)
setPropertyFromGroup('notes', i, 'texture', 'notes/projectDivaNote') -- Replace with your asset path, e.g., in assets/images/notes/
-- Optional: Add custom scale or color for visual flair
setPropertyFromGroup('notes', i, 'scale.x', 1.2) -- Make it bigger
setPropertyFromGroup('notes', i, 'scale.y', 1.2)
setPropertyFromGroup('notes', i, 'alpha', 0.8) -- Make it semi-transparent
end
end
end
function goodNoteHit(id, noteData, noteType, isSustainNote)
if noteType == 'projectDiva' then
-- Custom hit logic for Project Diva-style notes
local note = getPropertyFromGroup('notes', id, 'ID') -- Get the note object
if isSustainNote then
-- Simulate a Project Diva hold note: Play a hold animation and require the key to be held
objectPlayAnimation(getPropertyFromGroup('notes', id, 'strumLineNotes'), 'holdProjectDiva', true) -- Custom animation
playSound('holdSound') -- Play a custom sound for holds (add your sound in assets/sounds/)
-- You could add a timer here to check if the key is held long enough
else
-- Simulate a tap or flick: Play a quick animation and add score
objectPlayAnimation(getPropertyFromGroup('notes', id, 'strumLineNotes'), 'flickProjectDiva', true) -- Custom flick animation
playSound('flickSound') -- Play a custom sound
addScore(100) -- Give extra points for hitting it
end
-- Remove the note after hit
removeFromGroup('notes', id)
else
-- Call the default hit function for normal notes
callParentFunction('goodNoteHit', {id, noteData, noteType, isSustainNote})
end
end
function noteMiss(id, noteData, noteType, isSustainNote)
if noteType == 'projectDiva' then
-- Custom miss logic: Play a miss animation or sound
playSound('missSound') -- Play a custom miss sound
addMisses(1) -- Increment misses
-- Optional: Shake the screen or show a failure effect
cameraShake('game', 0.01, 0.1) -- Shake the camera briefly
else
-- Call the default miss function
callParentFunction('noteMiss', {id, noteData, noteType, isSustainNote})
end
end
function onUpdate(elapsed)
-- Optional: Add custom update logic, e.g., for sliding notes
for i = 0, getProperty('notes.length')-1 do
if getPropertyFromGroup('notes', i, 'noteType') == 'projectDiva' and not getPropertyFromGroup('notes', i, 'wasGoodHit') then
-- Example: Make the note move differently (e.g., slide across the screen)
local xPos = getPropertyFromGroup('notes', i, 'x')
setPropertyFromGroup('notes', i, 'x', xPos + 50 * elapsed) -- Slide to the right over time
end
end
end
Explanation of the Script:
- onCreatePost(): Runs after the notes are created. It loops through the notes and applies custom properties (like changing the texture) to notes with
noteType == 'projectDiva'.
- goodNoteHit(id, noteData, noteType, isSustainNote): Handles when a note is hit. For "projectDiva" notes, it plays custom animations and sounds. If it's a sustain note, it treats it like a hold; otherwise, like a tap/flick.
- noteMiss(id, noteData, noteType, isSustainNote): Handles missed notes, with custom effects for "projectDiva" notes.
- onUpdate(elapsed): Runs every frame. Here, we add simple movement (e.g., sliding) for custom notes.
Tips for Customization:
- Assets: Replace strings like
'notes/projectDivaNote' with paths to your actual image files. Add your custom sprites to assets/images/notes/ and sounds to assets/sounds/.
- Animations: Use tools like Aseprite to create animations (e.g.,
flickProjectDiva) and import them into your mod.
- Testing: Load your song in Psych Engine and check the console for errors. Use notes with
"noteType": "projectDiva" in your chart editor.
- Advanced Features: If you want more complex behaviors (e.g., multi-key presses for gestures), you might need to hook into input functions like
onKeyPress. Refer to Psych Engine's documentation or source code for more details.
- Common Issues: If functions like
callParentFunction don't work, use luaDebugMode or check the engine's logs. Update to a newer Psych Engine version if possible, but stick to 0.7.3 as requested.
This is a basic example—Project Diva's mechanics are more gesture-based, which might not translate perfectly to FNF. If you run into issues, share more details (e.g., specific note behaviors you want), and I can refine this further! 😊