force death state with petrified and other

Hey, I know the plugin made by tsukihime, it's not commercial unless I contact the author etc.
I could do that but I'm more interested in making by myself with events if can.
here's an example of my work, it works perfectly outside of battle but for some reason does not work when in-battle.
someone know how to do?

Capture.JPG
Did you placed it in Troop event?
https://prnt.sc/q8g20f
no, common event.
edit I tried troop but nothing.
no, common event.
edit I tried buy nothing.
what did you try?

in battle, common events are NOT automatically active, because there are no parallel processes or autoruns on battlescreen.
troop events and troop events calling common events needs to be triggered, and a lot of people new to them use the wrong conditions or the wrong span for their troop events.
please give a screenshot of the full troop event (in your other topics you also tend to cut away everything but the content, but the content is only half of the event its properties are often more important than the content because they determine when an event gets activated).
oh yeah, i noticed, condition must be set, i did not work already with troop event, i'll try better

edit: but... even if this works, I must copy for every troop?
is this worth?
there are other solutions?§

edit: ok works!

i will not paste screen since it works xD but how to set a battle common event you cited?

another thing, for enemies? which scriptstring I need to check if all enemies are petrified?

btw I cut the activator cause i'm not a complete noob, but for the sake of correctness (even for those who read and are new) i will remember to put all the window.
this will do the trick 1 event for all troops
http://www.yanfly.moe/wiki/Base_Troop_Events_(YEP)
thanks. for enemy states check instead? i couldn't find the proper call.
for enemy use

$gameTroop.members()[index]
Hi! I thank you for this thread because it made me realize that I forgot to adress this possibility in my game: when everyone is petrified. lol
I just fix it, I achieved this with the <Custom Apply Effect> notetag of Yanfly Buff & State core, just saying...

Anyway you do it, I suggest that you set all party members HP to 0 instead of using GameOver. This way, the game will proceed with the processDefeat function: play defeat ME and display the Party Defeated text. And then it will proceed to the game over scene.
I used this:
Code:
if (user.isActor()) {
      for (i in who) {
        var h = who[i].hp;
        who[i].gainHp(-h);
      }
} else {
      BattleManager.processVictory();
}
*who is $gameParty.aliveMembers()
someone know how to tell via script in a compacted version this?

$gameTroop.members().length === 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8

if $gameTroop.members()[number].isStateAffected(2) then gameover
I tried this but does not work

for (i in $gameTroop.members()){
if $gameTroop.members().isStateAfflicted(2)};
You're missing the index ...
Code:
for (i in $gameTroop.members()){
   if ($gameTroop.members()[i].isStateAffected(2)) {
      code
  }
};
*and it's Affected not Afflicted
yeah affected I wrote fast XD

edit: ok now I can use "for" in many things, I'm still learning ;P
Yeah, it's a loop. It can repeat lines of codes, so it's a potent programming statement.
@TSR ok i tried this one in the battle event and works, but there's a bug, even if all three heroes receive petrify, only 2 at the end of turn die, the third (middle one) die the turn after, after receiving another bunch of attacks(still petrified) why?


for (i in $gameParty.aliveMembers()){

if ($gameParty.aliveMembers().isStateAffected(2)) {

var h = $gameParty.aliveMembers().hp;

$gameParty.aliveMembers().gainHp(-h);

}

};

the battle event condition is set to turn end -- turn

edit, with 4 battlers, the first and third died at 1 turn, the second at 2, the fourth at 3.
strange.
Not sure I can help there... I've never used such mechanics in battle events (I barelly ever use them).
As I said, I used <Custom Apply Effect> notetag of Yanfly Buff & State core to to this. It allow to run code each time the state is applied to a battler.
Maybe someone else can help you better with Battle eventing.
Good luck!
I dunno, seems like you're trying too hard to reinvent the wheel when you could just use a plugin. I don't mean to be all self-promote-y, but AES_BattleCore, linked in my sig, lets you add extra "death states" so that, rather than killing affected party members affected by petrify, they can be left petrified and still have it count toward a game over. So if 1 was petrified, 2 was petrified, and 3 was killed by damage, you'd get a game over as if all 3 were dead. Looks better.

That aside...

@TSR ok i tried this one in the battle event and works, but there's a bug, even if all three heroes receive petrify, only 2 at the end of turn die, the third (middle one) die the turn after, after receiving another bunch of attacks(still petrified) why?


for (i in $gameParty.aliveMembers()){

if ($gameParty.aliveMembers().isStateAffected(2)) {

var h = $gameParty.aliveMembers().hp;

$gameParty.aliveMembers().gainHp(-h);

}

};

the battle event condition is set to turn end -- turn

edit, with 4 battlers, the first and third died at 1 turn, the second at 2, the fourth at 3.
strange.
The reason they're not all being killed is because of your loop logic. I'll explain:

Assuming a party of 3 members, all of which are alive:
  • $gameParty.aliveMembers().length == 3
  • "i" points to the party member in position 0 (first party member)
  • Party member 0 is affected, so they die
  • $gameParty.aliveMembers().length == 2
  • "i" points to the party member in position 1 (second party member)
  • Party member 1 is affected, so they die
  • $gameParty.aliveMembers().length == 1
  • The loop says, "okay, we're at position 1 and the length is only 1, so we're done processing. The third party member gets skipped.
To bypass this, you generally want to iterate backward through an array:
Code:
for (var i = $gameParty.aliveMembers().length - 1; i > -1; i--)
{
  if ($gameParty.aliveMembers()[i].isStateAffected(2)) $gameParty.aliveMembers()[i].addState(1);
}
That said, state 2 is generally reserved for Guard and should probably be left alone. It's not a good idea to start adding custom states until 004.
I do not use nothing except death state, for the eventing script: the best way to learn something is through experience, if I cannot resolve tiny problem like this without a premade script then I can't event and script my whole game.
I've learned so much in few months only cause of trial and error.

thanks for the advice, I'll try that solution for the syncope death problem.

@Aesica the script didn't work properly, i used in troop event, the petrified members died the turn after, even if a member was alive and without state.
@Aesica the script didn't work properly, i used in troop event, the petrified members died the turn after, even if a member was alive and without state.
Isn't that what you were trying to do, though? There may be a language barrier going on here.
sorry for any misunderstanding, my intent was : if all party member are afflicted by petrified, at the end of this turn, game over.

Original thread: https://forums.rpgmakerweb.com/threads/force-death-state-with-petrified-and-other.116073/