VE - Hit Formula

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,440
First Language
Portuguese
Primarily Uses









This plugin allows you to setup different formulas to decide hit success of actions. You can use that to change the default hit/evade algorithm or create actions with special hit conditions.

Download:
Victor Engine - Hit Formula

Credits:
Author: Victor Sant

Terms of Use
 
Last edited by a moderator:

Black Noise

Veteran
Veteran
Joined
Aug 23, 2012
Messages
94
Reaction score
18
First Language
English
Primarily Uses
RMMV
Question...

How I want my Hit Formula is sort of 

add together the Hit Rate and a custom stat I call "Perception" (The Hit Rate serves as an added bonus given by special skills and states)

then subtract the targets Evasion along with its Agility stat but divide the Agi value by two.

In other words, I'm thinking hit + per - eva + agi / 2.

Is this the correct formula for that?

Thanks.
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,440
First Language
Portuguese
Primarily Uses
Question...

How I want my Hit Formula is sort of 

add together the Hit Rate and a custom stat I call "Perception" (The Hit Rate serves as an added bonus given by special skills and states)

then subtract the targets Evasion along with its Agility stat but divide the Agi value by two.

In other words, I'm thinking hit + per - eva + agi / 2.

Is this the correct formula for that?

Thanks.
you don't need to assign the battler for hit and eva, but you need for all other stats.

So if the "per" stat is from the user and the "agi" is from the target, you need to use 'a.per' and 'b.agi'. (a stand for the user, b stand for the target).

So your formula would be:  hit + a.per - eva + b.agi / 2

That's assuming that another plugin create the stat "per".
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
466
Reaction score
223
First Language
Portuguese
Primarily Uses
RMMV
Congrats on another great plugin, Victor. Is is possible to add custom formulas?

Like, I want to default my hit formula by the plugin parameter, but notetag in a skill a <hit formula> that alters it for, like, a magic attack or an attack easier to hit but that deals less damage?

While in the mood, what about a <miss> tag for attacks that deal damage or apply a state even on a miss? This could greatly improve your (already great) plugin!
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,440
First Language
Portuguese
Primarily Uses
Like, I want to default my hit formula by the plugin parameter, but notetag in a skill a <hit formula> that alters it for, like, a magic attack or an attack easier to hit but that deals less damage?
Adding a default hit formula with a plugin parameter and using different formulas with notetags is exactly what the plugin does.

What different from that you want to do?

While in the mood, what about a <miss> tag for attacks that deal damage or apply a state even on a miss? This could greatly improve your (already great) plugin!
While this can be a nice idea for another pluing, this would be outside of the scope for this one. This plugin is for deciding if an action hit or miss.

I avoid to clutter my plugins with features that aren't part of the core concept.
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I'm gonna threadomancy a bit, i tried posting on your website, but for some odd reason, your submit button didn't work (part of me thought that very funny to have a script problem for a scripter's forum)

Here's the pasta !


This plugin might make all my fantasies come true, and i thank you fondly for that !


I tried copying a example you gave in a comment, and pasting it into the plugin but every attack made, no matter whom from, misses


<hit formula>result = (Math.randomInt(20) + 1 + Math.floor((a.atk – 10) * 0.5) >= b.def) ? 100 : 0 </hit formula>


I tried putting every "core" Parameter to 0 (in case of interference from standard hit calculation, or evade, both for the actor and the ennemy but nothing changed.


I tried using a very low number as "def" but still only misses


I do have your core plugin (tried without, it asked for variable)


I tried putting the line on the "attack skill" as well, to no avail


I'm saying all that to show that i tried, i really tried to make it work and not have to bother people about my inadequacies, but after an hour, it was all in vain


Any idea what i could have failed ?


EDIT : Wait a minute ! Can i add those formulas to individual weapons ? .. it says skills and items, but it you could be referencing to the "item" category
 
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,440
First Language
Portuguese
Primarily Uses
Due to a mistake on the code, you must add the 'result = ' when adding the code to the plugin parameter (it wasn't intended to be like this)


To test if the plugin is working try using the following code on the plugin parameters:


result = Math.randomInt(100) >= 50 ? 100 : 0


This will give a 50% hit rate, if this code works and your code don't, then the issue is with your formula. Notice that you shouldn't add the <hit formula> </hit formula> tag when adding the code to the plugin parameter, only when adding it to skills or items.

EDIT : Wait a minute ! Can i add those formulas to individual weapons ? .. it says skills and items, but it you could be referencing to the "item" category
Items are the objects on the database 'Item' tab. You can't add the tags to weapons, but you can always use a plugin that changes the basic attack skill based on the weapon such as the Replace Actions
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I had used the </hit formula>  tags in the plugin, and there is an error in my code


It all works now ! Thanks again for your work and your time
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
A month later, and your plugin is at the core of my project, i thank you for that !


I had the desire to add a variable dependant on my player's level, i initially though of maybe adding a +hit bonus tag to your plugin, but after a month of Js, this is still miles above my brain power...


I thought about using on my skills :


<hit formula>


if (Math.randomInt(20) + 1 + Level + Math.floor((a.atk-10) * 0.5) >= b.def) {


result = 100


} else {


result = 0


}


</hit formula>


But since skills are a general entity, it conflicts with ennemies trying to use them, and basically excludes any bonus diversity


(I cant have actor 1 as a warrior have +1 hit/level, and actor 2, as a mage have +1/2levels)


(This is basically BaB from the D20 system)


I tried playing with a Var, but since the attack skill is still gloabal... everyone would use it


I can envision an If clause, checking for actor/ennemy, and adding a Var bonus depending on the class... but it seems overly complicated


Is there a simpler way ? would it be hard for me to code in class tags (the most elegant and simple solution) ?


Thanks for your time
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,440
First Language
Portuguese
Primarily Uses
There are some plugins that add level to enemies, unless they do things that are too fancy, they shouldn't have any issue with this plugin.


Otherwise you will need a more complex condition, where you will need to check if the battler is a enemy.


for example:


<hit formula>


if (a.isActor() && Math.randomInt(20) + 1 + Level + Math.floor((a.atk-10) * 0.5) >= b.def) {


result = 100


} else if (a.isEnemy() && Math.randomInt(20) + 1 + Math.floor((a.atk-10) * 0.5) >= b.def) {


result = 100


} else {


result = 0


}


</hit formula>


(or add something else to replace the Level)
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I'll try and make it work with your formula and vars ;


Thanks for your quick answers, once more !
 
Last edited by a moderator:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I made it work ! thanks for the different perspective !



I'm kinda sorry for coming back with more...


Your plugin allows us to determine accuracy of a physical skills, by ignoring Eva, yet not setting its value to 0.


Exemple : i can have a hit-eva formula and the core program won't check that hit against Eva a second time.


Is it possible to make it work with MEV as well ? If not, any plans to modify it, or ideas for me to make it work ?


(i tried using hit-Mev, but Mev gets applied afterward, if i'm not mistaken


Edit : Still not in a hurry, but still interested


Edit : Added it as a plugin request, if anyone else is interested


Edit : 11/12/16 : Still interested
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

i watched the sonic movie it was pretty good i hope they make a sequel
tomorrow I'ma go on a cruise for the first time ever... lets hope I'll survive the experience!
Omg! 8 years in this forum :o
Ksi
Streaming the last of the RMN Valentiny event games so feel free to drop on by and watch me cry (whether that's from laughter, rage or sheer pain, who knows?)
Today I went to sleep without setting an alarm, so I could sleep more than 2 hours. I woke up after 2 hours.

Forum statistics

Threads
94,318
Messages
919,856
Members
124,064
Latest member
kt040
Top