Leather128 / LeatherEngine

Just a little engine I decided to make since nobody seemed to have true custom mod support.
GNU General Public License v3.0
68 stars 59 forks source link

Question: grabbing accuracy (and misses) for math equations in modcharts #280

Closed sanamasako closed 1 year ago

sanamasako commented 1 year ago

I want to make a complicated variant of healthdrain that will change depending on the player's accuracy and misses. So, I guess the better off the player is, the more the opponent drains the HP, and the more notes the player has missed, the more HP they'll have when the opponent is done pushing the player's icon to the right of the healthbar. However, the script doesn't seem to be working? Not sure if either one are supposed to be in quotes but I've seen accuracy in quotes for the Overobsessed Lunatic ending script (Shaggy Crossover Bonanza). Never seen misses as a factor though. But, let me know what you think. Not labeling this as a bug since I don't know coding that well, so I'm not sure if some things just can't be grabbed for equations or I'm not doing it right.

function playerTwoSing(data, time, type) if getHealth() - (accuracy / 100) > 0.001 then setHealth(getHealth() - (accuracy / 100)) else setHealth(0.001 + (misses / 1.5)) end end

I'm about to try putting both accuracy AND misses in quotes, but that'll probably mess up the whole thing. As I said I'm not sure if I'm supposed to put either accuracy or misses in quotes.

Leather128 commented 1 year ago

Alright well the latest commit (cba06a1) should fix this, but to get it working in the latest release of the engine, all you have to do is this:

function playerTwoSing(data, time, type)
    accuracy = getProperty("", "accuracy")
    misses = getProperty("", "misses")

    if getHealth() - (accuracy / 100) > 0.001 then
        setHealth(getHealth() - (accuracy / 100))
    else
        setHealth(0.001 + (misses / 1.5))
    end
end

:+1: