ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.15k stars 2.21k forks source link

Check if the note got Sick/Good/Bad/Shit rating and change appropriately-given score #9360

Closed RowanSkie closed 2 years ago

RowanSkie commented 2 years ago

Describe your problem here.

I'm now doing the script I described here in https://github.com/ShadowMario/FNF-PsychEngine/issues/9190, and one thing I noticed is that I don't have a way to learn if a player has hit the note correctly. Is it possible in Lua?

I've asked because I've created a script that will essentially make it that scores are capped to 1 million, and I don't know how to check or change the score.

function onCreatePost()
    totalnotes = getProperty('unspawnNotes.length')
    million = 1000000

    -- get the score with a Sick note
    sickScore = million/totalnotes

    -- good gets 85% of score for Sick
    goodScore = sickScore*0.85

    -- bad gets 75% of score for Sick
    badScore = sickScore*0.75

    -- shit gets 50% of score for Sick
    shitScore = sickScore*0.5

end

function goodNoteHit(id, direction, noteType, isSustainNote)
    oldScore = score
    if ratingName == "sick" then
        setProperty('songScore', (oldScore + sickScore))
    elseif ratingName == "good" then
        setProperty('songScore', (oldScore + goodScore))
    elseif ratingName == "bad" then
        setProperty('songScore', (oldScore + badScore))
    elseif ratingName == "shit" then
        setProperty('songScore', (oldScore + shitScore))
    end
    -- basically check if player note rating is then change the score
end

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

Meme1079 commented 2 years ago
function onCreatePost()
    totalnotes = getProperty('unspawnNotes.length')
    million = 1000000

    -- get the score with a Sick note
    sickScore = million/totalnotes

    -- good gets 85% of score for Sick
    goodScore = sickScore*0.85

    -- bad gets 75% of score for Sick
    badScore = sickScore*0.75

    -- shit gets 50% of score for Sick
    shitScore = sickScore*0.5
end

function goodNoteHit(id, direction, noteType, isSustainNote)
     oldScore = score
     if getProperty('sicks') then
          setScore(oldScore + sickScore)
     elseif getProperty('goods') then
          setScore(oldScore + goodScore)
     elseif getProperty('bads') then
          setScore(oldScore + badScore)
     elseif getProperty('shits') then
          setScore(oldScore + shitScore)
     end
    -- basically check if player note rating is then change the score
end
RowanSkie commented 2 years ago

Wow, that's actually really more efficient and working than what I was trying.

LarissaCeleste commented 2 years ago

I swear, I look back at my old scripts where I tried to do this and I STILL laugh at myself XD ratingName wasn't the NOTE judgment, it was the ACCURACY judgment that sits at the bottom!