[VXA] Death Timer

Hi,

I'm looking for a snippet that creates a "death timer" of sorts.

In my game, when the death state is applied to the player, it (currently) has a three turn duration. When that timer runs out, the state is removed like any other state, and the player character is revived with half their HP.

I've got that part working, but what I want to do is add an additional turn every time that same player character dies. The way I wanted it to work was the first time the player dies the timer is 2 turns. Then if that same player character dies again, the timer is increased to 3 turns.

This continues until the battle ends, where obviously in the next battle the timer is reset for all player characters.


My only request is to have it compatible with yanfly's scripts.

Please let me know if anyone can help with this!
Couldn't you make this just with multiple states?? Death countdown 1, 2,3, etc??
Couldn't you make this just with multiple states?? Death countdown 1, 2,3, etc??
I've tried this with other states, but I've run into issues with the death state because its automatically applied.

Regardless, I've figured this out with some careful scripting.

This can be closed.

If someone wants to recreate this Here's the codes you can use.

You will need two things.

You need to create a new attr_accessor in $Game_actors called death_count and death_count_max. If you don't know how to do this, you can create a variable for each of these and use it that way.

Basically, I have a code that runs at the end of each turn that checks if the actor is dead. Before the match, i set the death counter max to 2.

If the actor is dead, death_counter is increased by 1. Then I have a check to make sure when death counter is equal to death_Counter_max, to remove the death state on that character.

When the death state is remove, death_counter_max is increased by 1, and the death_counter is reduced back to 0.

Here's the code:

Ruby:
$game_actors[1].death_counter += 1
if $game_actors[1].death_counter == $game_actors[1].death_counter_max
$game_actors[1].remove_state(23)
      dmg = $game_actors[1].mhp * 0.50
      dmg = dmg.to_i
      
      $game_actors[1].hp = [$game_actors[1].hp + dmg, 1].max
      SceneManager.scene.wait(30)
$game_actors[1].death_counter_max += 1 unless $game_actors[1].death_counter_max == 6
$game_actors[1].death_counter = 0
end

1679503634909.png
A little bit of searching and I came across the post I remember seeing before.
It was to replicate the Doom effect in Final Fantasy.
It uses Yanfly's Lunatic States script and the Punishment addon.
Ruby:
#----------------------------------------------------------------------
# Punish Effect: Doom
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set your doom state to end after x amount of turns and
# after the turns have run out the inflicted will die.
#
# Recommended notetag:
#   <leave effect>
#   doom
#   </leave effect>
# or
# Recommended notetag:
# <leave effect: doom>
#----------------------------------------------------------------------
when /DOOM/i
return if dead?
# Change the number to the id of any revive animation you wish to play,
# or to "nil" if you do not wish for any animation to play
@animation_id = 56
remove_state(state.id)
add_state(1)
perform_collapse_effect
That actually does the opposite of what I want 😉, I want the timer to tick down and revive a dead player 🙂.

No worries though, I figured it out.

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.

Original thread: https://forums.rpgmakerweb.com/threads/vxa-death-timer.156028/