RGSS Formula Variables

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

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`.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

2 Responses

  1. RogueDeus says:

    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

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax