Stuck making party manager

I'm making a "custom" script that allows you to remove characters from your party and I have a problem.
Before stating anything, I want to say that I'm making this because none of the scripts available suit my needs, they look really nice, but they can't work with the game I'm making.
In my game, players will play as a main character that can't change, that's ok. But here's the problem, there's no storyline, players will just go and talk to different characters and maybe they'll get them in their party... the game has more than 30 possible actors.
What I'm looking for is a system that allows players to remove a character that is in the party, and when they do, the actor says something like "I'll be waiting in somewhere".
 
I already made the structure with a Window_Party and Scene_Party. It detects if a certain actor is in the party and shows a command to remove each one. The problem is that when I click a command, the game freezes. I don't know where's the problem.
 
The other thing is that I don't really know how to make a common event that detects when an actor is removed and activates, so there's the message that says "I'll be waiting blah blah blah".

(My characters for testing are named "bontest" and "berrytest")

Window_Party
 

Spoiler
#==============================================================================# ** Window_Party#------------------------------------------------------------------------------# This is the custom window that detects if the actor is in the party.#==============================================================================class Window_Party < Window_Command def alignment return 1 end #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) update_placement self.openness = 0 open end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Update Window Position #-------------------------------------------------------------------------- def update_placement self.x = (Graphics.width - width) / 2 self.y = (Graphics.height - height) / 2 end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list if $game_party.members.include?($game_actors[10]) #If actor 10 is in party, show command add_command("Bontest", :rmbontest) end if $game_party.members.include?($game_actors[9]) #If actor 9 is in party, show command add_command("Berrytest", :rmberrytest) end endend
Scene_Party

Spoiler
#==============================================================================# ** Scene_Party#------------------------------------------------------------------------------# The Party Scene accessed through the menu. Removes actors.#==============================================================================class Scene_Party < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_command_window end #-------------------------------------------------------------------------- # * Pre-Termination Processing #-------------------------------------------------------------------------- def pre_terminate super close_command_window end #-------------------------------------------------------------------------- # * Create Background #-------------------------------------------------------------------------- def create_background super @background_sprite.tone.set(0, 0, 0, 128) end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_Party.new @command_window.set_handler🙂rmbontest, method🙂command_rmbontest)) @command_window.set_handler🙂rmberrytest, method🙂command_rmberrytest)) @command_window.set_handler🙂cancel, method🙂return_scene)) end #-------------------------------------------------------------------------- # * Close Command Window #-------------------------------------------------------------------------- def close_command_window @command_window.close update until @command_window.close? end #-------------------------------------------------------------------------- # * [Remove bontest] Command #-------------------------------------------------------------------------- def command_rmbontest $game_party.remove_actor(10) #Removes bontest (actor 10) from party end #-------------------------------------------------------------------------- # * [Remove berrytest] Command #-------------------------------------------------------------------------- def command_rmberrytest $game_party.remove_actor(9) #Removes berrytest (actor 9) from party end end
If someone knows how to make this actually remove an actor without freezing the game and detect when an actor is removed to activate a common event, that would be perfect.
Done that before using eventing only.

You just need a common event to remove all actors (all 30 of them)

so it doesn't matter if they are in the party or not, every one get removed.

Then have get the lead actor(s) id into variables and add them back accordingly.

When making a script for something that eventing (or rather the interpreter) can do, you can simply go to game_interpreter class and see how those commands are being done there. Abstracts the commands and put them in your script should do the trick.

Probably my last advice too, free time's over, so i won't be able to help much from here.  ;_;
Done that before using eventing only.

You just need a common event to remove all actors (all 30 of them)

so it doesn't matter if they are in the party or not, every one get removed.

Then have get the lead actor(s) id into variables and add them back accordingly.

When making a script for something that eventing (or rather the interpreter) can do, you can simply go to game_interpreter class and see how those commands are being done there. Abstracts the commands and put them in your script should do the trick.

Probably my last advice too, free time's over, so i won't be able to help much from here.  ;_;
Actually I don't want to remove all party members, I want the player to choose which party member to remove. I know how to do it through a common event, but I already had the base of a menu scene with options (copying the Scene_End as you told me), and that looks way better. And it works so far, but it freezes when I select a command, seems like the part of the script that removes the actor needs something else to finish the process, or something.

I didn't know the events where scripted in "Game_Interpreter" (that thing is a bible). That will help me A LOT. Thank you very much!
 

but it freezes when I select a command
Seems like a bad loop if it freezes or crash the game,

or probably a bad way of implementing wait/.freeze/.yield and so on.

But if it's doing nothing after the command, then something is probably missing.

 

 

I didn't know the events where scripted in "Game_Interpreter" (that thing is a bible). That will help me A LOT. Thank you very much!
Good luck on finding what you want! They normally have descriptions there with the exact same name you get in the editor. 😉
Thanks.

I forgot to mention I think the problem may be that there's nothing saying what to do after the player clicks a command. I mean, the commands tell the game to remove a certain character, but nothing else. Maybe I have to add code to go back after removing the character, like closing the menu, refreshing, something. I'm new in all this scripting stuff. The problem might be as simple as adding one line. I'll see if I can get that working.
oh, that might just be the problem.

try adding SceneManager.return after your codes in the command.

Edit:

On a second thought, direct call for a return might not be a good idea, especially if you created some new windows that didn't register itself with scenemanager disposal. That might cause memory leak in some way.

Add a new method some where in the script before the last "end"

def return_to_previous_scene  WWW.bitmap.dispose if WWW  WWW.dispose if WWW  SceneManager.returnendThen add return_to_previous_scene below your codes in the command.

(***)

WWW = the name of the windows you are using, eg, when you create a window @win = window_extra.new, @win is the name. In this case, @win.dispose) see example here for how to dispose a window.

WWW.bitmap.dispose is used only when you create a bitmap graphic inside the window.
MeowFace, I swear, I want to kiss you so bad... It works just fine. But I can't trigger a common event when the option is selected.

I'm trying to write something like this for each character in the Scene_party:

def command_rmbontest $game_switches[8] == true SceneManager.return SceneManager.return end (double return so it closes the menu when triggered)

And I made common events that shows a message and removes actor from party.

But the switch is already on without triggering the command. (tested with console)
oops.. seems like i post my edit too late.. lol!

to call a common event in a script, use this:

$game_temp.reserve_common_event(1)where 1 is the common event's number

Edit:

You don't need a double return, simply use "goto" and not "call" when you call that scene. and return should return you to scene_map.(base on memory here, might need you to test that out)
Upon hitting the OK button on any selectable window, it will deactivate the window automatically by default.


You will need to either re-activate it, or activate another window, or you could also exit the scene immediately.


To reactivate the window, just use @window.activate in your methods (where @window is the name of your instance variable holding the window instance).


I wouldn't use SceneManager.return twice. If you need to get to the map immediately, use SceneManager.goto(Scene_Map).


And a BIG note:


Windows are automatically disposed upon exiting the scene, so there is no need to call dispose on them at all unless you need them disposed before exiting (like a window which is created on demand only and is disposed manually after usage - this is shown in your topic which you linked).
Nice, thanks to both of you.

"$game_temp.reserve_common_event(1)" works perfect and "SceneManager.goto(Scene_Map)" too.

I even managed to make the command on the menu available ONLY if there's 2 or more actors in the party, the same way the Formation command works. If there's one actor (main character in my case) the Party command appears gray and wont be accessed when toggled. I did this by copying and renaming all codes in the original scripts related to "formation". And then added the option Party as a original command in the menu I'm using, not in the customization section.

This sounds weird explained like this. If anyone steps here and wants to know how to do this, I'll explain in more detail.
Can't remember how the formation works since i removed the whole thing from my main code. lol!

Went through a similar situation you did there, and decided since there will always only be 3-4 actors available and i am adding and removing them using a "tent" and "airship/homebase" area... + i am using slg/stg battle system(which the player get to choose upon encounter, and both has nothing to do with formation)... i find "formation" to be in the way, since it changes the lead actor. Pondering on the thought if i should keep it and add a script to "fix" the main character to the 1st slot or if i should simply remove it. The 2nd solution seems more feasible for my case. 😛

If you need more help on that, I'll need to get on one of the old project sample to check how it works.

But if i remember right, formation command is automatically greyed out when you have only 1 player in the party right? So there's probably a ">= 1" checks somewhere out there in the script jungle. Just get on your traveller outfit, equip yourself with a net, hunt that "1" down and change it to whatever numbers you like. 😛
Nice, good luck with your project! About the "lock first actor" you mentioned, maybe you already know, but Theolized has a snippet that locks the first actor of the party. it's called Lock Party Leader. I'm using that 😉

About the formation command being greyed out, I can't really tell where that's done in the code. But this is the condition, in Window_MenuCommand, line 91:

$game_party.members.size >= 2 && !$game_system.formation_disabledThis seems to tell the script to disable "formation_disabled" when the party has 2 or more actors in it.

I just copied and pasted every line of code with "formation" in it and renamed "formation" to "party". Though I learned some things doing that, copying and pasting is magic!
Oh, i see what you are toying with this time, here's some more toys for you and a small explanation on what they do: 😉

$game_system.formation_disabled

Is a check for the editor's event command, if you disable a formation using eventing it will return true and grey out the command. Else it should return false.

$game_party.members.size

Is the one that tells you how many party members you currently have. Both Battle and Idle.

$game_party.members[N].id

This one will give you the id of your party members based on formation order.

Where N starts from 0~N

$game_party.members.include?($game_actors[id])

Where id is your actor's id, this checks if actor [id] is available in the party or not.

$game_party.battle_members[N].id

This one will give you the id of the battle members. Where N starts from 0~3 (default stops at 3 unless you have altered the max battle members)

$game_party.battle_members.size

This one checks the size of your actors that participates in battle.

$game_party.battle_members.include?($game_actors[id])

Where id is your actor's id, this checks if actor [id] is available in for battle formation or not.

----------------------

So.. to lock an actor to formation(party) slot 0, will means you need to do a check like:

if $game_party.battle_members[0].id != 1

  continue the formation change

else

  play a buzzer sound

end

Where 0 is the 1st slot and 1 is the actor's id.

Again... somewhere in the script jungle where it changes formation... 😛

Edit: reading the syntax again, makes me think something is fishy about that condition.. so it might not work without a real test. lol!
Well,  "$game_party.members.size" was certainly useful for disallowing players to have more than 4 actors in the party.

Every time they get a character to join the party, there'll be a Conditional Branch with the condition "$game_party.members.size >= 4".

If the condition is applied, a text will be shown saying that he/she can't join and if condition isn't applied the character will join the party.

This is perfect because this way I can make custom texts for every character (because they aren't bots that say all the same thing).

Thanks again!

Now the only thing I can think that improves this (now we are talking about improvements, you already helped me a lot) would be adding a little text before the commands that says "Choose character to remove:"

I can do it with draw_text, but the text is drawn in the same line as the first command.

But now, really, I can't just thank you enough for all this help, I want to add your name in "Special thanks to" in the credits of my game when completed, along with some other people here who helped me understand this program.
Oh.. if it's the max member allowed.. i think we can change it somewhere..

Umm...nope! A quick search(ctrl+shift+f) returns nothing in the script. only max_battle_members can be changed..

And apparently the follower class use it to decide how many actors to be shown on the screen.

We can make a long caterpillar with that. 😛

As for draw text.. hmm.. lemme check for the escape code for next line.

\n should work, i think, it's listed in window_base as a next line check.

Aww, thanks is not needed as you already know, i am just here to speed up my day off boredom. lol! And today's the last day too.

My "poof" count down is ticking. 😛
Don't worry about the max actors in party limit, I have done that the way I wanted.

About the text, it doesn't work, the text is drawn in the same line the commands start, I have to tell the script that "draw_text(blah blah)" takes a line for itself.

But that's enough for me, everything is working fine. Enjoy the rest of your day, and good luck with wathever you have to do now.

I hope you realize how happy you made someone today 😀
You are welcome! 😀

4 more hours of boredom and i am free.. umm.. unfree.. lol!

At least free from boredom. 😛

Original thread: https://forums.rpgmakerweb.com/threads/stuck-making-party-manager.44615/