ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.11k stars 2.15k forks source link

Change note rgb via code #14823

Closed Shiho-cmd closed 1 month ago

Shiho-cmd commented 3 months ago

Describe your problem here.

I want to make my notes look like this: Screenshot_20240604_001959 The colors hex code are: D1018E and 3E2C50 I'm trying to figure out how to do this for a while now so any help is appreciated!

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.

No response

Shiho-cmd commented 2 months ago

Btw i'm using 0.7.3

Shiho-cmd commented 2 months ago

Well i guess i wasn't very clear on my question

I want to change the notes (both player and oponnent) rgb to be pink and black like in the image the image i'm showing there is one of my attempts to do it i manage to make the opponent notes work but not the player ones

That's the code it's pretty messy cuz i was trying anything at this point to make that work

pastNoteID = 0
pastNoteStTi = 0

function opponentNoteHit()
    local dadColR = getProperty('dad.healthColorArray[0]')
    local dadColG = getProperty('dad.healthColorArray[1]')
    local dadColB = getProperty('dad.healthColorArray[2]')
    local bfColR = getProperty('boyfriend.healthColorArray[0]')
    local bfColG = getProperty('boyfriend.healthColorArray[1]')
    local bfColB = getProperty('boyfriend.healthColorArray[2]')

    local dadColFinal = string.format('%02x%02x%02x', dadColR, dadColG, dadColB)
    local bfColFinal = string.format('%02x%02x%02x', bfColR, bfColG, bfColB)
        for i = 0, getProperty('opponentStrums.length')-1 do
    setPropertyFromGroup('opponentStrums', 0, 'rgbShader.r', getColorFromHex(dadColFinal))
    setPropertyFromGroup('opponentStrums', 0, 'rgbShader.g', getColorFromHex('FFFFFF'))
    setPropertyFromGroup('opponentStrums', 0, 'rgbShader.b', getColorFromHex(dadColFinal))
    setPropertyFromGroup('opponentStrums', 1, 'rgbShader.r', getColorFromHex(bfColFinal))
    setPropertyFromGroup('opponentStrums', 1, 'rgbShader.g', getColorFromHex('FFFFFF'))
    setPropertyFromGroup('opponentStrums', 1, 'rgbShader.b', getColorFromHex(bfColFinal))
    setPropertyFromGroup('opponentStrums', 2, 'rgbShader.r', getColorFromHex(dadColFinal))
    setPropertyFromGroup('opponentStrums', 2, 'rgbShader.g', getColorFromHex('FFFFFF'))
    setPropertyFromGroup('opponentStrums', 2, 'rgbShader.b', getColorFromHex(dadColFinal))
    setPropertyFromGroup('opponentStrums', 3, 'rgbShader.r', getColorFromHex(bfColFinal))
    setPropertyFromGroup('opponentStrums', 3, 'rgbShader.g', getColorFromHex('FFFFFF'))
    setPropertyFromGroup('opponentStrums', 3, 'rgbShader.b', getColorFromHex(bfColFinal))
end
end

function fixTimeBar()    
    local dadColR = getProperty('dad.healthColorArray[0]')
    local dadColG = getProperty('dad.healthColorArray[1]')
    local dadColB = getProperty('dad.healthColorArray[2]')
    local bfColR = getProperty('boyfriend.healthColorArray[0]')
    local bfColG = getProperty('boyfriend.healthColorArray[1]')
    local bfColB = getProperty('boyfriend.healthColorArray[2]')

    local dadColFinal = string.format('%02x%02x%02x', dadColR, dadColG, dadColB)
    local bfColFinal = string.format('%02x%02x%02x', bfColR, bfColG, bfColB)
        for i = 0, getProperty('unspawnNotes.length')-1 do
            if getPropertyFromGroup('unspawnNotes', i, 'mustPress') == false then
    setPropertyFromGroup('unspawnNotes', i, 'rgbShader.enabled', false)
            end
        end
end

function onSongStart()
    fixTimeBar()
end

function onCountdownTick(counter)
if counter == 0 then
    fixTimeBar()
  end
end

I just stole someones code i saw on gamebanana that did something similar to what i wanted so i tried messing around and didn't get anywhere so please please if someone can help me it would be REALLY appreciated

JoaoVictor742 commented 1 month ago

Well, I kind of based myself on someone else's script and this script you sent to make this script as well, but I hope it helped

--bf rgb
    local bfRGBNr = { 'C24B99', '00FFFF', '12FA05', 'F9393F' }
    local bfRGBNg = { 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF' }
    local bfRGBNb = { '3C1F56', '1542B7', '0A4447', '651038' }
-- dad rgb
    local dadRGBNr = { 'C24B99', '00FFFF', '12FA05', 'F9393F'  }
    local dadRGBNg = { 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF' }
    local dadRGBNb = { '3C1F56', '1542B7', '0A4447', '651038' }

-- note   
function onSpawnNote(id, nd, nt, sus)
    if getPropertyFromGroup('notes', id, 'mustPress') == true then
        setPropertyFromGroup('notes', id, 'rgbShader.r', getColorFromHex(bfRGBNr[getPropertyFromGroup('notes', id, 'noteData')+1]))
        setPropertyFromGroup('notes', id, 'rgbShader.g', getColorFromHex(bfRGBNg[getPropertyFromGroup('notes', id, 'noteData')+1]))      
        setPropertyFromGroup('notes', id, 'rgbShader.b', getColorFromHex(bfRGBNb[getPropertyFromGroup('notes', id, 'noteData')+1]))
    else
        setPropertyFromGroup('notes', id, 'rgbShader.r', getColorFromHex(dadRGBNr[getPropertyFromGroup('notes', id, 'noteData')+1]))
        setPropertyFromGroup('notes', id, 'rgbShader.g', getColorFromHex(dadRGBNg[getPropertyFromGroup('notes', id, 'noteData')+1]))
        setPropertyFromGroup('notes', id, 'rgbShader.b', getColorFromHex(dadRGBNb[getPropertyFromGroup('notes', id, 'noteData')+1]))
    end
end
-- strum note
function onUpdatePost(e)
    for i=0, getProperty('playerStrums.length')-1 do
        setPropertyFromGroup('playerStrums', i, 'rgbShader.r', ((getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(bfRGBNr[i+1]) or getColorFromHex(bfRGBNr[i+1])))
        setPropertyFromGroup('playerStrums', i, 'rgbShader.g', ((getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(bfRGBNg[i+1]) or getColorFromHex(bfRGBNg[i+1])))
        setPropertyFromGroup('playerStrums', i, 'rgbShader.b', ((getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('playerStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(bfRGBNb[i+1]) or getColorFromHex(bfRGBNb[i+1])))
    end
    for i=0, getProperty('opponentStrums.length')-1 do
        setPropertyFromGroup('opponentStrums', i, 'rgbShader.r', ((getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(dadRGBNr[i+1]) or getColorFromHex(dadRGBNr[i+1])))
        setPropertyFromGroup('opponentStrums', i, 'rgbShader.g', ((getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(dadRGBNg[i+1]) or getColorFromHex(dadRGBNg[i+1])))
        setPropertyFromGroup('opponentStrums', i, 'rgbShader.b', ((getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'pressed' or getPropertyFromGroup('opponentStrums', i, 'animation.curAnim.name') == 'confirm') and getColorFromHex(dadRGBNb[i+1]) or getColorFromHex(dadRGBNb[i+1])))

    end
end