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
counter stat scripting
Moderators: Bob the Hamster, marionline, SDHawk
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
- Bob the Hamster
- Liquid Metal King Slime
- Posts: 7460
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
Re: counter stat scripting
Code: Select all
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)
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
Re: counter stat scripting
As usual, you are the man.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: Select all
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)