[ACE] Referencing a skill's ID/data in the damage formula?

Let's say you have scripts that change around damage or other aspects, such as skill_damage_multiplier[skill_id]

or have custom notetags that define a skill's base damage, such as

<skill_base_damage: 400> How could I reference a skill's data in the damage formula/etc itself,

such as 

$data_skills[skill_id].skill_base_damage * a.atk / b.defor 

value = 70; if @magical? then value *= 0.8 end; value You see, when your formulas start getting really long and complex and you're using custom notetag formula scripts for damage and custom ailments/effects, you start getting a really long comment box that's slow to navigate through.

That's why I'd like to be able to define all of the specifics of a skill via notetags at the top of the comment box, so I don't have to modify the formula for each skill. But, I can't seem to figure out how to reference a skill's data outside of the script editor.

I tried things like

@id

self.id

self.magical?

and it all returns errors
There are scripts out there which allow you to write your damage formulas in a more organized matter, in the script editor itself, rather than using those small boxes for it in the database.


You should get one of those and write your formulas that way, much more simpler than cluttering those small boxes (even the note-tag box of the items/skills is too tiny), you can format your formulas the way you want (not just on one line) and you can view your whole formula easily without having to scroll miles in the formula box.
What you have to remember is that the eval statement being executed in a damage formula is being carried out within an instance of Game_Battler, and the value being returned is being assigned to that battler's Game_ActionResult property's damage/healing value. So if you want to refer to an aspect of the skill being used, you'd have to use something like a.current_action.

For example, to refer to the damage: a.current_action.skill_base_damage

Haven't been able to test this as I'm not using whatever script you're using to define base damage, but as far as I'm aware this should work.
'a.current_action' refers to the Game_Action class itself.


'a.current_action.item' will get you the currently used item/skill (the whole class, not just it's ID).

Original thread: https://forums.rpgmakerweb.com/threads/ace-referencing-a-skills-id-data-in-the-damage-formula.42971/