Hi guys,
I am trying to write a hit formula to use with Victor's Custom Hit Script and have almost no experience with Ruby, and I was wondering if someone might be able to help me out with this. Here is a link to Victor's script: https://dl.dropboxusercontent.com/u/27014140/Scripts/Victor%20Engine%20-%20Custom%20Hit%20Formula.txt
What I am trying to do is very simple. Essentially, if the formula returns a "True" result, the skill will hit. If it returns a "False" result, the skill will miss. According to Victor, "You can use "a" to refer to the attacker, "b" to refer to the defender, "v[x]" to use variables on the formula, "hit" to refer to the attacker hit, rate and "eva" to refer to the defender evasion."
I am trying to write a formula for a skill that will only hit Enemy ID 043. Could the following work?
<hit formula>
b.id % 43 == 1
</hit formula>
This might be hilariously wrong, but again, I have no experience with Ruby, so I was wondering if someone could help me out. Additionally, if in the future, I need this skill to hit enemy ID 44 and other enemy IDs as well, how would I go about making the formula include this?
Thank you so much for your help and support, and thanks to Victor for writing up this very handy script.
Lifestorm
Victor's Custom Hit Script Support
● ARCHIVED · READ-ONLY
-
-
yes, that formula is wrong.
% is the modulo operator, which results in the rest after a division.
You can see this in the script example of b.level % 5 == 0, which calculates into true if the level is 5 or 10 or 15 or 20 or so on.
b.id % 43 calculates the rest after the ID was divided by 43, then you check if that rest is equal to 1.
44 divided by 43 has a rest of 1, or 87 divided by 43 has a rest of 1 - so your formula gives true for enemy ID 44 and 87 (and 130 and so on)
If you want a formula to result in true ONLY with ID=43. then you have to write it as
b.id == 43 -
Hi Andar,
Thanks a lot for helping me with this. I tried using
<hit formula>
b.id % 42 == 1
</hit formula>
and
<hit formula>
b.id == 43
</hit formula>
but the skill in question is still missing the target. Maybe there might be a script order placement problem as I am using this script in conjunction with GubiD's tactical battle system? I think I've seen this script used successfully with GTBS before. Regardless, I think that Victor's script is still working as the miss attributes have successfully been applied to the skill in question. In other words, the skill is now missing ALL enemies and also not hitting enemy ID 043. It's not a question of me misplacing the formula in the notebox because it seems like misses have already been applied. Maybe it's just the way I'm writing my formula?
I have posted a download link to the game I'm working on (approx 20mb). I was wondering if you or someone else would be able to quickly test the battle and help me identify the problem. Basically, start a new game and you will be taken to the Battle Test Map. Talk to event 012 on that map to begin the test battle.
My objective is to make the "Talk" skill (skill 134) hit "Falwell" (enemy 043) and miss all other enemies except those enemies with enemy IDs that are multiples of 42 +1. The "Talk" skill is a universal skill that I want to be able to capture enemy characters under certain storyline situations and miss all other enemy characters, which is why I'm using this script. If done correctly, this skill should hit "Falwell," thus capturing "Falwell," but miss the generic soldier enemy in the test battle. The word "Capture" in the Talk skill's notebox is GTBS related and shouldn't interfere with Victor's script (I hope).
Link to the download (.zip):
https://dl.dropboxusercontent.com/u/39234871/Miasma.zip
Thank you so, so much in advance for this, and please let me know where the problem is/where I might be going wrong.
Thanks again,
Lifestorm