disable\enable party leader by switch

hello everyone!

I need a little help again!

so, there's a script that can disable switching the party leader

here it is:

# Disallows changing formation of first actor #
# Plug n Play #
class Scene_Menu < Scene_MenuBase
  alias csca_snippets_on_formation_ok on_formation_ok
  def on_formation_ok
    if @status_window.index != 0
      csca_snippets_on_formation_ok
    else
      Sound.play_buzzer
      @status_window.activate
    end
  end
end

I'm just wondering if it is possible to enable switching it again by a script call or if a certain switch is on.

thanks in advance!
# Disallows changing formation of first actor #
# Plug n Play #
class Scene_Menu < Scene_MenuBase
  alias csca_snippets_on_formation_ok on_formation_ok
  def on_formation_ok
    if @status_window.index == 1 && $game_switches(1) == true #Edit this switch to a dedicated switch number for your game!
      Sound.play_buzzer
      @status_window.activate
    else

      csca_snippets_on_formation_ok
    end
  end
end

You can turn this script on by setting the switch noted above to on (true).

Let me know if this works, although I'm pretty sure it will.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


You don't need to add == true for switches. Also, it should be $game_switches[1], not $game_switches(1)


The above would DISABLE the leader if switch 1 is on.
Ah...

Thank you for the edits.

I'm not able to verify the syntax right now.

And thanks for pointing out you don't need the == true part.

I didn't know that one.

🙂

So...

# Disallows changing formation of first actor # while the noted switch is on
# Plug n Play #
class Scene_Menu < Scene_MenuBase
  alias csca_snippets_on_formation_ok on_formation_ok
  def on_formation_ok
    if @status_window.index == 0 && $game_switches[1]  #Edit this switch to a dedicated switch number for your game!
      Sound.play_buzzer
      @status_window.activate
    else

      csca_snippets_on_formation_ok
    end
  end
end

Shaz: Please let me know if I did this incorrectly, as this is a learning exercise for me at this point.

Thank you
It LOOKS okay to me. I haven't tested it but those two things jumped out.
I'll test it myself when I get a chance.

Thanks for the debug help tho.
wow!

it really works!

you guys are really awesome!

thanks! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/disable-enable-party-leader-by-switch.33946/