force death state with petrified and other

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
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
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
no, common event.
edit I tried troop but nothing.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,232
Reaction score
6,776
First Language
German
Primarily Uses
RMMV
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).
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
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.
 
Last edited:

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
thanks. for enemy states check instead? i couldn't find the proper call.
 

Soulrender

Veteran
Veteran
Joined
Jan 12, 2019
Messages
382
Reaction score
227
First Language
Poland
Primarily Uses
RMMV
for enemy use

$gameTroop.members()[index]
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
137
Reaction score
76
First Language
French
Primarily Uses
RMMV
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()
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
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
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
I tried this but does not work

for (i in $gameTroop.members()){
if $gameTroop.members().isStateAfflicted(2)};
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
137
Reaction score
76
First Language
French
Primarily Uses
RMMV
You're missing the index ...
Code:
for (i in $gameTroop.members()){
   if ($gameTroop.members()[i].isStateAffected(2)) {
      code
  }
};
*and it's Affected not Afflicted
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
yeah affected I wrote fast XD

edit: ok now I can use "for" in many things, I'm still learning ;P
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
137
Reaction score
76
First Language
French
Primarily Uses
RMMV
Yeah, it's a loop. It can repeat lines of codes, so it's a potent programming statement.
 
Last edited:

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
@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.
 
Last edited:

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
137
Reaction score
76
First Language
French
Primarily Uses
RMMV
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!
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,017
Reaction score
949
First Language
English
Primarily Uses
RMMV
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.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
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.
 
Last edited:

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,017
Reaction score
949
First Language
English
Primarily Uses
RMMV
@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.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
155
Reaction score
29
First Language
Italian
Primarily Uses
RMMV
sorry for any misunderstanding, my intent was : if all party member are afflicted by petrified, at the end of this turn, game over.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Back in the old days, long before I was born, salted crisps - or potato chips, for you yanks - came unsalted and had a little pouch of salt to manually shake on it. Of course, things are more efficient now, but Walker's still brought back the old 'Salt 'N' Shake' style a couple years ago. Dunno why, but if I had to guess, I'd say it's because the nostalgia crowd were getting salty.
Guys I just want to sit around and work on my game! *gets lots and lots of money shoveled at him* Game, I don't recall a game. What game? :LZSexcite:
Seems like people have stopped looking both ways before crossing the road nowadays. Blindly walking out into a into a road only ends in disaster.
Just finished planning out the skeleton of the main quest line of my new game. I'm so excited for it!
Integrating Jason Perry's japan tile set while listening to Murray Atkinson's Heaven and Earth background music.

Forum statistics

Threads
94,544
Messages
921,778
Members
124,411
Latest member
yellowsonicboom64
Top