Heya!
I want to make a Skill that acts in a certain way so that I can't use Force Action to deal its damage. Instead, I calculate the Damage using Variables. This all works perfectly already (using common events).
Now I want to have this Skill have an Element to it. All I am missing is a way to access any given enemy's weakness to a state and save it to a Variable (preferrably as A=200,B=150, etc.). I assume this is easily done using Scripts, but I am not very well-versed in those.
Thanks in advance!
Yeah, you've got the right idea. You want to find a given enemy's element rate.
I still cannot open my copy of RMXP due to weird technical errors, so I can't find the correct syntax for you. But I did something like this recently in VX Ace, where damage dealt to foes through a common event is supposed to be Electricity damage. First I set a variable equal to the user's Magic stat and did some math on it based on the skill's "formula" and a bit of random variance. Then I found the given enemy's Element Rate for Electricity using the following code in a script box (and afterwards, I reduced Enemy #1's HP by Variable 44):
elerate = $game_troop.members[0].element_rate(5)
$game_variables[44] = ($game_variables[44] * elerate).to_i
Again, this won't be the proper syntax for XP, but hopefully it will at least give you an idea of where you might look for it. [0] is the first member of the troop ([1] is the second), and 5 is the element ID for electricity. One difference in syntax that I do remember is that XP calls it $game_troop.enemies rather than $game_troop.members.
Hi there,
You can store a battlers elemental weakness by using
$game_variables[X] = battler.element_rate(Y)
X is the ID of your variable
Y is the ID of your element
battler could be either
$game_actors[Z] for the actor with ID Z in the database
$game_party.actors[N] for the Nth party member (starting at N = 0)
$game_troop.enemies[N] for the Nth enemy in the troop (starting at N = 0)
The result is the elemental affinity of the battler as a percentage, so you probably have to divide the final result by 100. The percentage already includes elemental guard modifiers from states and armors.
the problem is the linebreak before (2)
you need to make it a manual line break after the ( with 2) in the next line, then the engine will understand that the next line is part of the same command
Yup, that was it! Works perfectly now!
Thanks!