Mass party change based on their states/second party

● ARCHIVED · READ-ONLY
Started by BentStick 8 posts View original ↗
  1. Hi there!

    I'm using the Yanfy party system and building a game where almost any NPC can join the party if you can convince them.  I want to be able to "collect" battlers similar to Pokemon or Destiny of an Emperor for the NES.  I have  a 1 member party with 3 back-up characters and I want to be able to send anyone after the 4th to a special character tent, like a Pokemon PC.

    I know there are tutorials on how to do this that depend on turning off the formation system - I want to be able to reorganize team-members out of battle, so that's out.  I also know there is at least one plug-in that allows for a PC-like storage facility, but again I'd have to disable character switching outside of that, or deal with individually placing each character.

    What I tried to do is add a "Team Member" state to any "captured" NPCs.  If they don't fit in your party, you can go to the appropriate tent and switch any Actor with the "Team Member" state.  Basically, while you're in there, all characters with "Team Member become part of your party, and when you leave, only the top 4 remain, everybody else is kicked off.

    Unfortunately, after reading the script-call spreadsheet, and several examples, I still can't seem to check every character for their state and add them if they have a particular one.  I keep getting various errors when testing, mostly of an "is not a function" type.
     
    I don't have my exact script in front of me (so my example will be even more wrong than my actual attempt), but it's something like:

    loop
    "var i +=1;


    if var < 150 {


    if gameActor(i).state.includes (15) {
    gameParty.addActor(i);}
    }
    else
    {
    var i =0


    break loop
    }



    Excuse my bad syntax - am I in the ball-park?

    Is there a better way to send characters to a "PC" ala pokemon and still have the ability to rearrange the party?

    Also, I haven't had a chance to test my script for taking the actors above #4 out of the party again once I leave the tent.  Assuming this way will work in the first place, are there any recommendations there?

    Thanks folks, this has been an invaluable community so far whenever I'm googling solutions.
  2. I've done this another way in a side project. I used a variable which I stored in it my number of party members, and every time I added a party member I increased it by 1. Once it hit 3 (not 4, as we start at 0, and the MC has to stay in the party if I read your description right, so there are 3 extras left), then anyone else would not be allowed to be added to the party.


    For your game you could do it where when you capture a NPC. you check if the variable is >= 3. If it is not, add one to it and add that NPC. If it is, send that NPC to the location. You'll also probably need a switch that you turn on and off depending on if that NPC is in the party, and maybe one more switch to determine if the NPC is captured or not. So if you have a lot of NPC's it will be a lot of switches, but there's room for 2000 switches so that should not be an issue.


    The harder part is the how to add them when at the camp. I did it by setting an NPC that cleared your party out of everyone but the MC and reset the variable to 0, then you had to walk up to those you wanted to add. Once you hit 3 you could not add any more. If you messed up, talk to that NPC who clears out your party and have them do it again.
  3. Yes, my attempt is similar, I like your approach, but would rather not have to weed through the dozens of characters that could potentially be in your party.  It's a good idea though, and I'll try it if I can't find a script or method of parsing that works.

    Thanks!
  4. Yeah, that is the disadvantage. The way I handled it was the NPC that cleared out the party I had them remove every actor in order (including the MC), then re-add the MC at the very end. Turns out the remove actor command will just do nothing if that party member isn't in the party, so having it called for every single party member that can exist causes no errors. Just monotonous to set it up the first time if you have a really huge party.
  5. Here is the script I'm using:


    for (var i = 1; i < 150; i++){


    if (($game_actors.states.include?($data_states[15])) == 1) {


    $gameParty.addActor(i);


    }


     


    };

    I get: Syntax Error Unexpected Token )  every time, and if I fiddle with it, I get different errors.

    Any tips?
     
  6. BentStick said:
    for (var i = 1; i < 150; i++){


    if (($game_actors.states.include?($data_states[15])) == 1) {


    $gameParty.addActor(i);


    }


     


    };
     

    There's one bracket too much after $data_states[15]. I don't see any other problems at the moment, need to get on my PC and try it out.


    Nevermind, I was wrong. I'm working on it now.


    This seems to work:

    Code:
    for (i = 1; i < 150; i++) {
      if ($gameActors.actor(i).isStateAffected(15)) {
        $gameParty.addActor(i);
      }
    }
  7. Wow, yeah, thanks LadyBaskerville, that works great!  Not only does it add all the appropriate characters, but I also have a better idea of how scripts are processed!

    Thanks a bunch!
  8. Glad I could help :)