 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
gagekilmer Ninja... nuff said
Joined: 09 Jan 2013 Posts: 53
|
Posted: Tue May 21, 2013 8:05 am Post subject: plotscript not working |
|
|
so I am trying to increase my character (kenryku) fire stat. it compiles the script, I have it set to run after a text box, the text box comes up but the stat never increases. Here is my script
plotscript, NinLevelFire, Begin
variable (who)
who := find hero (hero:Kenryoku)
variable (oldstat)
oldstat := get hero stat (hero:kenryoku, stat:Fire, current stat)
set hero stat (hero:kenryoku, stat:Fire, oldstat + 5, current stat)
end
I tried also replacing current stat with maximum and base, and none of these show a change in the stats in the status menu. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue May 21, 2013 10:26 am Post subject: |
|
|
The bug in your script is that you twice wrote "hero:kenryoku" instead of "who".
Also, you should usually use 'base stat' for permanent changes.
Code: | oldstat := get hero stat (who, stat:Fire, base stat)
set hero stat (who, stat:Fire, oldstat + 5, base stat) |
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
gagekilmer Ninja... nuff said
Joined: 09 Jan 2013 Posts: 53
|
Posted: Tue May 21, 2013 10:45 am Post subject: |
|
|
Bob I go my information from there in the first place, before I asked it here. An thanks TMC, for correcting my script but there still hasn't been any changes in its behavior, I also raised the max stat by the same amount before I raised the base and still nothing, it's acting like the script isn't running |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue May 21, 2013 11:06 am Post subject: |
|
|
Oh, my mistake. What I said was wrong, and so is that article (partially). I have been meaning to clean up that article actually.
Unfortunately for historical reasons HP and MP act differently to the other stats, and it's a huge pain. The status menu displays the current value of each stat. You want to modify both the current value and the maximum or base value (max and base are tied together so you should only change one of them).
One correct way to increase a stat is like this:
Code: | script, increase hero stat, who, stat, amount, begin
variable (old base, new max)
# Increase base and maximum values
old base := get hero stat (who, stat, base stat)
set hero stat (who, stat, old base + 5, base stat)
# Update current value
new max := get hero stat (who, stat, maximum stat)
set hero stat (who, stat, new max, current stat)
end |
(Well it's possible to write it in a simpler way as you may have seen elsewhere, but by using base instead of max allows handling stat caps properly) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|