Make Game Only Recognize ACTIVE Party?

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Hopefully this is the right place to post this since it's kind of a script edit/request.

One of my game's gimmicks is the ability to recruit and collect a lot of characters. Whenever you earn a new character, I use the 'Add Party Member' command. Naturally you can only use 4 characters in battle, so the player uses Formation to choose who's in those 4 spots, with the other characters left in reserves. I'm also using Yanfly's Party Select script to make it so that players can only access the Formation screen from a specific location, so they have to plan their team carefully before heading out on mission.

Normal so far, right?

I've recently added Teleport Markers to the game that, when stepped on, check if X Actor is in the party, and if they are, the player is asked if they would like to teleport. If they say yes, that Actor loses 1 MP and the player teleports to a place they otherwise couldn't reach. If X Actor is NOT in the party, it's supposed to just say "you don't have anyone with the power to activate this".
However, I've found that even when X Actor is NOT in the Active Party, but is still 'unlocked' and selectable in Formation, the game counts them as being 'in the party' and the event activates regardless. I realize this is probably due to unlocked characters being added using the 'Add Party Member' command, but there's literally no other way to make new characters available to select, so I don't know how to get around this issue.

At first I thought it was an issue with Yanfly's Party Select but I removed the script and Enabled the Formation screen and tested it and it still recognized the character as in the active party when they weren't.

This not only ruins the Teleport Markers, but pretty much my whole game as many cutscenes and battles will have special dialogue based on who's in the active party at the time so it's gonna be a clusterf*ck of EVERYBODY throwing random lines out of the ether, lol!

What I need is for the game to only ever recognize the top 4 characters as 'in the party' for the purpose of 'if X Actor is in party' based conditionals. Is there a way to accomplish this?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
There's two ways you could go about it: one via Eventing, one via Scripting.

Eventing: In the Control Variables command, there is a (well-hidden) way to track which Actors are the top 4 members of your party. In Control Variables, choose "Game Data", then "Party Member #1"'s Actor ID as the value to set the variable to. Repeat using different variables for Party Member #2, #3, and #4, then check whether any of those Actor IDs are equal to the ID of the Actor that can use Teleport Markers. If so, allow the jump; if not, don't allow the jump.

Scripting: There is a function in the Game_Party class called "battle_members":
Code:
#--------------------------------------------------------------------------
  # * Get Battle Members
  #--------------------------------------------------------------------------
  def battle_members
    all_members[0, max_battle_members].select {|actor| actor.exist? }
  end
This will return the top 4 (or top however many battle members can be in your party) members; I believe it will return them as objects in an array although I've never referenced this function before. So for example, if you wanted to check whether Actor #8 is in the Battle Members part of the party, and set Switch #15 to True if they're in your party or False if they're not, then you could add this Script snippet into your event:
Code:
$game_switches[15] = false
for i in 0..($game_party.battle_members.length - 1)
if ($game_party.battle_members[i].id == 8)
$game_switches[15] = true
end
end
Since it sounds like you'll want to use this kind of technique a lot for determining what dialogue to show, the best long-term solution would be to add a new method to your Game_Party script, where you pass in an Actor's ID as an argument and it will return either True or False (for direct use in a Conditional Branch) based on whether that ID is associated to an actor that is part of the battle_members.
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks a lot for the response :) I'm not very good with scripting at all so very little of that makes sense to me :( Having something in the Game_Party script sounds like it would prevent the events themselves from being too cluttered but I'm not sure how easy that would be to edit.

I gave the variable method a go and it did work, however the event is huge due to having to check each variable individually and then having a copy of the event's function pasted in each of the 4 possible spots, and that's with just one character to check for. I had intended other magic characters to be able to use teleporters too, with the player maybe somehow having a choice of who uses it (so they can choose who's spending MP).

Is there a way to make it so that the game will go:
- If Variable 1, 2, 3 or 4 = Actor ID, perform X Action.
- Else, perform Y Action.​
Instead of doing what it's doing now, which is:
- If Variable 1 = Actor ID, perform X Action.
- Else; If Variable 2 = Actor ID, perform X Action.
- Else; If Variable 3 = Actor ID, perform X Action.
- Else; If Variable 4 = Actor ID, perform X Action.
- Else; Perform Y Action.​

I'm starting to think this might have been a bad idea. I never imagined something as simple as 'if X is in party, do this, if not, do this' could be so complex but once again RPG Maker manages to make a mess out of the simplest things :( I can't count the amount of times something that should've taken me 5 minutes ended up taking over a day or two to make work.
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
You really need a separate variable for each party member? Why?

If you just want to check for the battle party members, you can add this snippet anywhere in the script editor:
Code:
=begin

You can use this in a Conditional Branch (with the Script option):

  actor_in_battle?(actor_id1, actor_id2, ...)

Replace actor_idX with the database ID of the actors you want to check for.
You can add any amount of actor IDs and if ANY of them is in the battle party,
this check will return true.
 
Examples:

  actor_in_battle?(1)
  actor_in_battle?(2,5,8)

=end

class Game_Interpreter

  def actor_in_battle?(*ids)
    return $game_party.battle_members.any? {|mem| ids.include?(mem.id) }
  end
   
end

I find the users of RPG Maker making even the simplest things way too complex in their eventing, only to realize later (much later) that it could have been done much easier with a less over-complicated method (and now I don't mean method, as code-talk, I mean a way to achieve something).
It's more often the user's fault than the engine's in the case of eventing, at least from what I saw so far.
But this is just my view on these things, and it's kinda off-topic, sorry. :p
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
If you're only going to check 1 actor, you can also just use this one liner in the script part of the conditional branch (on the last tab of the conditional branch menu)
Code:
$game_party.battle_members.include?($game_actors[id])
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks guys :) I'm sorry I'm so useless at understanding these things. I think anything involving scripting is just way over my head. Even when they sorta make sense I still don't know how to work them in with events and stuff.

I did just think of an alternate method though that probably seems long-winded or stupid but at least is something I'd know/understand how to make work:
Stepping on a Teleport Marker sets a variable 'Marker' to whatever number teleporter that is in the game. My mages would be given a spell called 'Teleport' that only functions out of battle and calls a common event that checks which teleporter is being stood on and then performs the transport. Naturally if the user doesn't have MP, they can't cast it, and the player can't use the spell if the character isn't in the active party, removing all need for scripting the battle party checks. If the player isn't standing on a teleporter, the event just calls an 'I can't use that here' message.

The only thing I would need is to make sure that the moment a player steps OFF of a teleport marker, the variable is set to 0, so that the spell can't be used anywhere after stepping on the teleporter, however that would likely require placing 'player touch' events on every empty square around each teleporter that sets the variable to 0 and that would be tedious and clog up the game with events. Is there a way to make it so that as long as you're standing on a specific event, it sets a variable to a number, but the moment you step off, it sets the variable to 0? If not it doesn't matter and I can just do the surrounding touch events.

I know the method is bizarre but as long as it works, right? XD
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
My method is completely done using events only, you just go to the Conditional Branch command's last tab, click the "Script" option and paste that code and change the ID part to the actor ID..

The problem with "as long as it works" is that sometimes you end up making something so complicated that when errors arise it becomes almost impossible to repair them. It might also lead to unoptimized operations that can cause problems with runtime.

I'm not saying you should learn it NOW, but at least try to get it bit by bit as you go on, that will make your life easier and your game hopefully better :)

Life is a continuous learning journey after all :)
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
I realized re-reading that yah your method didn't include scripts either. I'm just really dense, lol.

I tried my method out and it worked out great and I realized all I have to do is set the Teleport Marker variable back to 0 after the teleport occurs. No need for a million event tiles that do it when stood on, lol.

Thanks for the advice still though, and I will endeavor to try learning these things soon :)

Topic can be locked/deleted/whatever happens when something's done.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Please report your post and ask the mods to close the thread, rather than hoping someone will see your comment. It's easier and faster :)
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,496
Reaction score
5,332
First Language
english
Primarily Uses
RMMZ

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.

 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks Logan :)

I discovered that even if a character isn't in the top 4 (i.e: active/battle party), they can still use their out-of-battle skills, such as healing abilities from the Skills menu. For my game this is a HUGE balance issue. Didn't bring a healer with you? No problem! lol. Didn't bring the afformentioned Teleporter from my first issue? Who cares! They can teleport themselves into active party just long enough to use that skill! XD

Naturally this is a game-breaker and massive exploit and I have no idea how to make it right. I need the game to either not recognize or completely disable characters below those top 4 from being interactable in the menu. Ideally it would be nice if I could make it so that the menu doesn't even SHOW any characters beyond those first 4. The only time those characters should be visible is Yanfly's Party Select window, which I call directly using an NPC (Formation is Disabled everywhere else).

If it helps for clarification, I'm going for a Suikoden-esque style approach, by which you RECRUIT a ton of characters, but they're not all with you at any given time and you have to talk to a party-manager NPC to change your team, so party fo the strategy comes in who you take out with you. So none of the other recruited characters should be accessable whilst anywhere BUT the party manager.

At the very least I need to make it so characters not in the battle party can't use their out of battle skills. It doesn't matter if they're still visible in the menu.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
I don't think you are going the right way here...

Instead of adding exceptions for every part of the engine where party members are used, why not remove the non-battle members?
You can keep a list of "unlocked" characters the same way Suikoden does, by turning a switch ON for each character (yes, Suikoden 2 used switches for each member, I could turn these ON and OFF in a save file editor and they would appear/disappear from the hide-out accordingly).
This will also let you make a "base of operation" hide-out for your party, where non-battle members appear (with another set of switch), so that the player can interact with them.

It's basically eventing, either with a lot of switches (depending on how many party members there are) or with some scripting involved (if you want to spare your switches).
Make a common event which checks for all unlocked party members (by checking their "unlock" switches), and if they are, add them to the party right before you call the party selection menu. After the party selection menu script call, remove all non-battle members again, and turn on their "not in battle party" switches, so that they appear in your party hide-out.

That's what I did in a long forgotten test project I made eons ago (except I used script calls and a small script to avoid using that many switches for it).
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
The funny thing is that I did contemplate an idea that was pretty much that, but the idea of a lot of switches was a little irritating, but I can certainly do that as long as it won't make the game lag having that many extra switches thrown in.

My only question (I think) is the "After the party selection menu script call, remove all non-battle members again, and turn on their "not in battle party" switches, so that they appear in your party hide-out" part. How would the game knoow which characters they were?

If it's not too much a trouble a step-by-step how-to would be great. I took the day off today 'cause the whole thing was stressing me out, lol, but I'll definitely play around with this tomorrow and see if I can get it working.
 
Last edited:

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

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top