Damage Subformulas
This script allows you to specify custom damage formulas depending on who the attacker and target are. The default formula allows you to specify A and B, but it doesn’t take into consideration whether they are actors or enemies.
This script provides 4 sub-formulas that will be used depending on who is A and B.
There are four cases to consider
- A is actor, B is enemy
- A is actor, B is actor
- A is enemy, B is actor
- A is enemy, B is enemy
Download
Script: download here
Installation
Place this script below Materials and above Main
Usage
The general format of the note-tag to use is
<damage formula: TYPE> FORMULA </damage formula>
Where TYPE is one of
AA – actor to actor
AE – actor to enemy
EA – enemy to actor
EA – enemy to enemy
And the FORMULA is your usual damage formula.
If a sub-formula is not specified, then it is assumed to be the main formula
that is defined in the damage box built into the database editor.
Hi there.
My weapons formula is:
1+rand(5)
but i get the error:
Script ‘Damage Subformulas’ line 156: ArgumentError occured.
comparison of Fixnum with nil failed.
Tried:
[1+rand(5)].max
and
1+(rand(5))
but still giving me that error.
Ok found something on my side:
The skill “Attack” had a blank formula. But this script should override it when a weapon is tagged right?
What tag should override which formula?
Sorry to bother you Tsuki,i cannot use this damage formula:
<damage formula: AE>
b.add_state(1)
</damage formula>
In normal circumstances it works without your script (using the default skill formulas box)
Your script gave me an error in the line 311:
Comparision of fixnum with nil failed.
Your formula must return a number, even if it does zero damage. It works by default because the default scripts hide errors from you.
Good afternoon Tsuki! 🙂
That is strange… I can see 363 lines in the maker editor (including instructions)
Anyway here is the line:
[Kernel.eval(self.subformula(a, b)), 0].max * sign
Your formula does not return a number. If you don't want it to do any damage you still need to say
Arigato gosaimasta princess Hime! That worked like a charm,i did a spell that adds petrify state to actors and death state to enemies (FF4 has that feature) Excuse me for being so dumb at scripting and greetings from Argentina.
Getting this error:
Script 'Damage Formulas' line 189: Argument Error Occurred
wrong number of arguments (1 for 0)
Did I done goofed?
Ok I see why I wrote things the way I did before…should be fixed now.
Now when I use something that doesn't have a damage formula notetag, it gives me a 0 for 1 arguement error on line 126,
load_notetag_damage_subformulas
for
def ae_subformula
return @ae_subformula unless @ae_subformula.nil?
load_notetag_damage_subformulas
return @ae_subformula
end
It's strange that it never happened before. Seems like something extra got added somehow. Should be addressed now.
I did whatever wrong, but it works now. Perhaps I wanted one skill that works the same way regardless who's using it, but I still wanted the ability to bypass the 100 character limit with that move.
I wasn't sure how to edit the script on my own to do so (although I'm sure it's way easy lol I need to learn code)
like I was going to have a formula called NA or whatever where it's just anything goes, so that if a skill doesn't have different effects depending on the target and user, I wouldn't have to copy and edit the formula 4 times for one skill.
I've updated the script so that if you don't specify a type, then it applies to all types.
Wow, thank you 🙂
May I have an example of the correct way to use this?
On a fresh project I tried
(bracket)damage formula: AE(bracket)
40
(bracket)/damage formula(bracket)
and
(bracket)damage formula: AE(without the bracket here)
FORMULA + 40
(bracket)/damage formula(bracket)
and
(bracket)damage formula: AE(without the bracket here)
'40'
(bracket)/damage formula(bracket)
and whatnot but the damage was never 40 nor did include 40. It was the just 27 like I specified in the skill's damage box.
I was trying to see if I could get this script for use as a way to bypass the 100 character limit, and also for the use it has.
You can type <notes> properly in comments now.
If you write
You should get 40 damage when an actor attacks the enemy.
FORMULA doesn't mean anything.