KEndure XP

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
KEndure XP + VX + ACE
Updated

by Kyonides Arkanthes


Introduction

I introduce you to...:aswt: Nope, it's not Aluxes, it's a new script indeed!

It was inspired by a fellow RM user's request by the way... It's just some sort of endurance or sturdy + anti-sturdy set of states! :confused:

This means you might let a hero get the ability to resist hits and keep either 1 HP or some specific percent instead!
Sadly, its counterpart also exists...
It should let your hero with 1 HP (or any other value you've picked) meaning not even healing spells and items can cure him.

You can either copy and paste the code in your script editor or use the demo as a base to develop and test your game.

The Script

Code:
# * KEndure XP + VX + ACE
#   Scripter : Kyonides Arkanthes
#   2020-08-01

# This scriptlet allows you to set Endure like states in your games!
# If your hero reaches a point where his HP go below n points or percent, it
# will not let it happen, keeping him alive!
# Of course, if the state has a set number of turns before it vanishes, he may
# inevitably die the turn after it wears off...
# Healing might also remove the state except if it is the Cursed Endure state...

# Warnings!

#  These states will not reduce a hero's MAXHP as the DB does.
#  All these states are exclusive by nature! They will not allow another endure
#  like state to replace them.

module KEndure
  # The Pop up Message should be either 0 or "" or "Miss" or "Failed", etc.
  DAMAGE_POPUP_MESSAGE = ""
  # Remove Endure after being healed?
  HEALING_REMOVES_ENDURE = true
  # List of Endure States - Set any of them to 0 if you won't use it
  HP_ID = 17
  PERCENT_ID = 18
  CURSED_ID = 19 # Actor cannot get healed
  # StateID => Integer - it'd be either plain HP or a percent or HP + No Heal
  STATES = { HP_ID => 1, PERCENT_ID => 25, CURSED_ID => 1 }
  STATE_IDS = [HP_ID, PERCENT_ID, CURSED_ID] # Do Not Edit This Line!
end

class Game_Battler
  alias :kyon_endure_gm_battler_hp :hp=
  def hp=(nhp)
    if (@states & KEndure::STATE_IDS).any?
      @damage = KEndure::DAMAGE_POPUP_MESSAGE
      return @hp if state?(KEndure::CURSED_ID) or nhp < @hp
      if KEndure::HEALING_REMOVES_ENDURE
        remove_state(KEndure::HP_ID, true)
        remove_state(KEndure::PERCENT_ID, true)
      end
    end
    kyon_endure_gm_battler_hp(nhp)
  end

  alias :kyon_endure_gm_battler_as :add_state
  def add_state(state_id, force=false)
    if !@states.include?(state_id) and KEndure::STATE_IDS.include?(state_id)
      return if (@states & KEndure::STATE_IDS).any?
      n = KEndure::STATES[state_id]
      n *= maxhp / 100 if state_id == KEndure::PERCENT_ID
      self.hp = n if n > 0
    end
    kyon_endure_gm_battler_as(state_id, force)
  end
end
Download the DEMO


Terms & Conditions

Free for use in non commercial projects. Contact me if you need it for commercial games. Don't worry, I know it's a scriptlet.
Include my nickname or real name or both and the URL where you found this scripts.
You're not free to repost it anywhere else!
 
Last edited:

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
uhhh how does this script work exactly? and how to use it?
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
Where it says...
# Type Options: nil - plain HP, true - HP percent, :curse - cannot heal!
# ID => [Integer, Type]
STATE = { 19 => [1, nil], 20 => [25, true], 21 => [1, :curse] }

It is telling you how exactly you're expected to configure it.

STATE is a constant that keeps a hash in memory as long as your game exists.
Its keys are the State ID's themselves.
key => Array
The array should contain 2 items, a number that represents either mere HP or some HP percent. How do you know that? Well, you set the second item or value to nil if you prefer to keep the hero with 1 HP only as in the first example. It might be true if you wanna treat that number as a percent or set it to :curse to treat it as HP but add a nuance like being cursed, thus blocking any attempt to heal that actor.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
and does it wore off when it activated about once per battle?
i don't want my ally to constantly endure mulitple attacks for the whole battle.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
You configure that in the states database as usual. Just pick a maximum number of turns.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
OK, is the any other script that alters Game_Actor as well?
For the meanwhile I'll try to reproduce the error in a blank project.

Nah, I just forgot to take into account add_state's second argument.

Where it says in my script...

Code:
def add_state(sid)
    return if (KEndure::STATE_IDS & [sid]).any?
    kyon_endure_gm_battler_as(sid)
  end
...modify it like this:

Code:
def add_state(sid, force=false)
    return if (KEndure::STATE_IDS & [sid]).any?
    kyon_endure_gm_battler_as(sid, force)
  end
That's all!
 
Last edited:

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
OK, problem #2
my ally is constantly enduring multiple attacks while being at full HP
1596161057061.png
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
First of all show me your current configuration. Otherwise it will be hard to determine if it's my script or its your current setup the one causing the issue.
Also include a screenshot of your state database showing me how you defined the endure state there.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
here is my current config (i think?)
1596169547892.png

and here is my state database
1596169605526.png
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
Well, the script configuration seems OK to me.

Err... why did you set it to "Regard as 0 HP"? That has nothing to do with KEndure at all...
Fainted works by default, no script is needed to let it run smoothly. Endure is supposed to mimic that for a LIVING actor but never a "deceased" one like Faint and Knockout do.

Can't Get XP... err, that's not necessary for the actor is ALIVE so he should get EXP.

0 Turns? That doesn't seem to be a good way to let it last 1 or more turns...
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
UMMM... whoops...
you're looking at the usual knockout state.
1596178157839.png
here is the ACTUAL Endure state.
(you were looking at State #1, not State #36.)
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
Thanks. I have updated the script again and even uploaded a demo!
I know it's working as intended now. Plus it also include a new feature.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
ummm...
my ally is STILL constantly enduring multiple fatal attacks while being at full HP...
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
Your ally? Not the party leader? o_O? That's weird indeed. The script asks for a specific state and states are assigned to a very specific hero at a time.
Were you using my demo only? Or did you add more scripts to it?
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
well... 1. (my) Litten IS the leader. (guess i should've made it MORE specific...)
and 2. i tested your demo and it has same problem.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
The Demo Has Been Updated!

After altering the demo a little bit I noticed a few things.
The Basic Endure and Cursed Endure states worked pretty much fine but Endure 2 didn't. I mean, Endure+ didn't work.
I had to fix that and keep testing my demo under slightly different circumstances. Now the third kind of Endure state works as well!
Yeah, I know it was about time it did.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
uhhhhhh dude.
i tested your updated demo,
and actors are STILL getting constantly enduring multiple fatal attacks...
the Endure state is supposed to endure from a fatal attack ONCE.
and when the actor has endured that fatal attack, the endure state wores off.
and it can be activated again for every battle.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
Nsh, I can't be. I tested it many times under three different scenarios and they can survive fatal attacks but only for n turns. It didn't matter if n was equal to 1 or more turns, it didn't last any extra turn at all. Hey! I let my heroes fall in battle to confirm it works as intended.

Keep in mind that XP's battle system waits till it's a given actor's turn to autoremove old states.
To be honest I'd prefer it to be removed at the point where you can see the Fight or Escape command window...

To anybody:

What it doesn't do is to apply the Endure state automatically as in Pokemon games. Why? Because that works as a passive ability or skill while KEndure is just a state.
 
Last edited:

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
actually... i think in Pokemon, the endure state will only activate
when you're going to die while at full HP.
i was going for a more Persona method, where no matter how much HP you have left,
you'll always survive at 1 HP, and after that the Endure state is removed.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Besides my Might and Magic inspired project, I have always wanted to make a Fire Emblem-like game. Time is the culprit... Between life, composing music packs, and working on a game can it be done!? The tactical plugins for MV work quite well based on what I have tested.
Yaaay! My second public script is out and approved! A VX Ace Final Fantasy IX styled Throw Script!

I look forward to all the constructive feedback I get but most importantly I hope everyone who ends up using it enjoys!

Yaaaay! Making scripts is fun lol. :D
When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.

Forum statistics

Threads
100,525
Messages
976,813
Members
132,080
Latest member
nwr
Top