RGSS Formula Variables
A formula is just a ruby statement. Any valid ruby statement can be used in this case, including conditional branches, other method calls, and so on. For example, you can provide a damage formula for your items or skills such as
a.atk * 4 - b.def * 2
Where `a` is the user of the skill, and `b` is the target. Notice that you can access the attributes of the appropriate objects. Similarly, `v` is the game variables. I extend this idea with my own set of letters that usually mean certain things, and try to be consistent across all of my scripts. The following is a list of formula variables that I use. Not every script that involves formulas will support every variable, but if it is documented, then it is supported.
a - user of some action b - target of some action c - the action (from the user's side) p - game party r - the result of the action (from the target's side) t - game troop v - game variables (an as array) s - game switches (an an array)
Note that this is just my standard, and the damage formula only supports `a`, `b`, and `v`.
In case there are any confused people trying to use this without knowing… (like me)… the v and s should be used v[3] and s[3] where 3 is the number of the switch/variable used.
Example: http://www.roguedeus.com/Stuff/dgr_troopSurprise_issue_6.PNG
Images don’t work… Ok. Nevermind.