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,830
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

This could probably be an entire thread, but it’s really interesting how replaying a game several years later can change how you relate to a character. I think Tidus from FFX got such a bad rap. I getchu. Completely different reaction as an adult now.
As you see, I still enjoy writing tutorials. Is there anything specific you want to see? (I know mapping and editing/resource making is usually popular, but those are very broad topics)
Well, I wanted to expand player battlers visually and now have 3 sheets and counting for each of my players party.
1. Regular sheet
2. The character has turned stone sheet.
3. Using potions sheet.

Technically the main hero has 4 since he starts with a wooden sword, and I felt that the battler should reflect that until he gets a metal one.

Right back to the RM game dev grind in about 15 minutes. :LZSexcite:
Days ago I gave someone the sage advice not to steer away from your main project or take up another one to abandon the first. After figuring a way that would save me years of development, I am forced to redo a lot of stuff on my own turf, near to remake half of what I have already made.
Somewhere down the line I must have crossed paths with bad karma.
:kaomad2:

Forum statistics

Threads
131,733
Messages
1,222,756
Members
173,484
Latest member
sewamobilbali
Top