Hp cannot fall below one

● ARCHIVED · READ-ONLY
Started by Hinorashito 12 posts View original ↗
  1. I have a character in my game with a skill called valor which puts a state on him that makes him resist death and so he cant be killed. How would I make it so that while this state is active no matter what happens his hp absolutely cannot fall below 1? when hes at 0 hp he is still standing and can fight but for various reasons the skill will work without issue if I can make it so that when the state is applied his hp cant go below 1 any ideas how I can accomplish such a feat?
  2. Find this script in Game_BattlerBase:

    def change_hp(value, enable_death) if !enable_death && @hp + value <= 0 self.hp = 1 else self.hp += value end endReplace it with this:

    def change_hp(value, enable_death) if (!enable_death || state?(15)) && @hp + value <= 0 self.hp = 1 else self.hp += value end endbut replace the 15 with whatever id your state is.Then anybody who has that state will have a minimum hp of 1.
  3. ok shaz goddess of the scripts lol let me go check real quick.

    Hmm thats odd it did not work? it still goes to zero i put it where you said and changed the 15 to the in my case state 29
  4. Are you battle testing? Did you save the game first?

    Edit ... okay, some of the scripts change hp directly, rather than calling that method.

    So, change that back to what it was, and find this instead:

    Code:
      def hp=(hp)    @hp = hp    refresh  end
    and change it to this:
    Code:
      def hp=(hp)    @hp = hp    @hp = 1 if hp <= 0 && (!enable_death || state?(29))    refresh  end
  5. Shaz said:
    Are you battle testing? Did you save the game first?
    Yes I have battle tested it 5 time and saved after each time to be extra sure.
  6. see my edited post :)
  7. hmm im still looking is that line of code in the battler base? cause I cant seem to locate it
  8. Yep. Search Game_BattlerBase for def hp=.


    You're adding a new line to the method, not looking for an existing line to change.
  9. okay here is the error code I get 

    line 468 name error occured undefined local variable enable death or something like that.
  10. Ah, silly me. Not my day for scripting, it seems.

    Do this instead:

    Code:
      def hp=(hp)    @hp = hp    @hp = 1 if hp <= 0 && state?(29)    refresh  end
  11. Yay it works perfect no matter how much of a beating my knight takes he just wont die lol thank you shaz your the best.
  12. It took us a while, but we finally got there ;)


    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.