Unique Accuracy Formula for each Skill

Discussion in 'JS Plugin Requests' started by darkmatter404, Aug 19, 2019.

  1. darkmatter404

    darkmatter404 Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    Hey all. I have a game which resembles the fallout series in it's mechanics / statistics. For example, there is a melee weapons skill that is supposed to influence the damage and accuracy of just melee weapon skills in combat. I can make the "melee weapons" skill into a variable and have that variable influence the damage formulas for the appropriate combat moves, but accuracy is a more difficult problem.

    I know you can set each skill to have it's own base accuracy, and then you can modify the players accuracy by some values across the board (like +5%) but I want each skill in combat to be influenced by it's skill stat (so all melee attacks are boosted in accuracy by each point to your melee weapons stat) along with your basic character statistics (perception).

    Hopefully this makes sense. I want your specific weapon skills to determine the accuracy of those weapons, but not others (which is why I cant just have the weapon skill add +accuracy to your character, as said accuracy will affect all skills in combat). How can I make this happen?

    I have YEP Hit Accuracy BTW, so right now the global accuracy formula is just the base skill's accuracy + your accuracy - enemy evasion. Thanks for any help.
     
    #1
  2. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,114
    Likes Received:
    687
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Not sure if there exists a plugin specifically for this (couldn't find one with a quick search)...

    However, you should be able to rig something for the Hit Accuracy plugin parameter's formula:
    Code:
    var acc = eval(skill.meta.Accuracy || ''); skillHitRate * (isNaN(acc) ? (userHitRate - targetEvadeRate) : acc)
    Then put an "Accuracy" notetag in each skill's notebox to specify the skill's hit formula, e.g.
    Code:
    <Accuracy: a.hit - b.eva + v[5]/20>
    As you can see, all the usual abbreviations should apply! Here, v[5] is the value of game variable 5, so we're getting +0.05 hit rate (where 1 = 100%) per +1 to the value of var 5. :)

    Very quickly tested with only the Hit Accuracy plugin and it seemed OK for me~ :kaothx:

    The plugin parameter thing says "evaluate the skill's Accuracy notetag as code and store the result in a temporary variable named acc; if acc is a number, return that number multiplied by the skill success rate, otherwise return Yanfly's default hit-minus-eva formula".
     
    #2
  3. darkmatter404

    darkmatter404 Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    Hey, thanks for the quick reply! This all is very promising, and seems to be exactly what I need. I have a few questions though.

    So I'd just paste that top code into the Hit Accuracy plugin wherever? I assume thats the case.

    For the accuracy notetag variables, I'm more confused. If you put v[5] is that the value of whatever variable 5 is? So if I make the formula v[5] / 100, then my variable 5 has a value of 100, it would be 1/1 = 100% accuracy? If I wanted to use a different variable, like something 368, it would just be v[368]?

    Sorry for the confusion.
     
    #3
  4. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,114
    Likes Received:
    687
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    I suggest putting the top code into the Hit Accuracy plugin's "Accuracy Formula" parameter, in the Plugin Manager. You can copy it verbatim, no changes needed unless you want to change the default value (i.e. the value used when using a skill without an Accuracy notetag) and/or the notetag label ("Accuracy"). :)

    Yes, v[5] should get replaced by the value of variable ID 5 at the time of calculating whether the skill will hit or not. v[368] should be the value of variable 368, v[42] the value of variable 42, etc. And then, as you say, if variable 5 is set equal to 100, the following formula will equal 1, i.e. it'll always hit:
    Code:
    v[5] / 100
    Hope that helps! :kaojoy:
     
    #4
  5. darkmatter404

    darkmatter404 Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    Thanks so much. I get what you mean now. Very appreciated!
     
    #5
    caethyril likes this.
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,561
    Likes Received:
    10,498
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to JS Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.


    If your query is fully resolved, please Report your post and ask for the thread to be closed. Mods might not see a post, but they will see a Report.
     
    #6

Share This Page