disable\enable party leader by switch

Tobiasu

Wizman
Member
Joined
Aug 10, 2014
Messages
13
Reaction score
5
First Language
English
Primarily Uses
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!
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
821
Reaction score
368
First Language
English
Primarily Uses
N/A
# 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.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,463
Reaction score
14,816
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
821
Reaction score
368
First Language
English
Primarily Uses
N/A
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
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,463
Reaction score
14,816
First Language
English
Primarily Uses
RMMV
It LOOKS okay to me. I haven't tested it but those two things jumped out.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
821
Reaction score
368
First Language
English
Primarily Uses
N/A
I'll test it myself when I get a chance.

Thanks for the debug help tho.
 

Tobiasu

Wizman
Member
Joined
Aug 10, 2014
Messages
13
Reaction score
5
First Language
English
Primarily Uses
wow!

it really works!

you guys are really awesome!

thanks! :)
 

Latest Threads

Latest Profile Posts

It's almost 3 month and this piece of drawing is still not finished yet.
aaaa.jpg

Really busy with other stuffs like commission and coping with personal problem.
Stella & Elyune, maybe used for promotional art if my game project finished one day.
My ex put my heart upon a self he said don't give me no lines and keep my hands to myself :,(
An Old... old Harold | RPG Maker News #71

Did a test on myself and I was negative on COVID. I was sitting near my aunt the whole time while doing stuff.

Forum statistics

Threads
112,243
Messages
1,066,802
Members
145,855
Latest member
Anvi
Top