New account registration is temporarily disabled.

[REQUEST] NEED HELP, PLEASE? [CLOSED]

Posts

Pages: 1
I need help to make a state to automattically activate if an actors HP is less than 30% of their max HP.
I tried making a script for it that said
if Actor @hp <30% add_new_state
but since I have absolutely NO IDEA how to make scripts it obviously never worked, so now Im here after trying for about an hour, so if any scripter can help, I would appreciate it very much.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
XP, VX, or VX Ace?

Doing this with battle events is probably easier
author=LockeZ
XP, VX, or VX Ace?

Doing this with battle events is probably easier

VX Ace, sorry, and since Ace makes troops for you, I dont want to be making lotsa troops if I don't need to, I just need to know some scripting basically
Marrend
Guardian of the Description Thread
21806
Seems to me there should be some check somewhere. Like "if self.hp < self.maxhp * .3". Or something like that. I'm not exactly sure where this code would go, however.
author=Marrend
Seems to me there should be some check somewhere. Like "if self.hp < self.maxhp * .3". Or something like that. I'm not exactly sure where this code would go, however.

It never worked :(
The quick and dirty version is something like this:
class Game_Battler # (change this to Game_Actor < Game_Battler if this applied to the player only)

  alias hp_old hp= unless $@
  def hp=(value)
    # Calculate the threshold that adds/removes the state
    threshold = param_max(0) * 0.3
    # When the player moved below the threshold add the state
    add_state(##) if (@hp > threshold and value <= threshold)
    # When the player moves outside the threshold remove the state
    remove_state(##) if (@hp <= threshold and value > threshold)
    # Call the original method to apply the HP change
    hp_old(value)
  end
end

With ## being the state ID you wish to apply/remove. Untested, it's really late and I'm running on a piece of beef pie I ate six hours ago
author=GreatRedSpirit
The quick and dirty version is something like this:
class Game_Battler # (change this to Game_Actor < Game_Battler if this applied to the player only)

  alias hp_old hp= unless $@
  def hp=(value)
    # Calculate the threshold that adds/removes the state
    threshold = param_max(0) * 0.3
    # When the player moved below the threshold add the state
    add_state(##) if (@hp > threshold and value <= threshold)
    # When the player moves outside the threshold remove the state
    remove_state(##) if (@hp <= threshold and value > threshold)
    # Call the original method to apply the HP change
    hp_old(value)
  end
end
With ## being the state ID you wish to apply/remove. Untested, it's really late and I'm running on a piece of beef pie I ate six hours ago
It looks a tad confusing but I kinda understand what to do, since Ive used a script where I just need to add numbers etc before
Thanks for trying even if it doesnt work :D

Edit: I changed the script to suit my needs and did it someting like this:
class Game_Battler # (change this to Game_Actor < Game_Battler if this applied to the player only)

alias hp_old hp= unless $@
def hp=(value)
# Calculate the threshold that adds/removes the state
threshold = param_max(100) * 0.3
# When the player moved below the threshold add the state
add_state(02) if (@hp > threshold and value <= threshold)
# When the player moves outside the threshold remove the state
remove_state(02) if (@hp <= threshold and value > threshold)
# Call the original method to apply the HP change
hp_old(value)
end
end

The line that says threshold = param_max(100) * 0.3 means at 30%, right??
And the: remove_state(02) if (@hp <= threshold and value > threshold) only needs the state number? Thats what I done

Anyway, Im off to test it now

Edit: I think I need to do more to the script to make it work

Yet another edit: I made the state numbers 3 digits (002) but still it never worked. What I basically want is a HP critical state and after the battle any characters in the HP Critical state say something like "Oh no Im bleeding pretty bad"
Marrend
Guardian of the Description Thread
21806
author=Animetor
Yet another edit: I made the state numbers 3 digits (002) but still it never worked. What I basically want is a HP critical state and after the battle any characters in the HP Critical state say something like "Oh no Im bleeding pretty bad"

If all you want is for characters to say something if they are at critical health, that's something totally different. I'd say it depends on what kind of scripts and/or events you're using, and if your encounters are on-touch encounters. If you're using the default engine, and touch encounters, you could compare HP versus MAXHP after the Battle Processing event. Then, have the character do the line about hurting under the appropriate condition. If there's code in place where characters have end-of-battle quotes, you'd tack on a "critical health" case.

It might take some work with variables, and conditional branches, and lots and lots of playtesting, but it should be possible!
author=Marrend
author=Animetor
Yet another edit: I made the state numbers 3 digits (002) but still it never worked. What I basically want is a HP critical state and after the battle any characters in the HP Critical state say something like "Oh no Im bleeding pretty bad"
If all you want is for characters to say something if they are at critical health, that's something totally different. I'd say it depends on what kind of scripts and/or events you're using, and if your encounters are on-touch encounters. If you're using the default engine, and touch encounters, you could compare HP versus MAXHP after the Battle Processing event. Then, have the character do the line about hurting under the appropriate condition. If there's code in place where characters have end-of-battle quotes, you'd tack on a "critical health" case.

It might take some work with variables, and conditional branches, and lots and lots of playtesting, but it should be possible!


My original method of work was on touch encounters with in-battle events that had the character say they were in critical HP (like the screenshot for crests of hope) so I guess the easiest way would just to continue doing it that way, thanks though GreatRedSpirit, and thanks Marrend for letting me say this thread is closed
Pages: 1