Can you modify a hero's stats, enemy's stats, money, etc. by a percentage rather than by a whole number with plotscripting?

From OHRRPGCE-Wiki
Jump to: navigation, search

Of course. With plotscripting you can do any math you want, and modifying a value by a percentage is just math.

The formula to find A% of the number B is

 B / 100 * A

Here is an example that sets a her's HP to 10% of its maximum

  variable(who)
  who := find hero(hero:Bob)
  variable(max)
  max := get hero stat(who, stat:HP, maximum stat)
  variable(new HP)
  new HP := max / 100 * 10
  set hero stat(who, stat:hp, new HP, current stat)