Post new topic    
Metal Slime
Send private message
Question about stat thresholds changing hero graphics 
 PostMon Nov 18, 2013 9:05 am
Send private message Reply with quote
Hey, another feature I'd like to implement into the game I'm planning would involve stats that are above or below a certain threshold causing a hero's graphics to change (e.g. A soldier hero would get a more buff/ripped walkabout and battle sprite above a certain Strength threshold)

I think this could be done with an if or while condition, get stat, and some other things, but I'm REALLY rusty on plotscripting, even after doing the plotscripting tutorial. Does anyone know a good way to get something like that working?
Metal King Slime
Send private message
 
 PostMon Nov 18, 2013 3:53 pm
Send private message Reply with quote
A hero's stats may change either because they levelled after a battle, because the player changed equipment or used an item, or because of scripts. So you should ideally handle all of those cases, either by triggering a script after-battle and after menus, or if you don't have any other scripts running you can use an infinite loop (set it as the new-game and load-game script):

Code:
plotscript, continual stat checker, begin
  while (true) do (
    stat checker   # below
    wait (1)
  )
end


or you can be lazy and set the "stat checker" as an each-step script (causing a delay before activating though).

The stat checker script itself would look something like:

Code:
plotscript, stat checker, begin
  variable (hero)
  hero := find hero (hero:Soldier)
  # if the hero is in the party
  if (hero > -1) then (
    # change this threshold
    if (get hero stat (hero, state:strength, maximum stat) > 10)  then (
      # buffed version
      set hero picture (hero, 10, outside battle)   #walkabout set id
      set hero picture (hero,  4, inside battle)   #hero sprite set id
   ) else (
      # unbuffed version
      set hero picture (hero, 9, outside battle)   #walkabout set id
      set hero picture (hero,  3, inside battle)   #hero sprite set id
   )
  )
end


Assuming you have default palettes correctly set, so the palettes can remain set to "default".
Slime Knight
Send private message
 
 PostMon Nov 18, 2013 3:59 pm
Send private message Reply with quote
EDIT: pretty certain TMC wrote it a bit more eloquently than i did - i'd follow his post.

it would be something like this i think:

Code:
plotscript, checkstat, begin
  variable (reqstat)
  reqstat:= get hero stat (who,stat,type; leave blank for current)

    if (reqstat >= 100) then (set hero picture (who,picture,type)) #this checks what the hero's current called stat is - if above 100 his picture will change. this number can be changed to whatever you like.
end
 


the else is optional. unless you have in-game items that effect stats, you'll want to run this as an after-battle script which is defined in each map's general data.

for get hero stat, the stat option can be a number - i believe they correspond like so:

0,stat:HP
1,stat:MP
2,stat:Atk
3,stat:Aim
4,stat:Def
5,stat:Dog
6,stat:Mag
7,stat:Wil
8,stat:Spd
9,stat:Ctr
10,stat:MP~
11,stat:Hits

i pulled this from a script of my own that i know, the last time i checked, worked - so, good luck.
Blubber Bloat
Send private message
Re: Question about stat thresholds changing hero graphics 
 PostMon Nov 18, 2013 4:14 pm
Send private message Reply with quote
Foxley wrote:
Hey, another feature I'd like to implement into the game I'm planning would involve stats that are above or below a certain threshold causing a hero's graphics to change (e.g. A soldier hero would get a more buff/ripped walkabout and battle sprite above a certain Strength threshold)


This would be cool to see.
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Metal King Slime
Send private message
 
 PostTue Nov 19, 2013 5:15 am
Send private message Reply with quote
Also, if you don't want equipment changes with strength bonuses to affect the appearance of the hero, you could check "base stat" instead of "maximum stat" in the "get hero stat" command. The base stat is the value of the stat before equipment bonuses are added.
Metal Slime
Send private message
 
 PostTue Nov 19, 2013 1:44 pm
Send private message Reply with quote
I'd like a way to get the custom-calculated version of a stat, as defined in the hero editor, too. Especially if we have heavy use of scripted stat bonuses. As far as I can tell, the base stat includes these increases.
Metal King Slime
Send private message
 
 PostTue Nov 19, 2013 3:46 pm
Send private message Reply with quote
it's possible to get that by adding a new hero, setting its level, and then deleting it, which could be encapsulated in a script, but that's not a reason not to add a built in command.

Changes with a script to either the max or base value of a stat modifies the other one as well. The difference ebtween the two is the equip bonuses, unless a stat cap is hit.
Metal Slime
Send private message
 
 PostTue Nov 19, 2013 10:23 pm
Send private message Reply with quote
I understood that, which is why we need this...

But you're right. I actually always forget you can add multiples of a hero. I feel silly for not realizing that before.

Of course, it makes using find hero commands a little dangerous, but not if you're aware of what's happening.
Metal King Slime
Send private message
 
 PostWed Nov 20, 2013 12:21 pm
Send private message Reply with quote
Yeah, many of the hero script commands are not designed with multiple copies of a hero in the party in mind and will break. It's probably not worth the effort to fix since it's a feature almost unused except in FF1 remakes.
Liquid Metal King Slime
Send private message
 
 PostWed Nov 20, 2013 3:32 pm
Send private message Reply with quote
If you need to work with multiple copies of the same hero ID, you can loop through the whole set of hero slots, and check the ID number in each one using the "hero by rank" command
Metal Slime
Send private message
 
 PostThu Nov 21, 2013 4:28 am
Send private message Reply with quote
Sorry, I've been so slammed with work I haven't had a chance to try this. Thanks a bunch TMC and everyone else, I'll give it a shot tonight!

EDIT:
Indeed it does work! Excellent. Thanks for all the help.

EDIT2:
Oh, and specifically--
I set the 'continual stat checker' script to run on new-game and load-game under special plotscripts. Seems to work like a charm.
Display posts from previous: