Bind Galvs Party Select to key

Hi.

Is there a way to call Galvs Party Select Menu directly from the script itself (bound to key, for example A) and not just by scriptcall? is anyone using it?

I'm trying to find a solution like this to avoid using parallel processes.

Would be fine as add-on as well.

It's possible to do an add-on that activates it on key press, but which option would that activate? There are three different ways to invoke the window.
@Trihan
Alright, lemme explain it with more words. I have two characters that are always part of my party. I have written an event that swaps the position of those two characters. Doing so, Galvs Script helps me to decide which of the two character is the party leader. This works quite like a charm so far. I just would like to have exactly this function built into the script (or Addon) so I don't have to use a all-time-active parallel event for the whole game. To do so, I somehow need the ability to call this script with another method than by scriptcall.
Spoiler: Event
Unbenannt.png
Can you not make it a common event so that you only need to create it once and not paste it into maps? Just the one parallel event running shouldn't cause any issues.
Can you not make it a common event so that you only need to create it once and not paste it into maps? Just the one parallel event running shouldn't cause any issues.
Yeah, that was my first idea doing it that way. However, I'm quite sure it would be better to have it as script addon and completely avoid parallel process Events in my whole game to make sure everyone can play it without running into performance issues. And would be quite interesting for me to see how to fully "event" with Ruby. :LZSjoy:
Yeah, that was my first idea doing it that way. However, I'm quite sure it would be better to have it as script addon and completely avoid parallel process Events in my whole game to make sure everyone can play it without running into performance issues. And would be quite interesting for me to see how to fully "event" with Ruby. :LZSjoy:
Just had a look and although it's possible to script this, because Galv coded it to work with the interpreter, doing it in an event is actually the optimal solution.

But I'm nothing if not a certified genius, so here you go.

Ruby:
class Scene_Map < Scene_Base
  alias :tlb_galv_patch_update :update
  def update
    tlb_galv_patch_update
    if Input.trigger?(:X)
      party_select(0)
    end
  end
 
  def party_select(*args)
    $game_message.party_list = [*args]
    $game_message.party_select = true
 
    $game_message.add("")
    $game_message.background = 2
    $game_message.position = 2
  end
end
Hi @Trihan

Thanks a lot. :LZSjoy:

Currently trying to add my query. Any ideas on how I can make it work?

Spoiler: Code
Code:
class Scene_Map < Scene_Base
  alias :tlb_galv_patch_update :update
  def update
    tlb_galv_patch_update
    if Input.trigger?(:X)
      Sound.play_ok
    if $game_variables[1] == 1
      $game_party.remove_actor(1)
      $game_party.remove_actor(2)
      $game_party.add_actor(1)
      $game_party.add_actor(2)
    else
    if $game_variables[1] == 2
      $game_party.remove_actor(1)
      $game_party.remove_actor(2)
      $game_party.add_actor(2)
      $game_party.add_actor(1)
      end
    end
      party_select(0)       
    end
  end
 
  def party_select(*args)
    $game_message.party_list = [*args]
    $game_message.party_select = true
 
    $game_message.add("")
    $game_message.background = 2
    $game_message.position = 2
  end
end
Ruby:
class Scene_Map < Scene_Base
  alias :tlb_galv_patch_update :update
  def update
    tlb_galv_patch_update
    if Input.trigger?(:X)
      party_select(0)
    end
  end
 
  def party_select(*args)
    $game_message.party_list = [*args]
    $game_message.party_select = true
 
    $game_message.add("")
    $game_message.background = 2
    $game_message.position = 2
  end
end

class Window_Party_Selector < Window_Selectable
  alias :tlb_galv_patch_on_ok :on_ok
  def on_ok
    tlb_galv_patch_on_ok
    $game_party.remove_actor(1)
    $game_party.remove_actor(2)
    if $game_variables[Galv_PartyPick::VARIABLE_ID] == 1
      first_actor = 1
      second_actor = 2
    elsif $game_variables[Galv_PartyPick::VARIABLE_ID] == 2
      first_actor = 2
      second_actor = 1
    end
    $game_party.add_actor(first_actor)
    $game_party.add_actor(second_actor)
  end
end
unrelated to the rest of the topic, the event you showed here has a big problem:
it is a loop inside a parallel process.

parallel processes automatically loop, and making a manual loop around the entire parallel content is a really bad idea. Because that adds absolutely nothing, but disables quite a number of antilag-features build into the engine.
Topic solved thanks to fantastic guy @Trihan :LZSjoy: However...

Because that adds absolutely nothing, but disables quite a number of antilag-features build into the engine.

... can you explain me what those built-in antilag features are and how loops in events disable them actually? Never wanna miss a chance to learn anything new.
Not loops in events in general (then the command would make no sense to be included at all.
The problems is loops in parallel processes and in autoruns, because those loop automatically.

The parallel process (and autorun, but I won't repeat that from now on) are designed to loop once per frame - each frame the entire content is processed once.

The loop command is designed to loop independently of the frame/time count. If you have a loop inside an action button event, it can loop hundreds of times within a single frame - which is why that command can cause lag if used wrong.

Now the next part you need to know is that the wait command is actually misnamed - it just looks to the player as a wait most of the times.
But what it actually does is tell the engine to "skip processing this event in the main game loop for x frames"
Using the wait in a regular parallel process actually reduces lag, because the parallel process will not be processed every frame like normal. But using too many waits can actually look to the player like lag.
Example:
You have a parallel process moving a light along the player. No waits means that the process is calculated every frame (even if the player doesn't move), creating a lot of lag and possibly slowing down the entire game (if too much of other events use up the resources as well).
However too many waits and the light will no longer follow smoothly but jump positions whenever the waits are over. And that will look like lag to the player even if it is a programmed wait.

So you always have to experiment how many waits to include to reduce lag without creating pseudo-lag. With parallel processes that is easy because you know that they run once per frame.
Until you place a loop which might cause them to run multiple times inside a single frame.

and several other things that depend on how the loop is used - while the loop inside the parallel process never adds any functionality, because that PP is already looping on its own.


A loop can be usefull even in a parallel process for counting something or so, but ONLY if you break that loop and have commands outside it (but still in parallel).
But you placed the loop/repeat at the beginning and the end of the parallel content, which means it does nothing but confuse the engine on how often that group of commands should be processed.
@Andar That's interesting. Thank you for the explaination.
@Trihan It works wonderfully. Now that I think about it, is there a way to swap both the Actors facesets with other facesets when a selection is made? The background is that I want to add a 1 or a 2 to the facesets to show the player which Actor is currently the Leader (1) and which one is the Follower (2).
They reorder themselves in the window with the first one being the party leader anyway, but sure, you can do that. I'll give you the code in a bit.
They reorder themselves in the window with the first one being the party leader anyway, but sure, you can do that. I'll give you the code in a bit.
Yes, I noticed that. However, a more visual feedback to the player would be a lot better. Thank you for your effort. :LZSjoy:
Yes, I noticed that. However, a more visual feedback to the player would be a lot better. Thank you for your effort. :LZSjoy:
If you're not using the script for anything else, you could alias the draw_item method of the party select window to draw the slot directly over the face image:

Ruby:
class Scene_Map < Scene_Base
  alias :tlb_galv_patch_update :update
  def update
    tlb_galv_patch_update
    if Input.trigger?(:X)
      party_select(0)
    end
  end
 
  def party_select(*args)
    $game_message.party_list = [*args]
    $game_message.party_select = true
 
    $game_message.add("")
    $game_message.background = 2
    $game_message.position = 2
  end
end

class Window_Party_Selector < Window_Selectable
  alias :tlb_galv_patch_on_ok :on_ok
  def on_ok
    tlb_galv_patch_on_ok
    $game_party.remove_actor(1)
    $game_party.remove_actor(2)
    if $game_variables[Galv_PartyPick::VARIABLE_ID] == 1
      first_actor = 1
      second_actor = 2
    elsif $game_variables[Galv_PartyPick::VARIABLE_ID] == 2
      first_actor = 2
      second_actor = 1
    end
    $game_party.add_actor(first_actor)
    $game_party.add_actor(second_actor)
  end
 
  alias :tlb_galv_patch_draw_item :draw_item
  def draw_item(index)
    x = index * (item_width + spacing)
    y = item_height - 25
    tlb_galv_patch_draw_item(index)
    draw_text(x, y, item_width, line_height, (index + 1).to_s, 2)
  end
end
@Trihan that's perfect, thank you! :LZSjoy:
...
It's right in the original code to set it to 0.
Ruby:
  def on_cancel
    $game_variables[Galv_PartyPick::VARIABLE_ID] = 0
    $game_message.party_select = false
    close
  end
go to that line and put a # in front. then it won't change.
It's right in the original code to set it to 0.
Ruby:
  def on_cancel
    $game_variables[Galv_PartyPick::VARIABLE_ID] = 0
    $game_message.party_select = false
    close
  end
go to that line and put a # in front. then it won't change.
You were faster than I was able to delete my post. :LZSjoy: I found it out in this very minute. xD

Thanks anyway for your fast reply.

Original thread: https://forums.rpgmakerweb.com/threads/bind-galvs-party-select-to-key.145680/