Conditionally Apply a State to All Actors

● ARCHIVED · READ-ONLY
Started by Soryuju 5 posts View original ↗
  1. I’m trying to set up a battle event which will check each actor at the beginning of every round and apply a certain state on each one if they meet a specific condition. For example, if an actor is affected by State 7 at the start of the round, add State 10 to them. I’d like to do the same thing for enemies, too.

    I haven’t really done much eventing yet (in battle or otherwise), and I think I’m missing something important about how to use script calls like $gameParty.members(), because everything I’ve tried with them so far has either done nothing or caused an error.

    Could someone give me an example of how to do what I’ve described above? It doesn’t have to be through a battle event if there’s a better way, but I need the effect active from the start of the first turn. Thanks!
  2. show us a screenshot of your troop event, it might be that the problem is somewhere else - for example the wrong span or so.
  3. I think you can make a condition to check every single battle member in your party and add state if condition met like this:
    Code:
    for (var i = 0; i < $gameParty.battleMembers().length; i++){
    var actor = $gameParty.battleMembers()[i];
    if (actor.isStateAffected(x)){
    actor.addState(y);}
    }
    Where x, y are your state IDs.
    It should be battleMembers(), not members(). battleMembers() will only check your actors who participate in battle, while members() check all your actors in your party (including those who are outside of battles).
  4. JamesRyan said:
    I think you can make a condition to check every single battle member in your party and add state if condition met like this:
    Code:
    for (var i = 0; i < $gameParty.battleMembers().length; i++){
    var actor = $gameParty.battleMembers()[i];
    if (actor.isStateAffected(x)){
    actor.addState(y);}
    }
    Where x, y are your state IDs.
    It should be battleMembers(), not members(). battleMembers() will only check your actors who participate in battle, while members() check all your actors in your party (including those who are outside of battles).

    This seems to have done the trick! Thanks!
  5. 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.