Status
Not open for further replies.

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
362
Reaction score
102
First Language
Enlish
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!
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,938
Reaction score
503
First Language
April Fools
Primarily Uses
N/A
Couldn't you make this just with multiple states?? Death countdown 1, 2,3, etc??
 

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
362
Reaction score
102
First Language
Enlish
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
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,834
Reaction score
1,373
First Language
English
Primarily Uses
RMVXA
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
 

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
362
Reaction score
102
First Language
Enlish
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.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
4,242
Reaction score
5,114
First Language
EN, FR
Primarily Uses
RMMZ

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.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Still working on balance issues for my almost-out Cube Trail demo... Boss balance is no joke.
Did i create a damage calculation for consecutive skill use per actor that I may not even use? Yes. Do I have regrets spending so long on it? Also yes.
YES!!! After hours of work I finally managed to find the perfect balance in combat.
Ok. I am seriously going to make efforts to stop double-posting because I got suspended for two days because of doing it too much. Lmao; am I the only one who got a suspension for this? Probably not, but I'd still like to know LOL.
I always hated when the an NPC disappears for the night they just blink out. Finally got around to making a fade out/in for any NPCs that leave/comeback for the night or day.

Forum statistics

Threads
131,777
Messages
1,223,279
Members
173,552
Latest member
Coraz0n
Top