Script call for Party Position ID and retaining it for removal.

Discussion in 'RPG Maker MV' started by KingKraken, Apr 2, 2018.

  1. KingKraken

    KingKraken Veteran Veteran

    Messages:
    126
    Likes Received:
    29
    Location:
    Colorado, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Hello, I have a possibly simple question. Basically I'm trying to get the script call language needed to grab the ID of an actor in a party position, and then use a second script call to reference that new number.

    So first I'd be using:
    To find any actor ID in position p. But then what kind of value would I use in order to retrieve that newly acquired number? I see expressions like "newActor.id" exist when pulling instanced actors, so sure there must be one I can pair with this script for n :

    My goal is to have a system similar to Persona/SMT games where the reserve capacity is limited, so being able to get rid of actors in a convenient way is necessary.
     
    #1
  2. TWings

    TWings The Dragon Whisperer Veteran

    Messages:
    345
    Likes Received:
    608
    Location:
    Kyoto
    First Language:
    French
    Primarily Uses:
    RMMV
    I'm not sur if it's what you're asking, but why not do it all in a simple call like this :
    Code:
    $gameParty.removeActor($gameParty.members()[p]._actorId);
     
    #2
    KingKraken likes this.
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,712
    Likes Received:
    11,419
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If you want to do something like remove the last member of a party when you have too many members, remember that adding an actor adds them to the end of the party lineup, so you can't just remove the last member, as you'd be removing the person you just added.

    You could do something like this when you want to add a new member:
    Use control variables to get the party size into a variable
    Use a conditional branch to see if the party size is equal to the maximum size, and if it is, a script call to remove the last party member.

    In that case, it would be
    Code:
    $gameParty.removeActor($gameParty.members()[$gameParty.members().length - 1])
    to remove the last person in the party

    And then add the new party member (this would be done outside the conditional branch, so the new member would be added to the end of the lineup if it were already full and one person removed, or if there was still room for more)
     
    #3
    KingKraken likes this.
  4. KingKraken

    KingKraken Veteran Veteran

    Messages:
    126
    Likes Received:
    29
    Location:
    Colorado, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    This one did the trick! Thanks a lot.

    @Shaz Your method is also super helpful! I'm still toying around with how I want the event to play out. So having this also be available for reference is amazing!

    Thanks a ton ya'll!
     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,426
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @KingKraken
    For the first part there would have been no need for a script call at all.
    That (ID of actor on party position) is one of the many options available in the default control variable command under game data.
    I suggest you check that option (it default to "map id" if you have problems seeing it, but that map id can be changed to other options) for future needs, because a lot of things can be done without scripts.
     
    #5
    KingKraken likes this.
  6. KingKraken

    KingKraken Veteran Veteran

    Messages:
    126
    Likes Received:
    29
    Location:
    Colorado, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I needed the script, because the game data variable stops at 8 party positions. Whereas I'm using about 12+.
     
    #6

Share This Page