PDA

View Full Version : lua maths



Maspalio
July 23rd, 2016, 17:08
hi,

Is it allowed to do .maths with the current .lua version in FG? If so, i'd like to know how to do this :

I got a Strength value that i can get. I'd like to get (2x Strength) to use the result elsewhere.

Many thanks

Andraax
July 23rd, 2016, 18:42
The name of the strength attribute in the database depends on which ruleset you're using. In Castles and Crusades, for example, you can use the following to calculate that value:

local nTotal = DB.getValue(nodeChar, "abilities.strength.score", 0);
nTotal = nTotal * 2;

Maspalio
July 24th, 2016, 12:57
Thanks, i'll try it.

Trenloe
July 25th, 2016, 04:24
For further info on what you can do with LUA in FG see here: https://www.fantasygrounds.com/modguide/scripting.xcp