When a particular item is used, it calls a script that should raise Fuel (MP) +10 and Medals (Counter) +1. Below is the script. It almost works, however the Medals stat appears as 0 (wrong) on the Stats screen but as 1 (right) on the Equip screen. The Fuel stat shows correctly on both.
Am I explaining this well? Does anyone have any idea what's going on?
plotscript, medal, begin
variable(who)
who := pick hero
if (who == -1) then (exit script)
variable(oldstat)
oldstat := get hero stat(who, stat:Fuel, maximum stat)
set hero stat(who, stat:Fuel, oldstat + 10, maximum stat)
oldstat := get hero stat(who, stat:Medals, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, maximum stat)
delete item (68, 1)
end
Code:
oldstat := get hero stat(who, stat:Medals, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, current stat)
oldstat := get hero stat(who, stat:Medals, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, current stat)
You should set both the maximum stat and the current stat. If you just set the maximum stat, then the change doesn't really take effect until after the next battle ends.
James Paige wrote:
You should set both the maximum stat and the current stat. If you just set the maximum stat, then the change doesn't really take effect until after the next battle ends.
Code:
oldstat := get hero stat(who, stat:Medals, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, current stat)
oldstat := get hero stat(who, stat:Medals, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, maximum stat)
set hero stat(who, stat:Medals, oldstat + 1, current stat)
You should set both the maximum stat and the current stat. If you just set the maximum stat, then the change doesn't really take effect until after the next battle ends.
As usual, you are the man.



