Status
Not open for further replies.

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
Alright, here's the gyst: I want my characters to be able to continue acting when they're dead. If all members are dead, that's when the battle is lost.

It seems state one is heavily hard coded to be a death state. Is there any way to play around that? Either to allow acting through death (which the editor seems to give us a fake choice of) or to make another state be applied on death instead. I've got the other state ready, but countering the hardcode of always applying state 1 when reaching 0 HP is quite a chore. Appreciate the help!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,763
Reaction score
8,970
First Language
German
Primarily Uses
RMMV
wrong way to go at it.

what is hardcoded is the fact that state #1 is applied whenever HP reaches zero, and that the battle ends if all actors have state#1

The effects of the state are NOT hardcoded - that is why the state is in the database after all, so that you can change its effects.

so the solution for you is extremely easy - just remove the restriction you don't want at death. It should work for actors, but not for enemies as they are handled slightly differently
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,344
Reaction score
1,838
First Language
Portuguese - Br
Primarily Uses
RMMZ
*** EDIT: @Andar solution will work best!
Hi there!

You could change the death state id. the problem is that a lot of things depend on him.

JavaScript:
Game_BattlerBase.prototype.deathStateId = function() {
    return 1;
};

Game_Battler.prototype.refresh = function() {
    Game_BattlerBase.prototype.refresh.call(this);
    if (this.hp === 0) {
        this.addState(this.deathStateId());
    } else {
        this.removeState(this.deathStateId());
    }
};

Every time your actors get HP = 0, it will apply the death state id, whatever the id it is.

I believe a solution that can safely and quickly put you out of trouble, regarding compatibility issues or strange behaviors in battle, is to not let the actor's hp go to 0.
Let them always stay 1 and you can apply a semi-death state on them.

Then check if everyone is with 1 HP and with the semi-death state.

If yes, then you can kill everyone(or just set their HP to 0) that the battle will finish.
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
wrong way to go at it.

what is hardcoded is the fact that state #1 is applied whenever HP reaches zero, and that the battle ends if all actors have state#1

The effects of the state are NOT hardcoded - that is why the state is in the database after all, so that you can change its effects.

so the solution for you is extremely easy - just remove the restriction you don't want at death. It should work for actors, but not for enemies as they are handled slightly differently

No, I'm afraid changing the restriction in the database to "None" instead of "Cannot Move" does not work. I wish it was this easy, but it isn't.

*** EDIT: @Andar solution will work best!
Hi there!

You could change the death state id. the problem is that a lot of things depend on him.

JavaScript:
Game_BattlerBase.prototype.deathStateId = function() {
    return 1;
};

Game_Battler.prototype.refresh = function() {
    Game_BattlerBase.prototype.refresh.call(this);
    if (this.hp === 0) {
        this.addState(this.deathStateId());
    } else {
        this.removeState(this.deathStateId());
    }
};

Every time your actors get HP = 0, it will apply the death state id, whatever the id it is.

I believe a solution that can safely and quickly put you out of trouble, regarding compatibility issues or strange behaviors in battle, is to not let the actor's hp go to 0.
Let them always stay 1 and you can apply a semi-death state on them.

Then check if everyone is with 1 HP and with the semi-death state.

If yes, then you can kill everyone(or just set their HP to 0) that the battle will finish.

This is the easy answer, and there's workarounds to be found, but that's not what I want. I genuinely need something that makes it so that the actors (and enemies) can still act even if they are knockout, only getting fully knocked out when the battle ends.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,763
Reaction score
8,970
First Language
German
Primarily Uses
RMMV
Then you need a different approach, preferably done with base troop events to spare you the work of having to add the required troop events everywhere.

you'll need an immortal state (immunity to death state but no other effect and no message or time-limit) and two variables.
On turn zero, apply the immortal state to everyone and set the variables to zero

for each enemy and each actor you'll need a troop event to trigger on HP=0. this troop event should count up death in the variable for the correct side, then check if the numbe of death is identical to the entire side of the battle.
If yes, remove the immortal state and let the engine handle death and battleend as normal.
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
Then you need a different approach, preferably done with base troop events to spare you the work of having to add the required troop events everywhere.

you'll need an immortal state (immunity to death state but no other effect and no message or time-limit) and two variables.
On turn zero, apply the immortal state to everyone and set the variables to zero

for each enemy and each actor you'll need a troop event to trigger on HP=0. this troop event should count up death in the variable for the correct side, then check if the numbe of death is identical to the entire side of the battle.
If yes, remove the immortal state and let the engine handle death and battleend as normal.

I've messed around more with the system, and you were right about the restriction; the problem is that Yanfly's ATB plugin seems to not cooperate with that restriction at all, nullifying the ATB gain fully when any death state is applied. When I returned to DTB, actors are still able to act.

I'll likely use what you just suggested, Yanfly's BuffStateCore and PassiveState should help, without the need for base troop events. A simple invisible immortal state and another one to handle whenever this happens.

My only concern, now, is the 1 HP and 0 HP thing. Using your method, I'm assuming that HP will just be stuck at 1 HP, but correct me if I'm wrong. HP kinda matters in what I'm trying to do, and 0 HP is something I want. Is there any way to change that, or affect this at all?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,763
Reaction score
8,970
First Language
German
Primarily Uses
RMMV
I'm assuming that HP will just be stuck at 1 HP,
no, it should go to 0 and the troop events should be set to trigger at HP=0
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
no, it should go to 0 and the troop events should be set to trigger at HP=0
Great!

Tested it out, works fine. Thanks to all who participated in this thread; your help was appreciated.

The thread can be closed.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,186
Reaction score
5,995
First Language
Dutch
Primarily Uses
RMXP

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

I'm sitting here, programming, when suddenly, in the distance, I hear a deep booming shout, "Dovahkiin". In an instant, my mind and body is pulling me away, my fingers twitch and notepad++, almost by itself, turns off. The Steam starts to rise and a big green play button appers and I am teleported to Skyrim, because, I am, the Dragonborn! 200 hours played last three weeks, omg o_O
Shora Lighting Plugin version 1.5 are out! Wanna add more features to it, but just fixing the bugs is already a pain :kaocry: .

スクリーンショット 2022-01-19 002122.png
I wonder how one goes about picking a good font for a game. I find the default kinda lacking, but you gotta pick a font that's legible ya know.
Did you check out the new Restaff yet? ;3
I am proud of how much my friends are pure talent. This one is making my game possibilities bigger and bigger and I wanna share his word:

Forum statistics

Threads
118,480
Messages
1,116,263
Members
155,464
Latest member
Yokrito
Top