Status
Not open for further replies.

Lonewulf123

Regular
Regular
Joined
Oct 13, 2014
Messages
367
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!
Regular
Joined
Mar 18, 2012
Messages
3,968
Reaction score
530
First Language
April Fools
Primarily Uses
RMVXA
Couldn't you make this just with multiple states?? Death countdown 1, 2,3, etc??
 

Lonewulf123

Regular
Regular
Joined
Oct 13, 2014
Messages
367
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
Regular
Joined
May 22, 2016
Messages
5,235
Reaction score
1,565
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

Regular
Regular
Joined
Oct 13, 2014
Messages
367
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,259
Reaction score
5,152
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

Everybody: "Hey, weren't you supposed to be making a game"?

Me. "MUST MAKE MOAR CUTSCENES!!1"
I've been watching videos about the videogame streamer Open Hand charity scandal, and the rabbit hole keeps getting deeper. At first it was just a lot of donated money being grossly neglected for years, and now there's a lot of money unaccounted for, which could turn this into a legitimate IRS crackdown.
Let's have some fun with my advent calendar. What would you like to see for Day 3: land, sea, or air? :rheh:
I've been thinking about doing a jokey submission for the Christmas jam in which, like a cartoon special where all the characters "play" a counterpart in A Christmas Carol, my MagiCats would each play a role from the C.A. Smith story The Coming of the White Worm, with Cyprian as Evagh, Rousalie as Dooni and so forth. But in the end, I figure all my development efforts should go toward the game proper.
In twitter, square phoenix had successfully prompted chatgpt to make the mini game watermelon pangpang.

Forum statistics

Threads
136,703
Messages
1,268,947
Members
180,419
Latest member
riruru
Top