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,468
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,468
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 Posts

Latest Profile Posts

Finally working actively on Tundra! I'd like to share my wife's WIP art for the starting map and a rough draft of one of the later characters, Katrina. She's very eager to hear any feedback you might have!1623790662347.png
Got my first vax today, arm is a bit numb, but nothing odd so far. :kaopride:
dYOm9IY.jpg
image_2021-06-15_212613.png
Looks a bit.....kid friendly. Then again, I suppose that does with with a lot of retro themes... Crap, already spotted a flaw xD
What a stupid week so far! I was really short on sleep yesterday thanks to my back hurting and not falling asleep fast enough, now today I am 2 hours late for work because my damn alarm clock changed from the alarm setting, to the radio setting which I always keep muted.
I introduced "booby trap" as another indirect way to fight supernatural threats in the game.
But, some of my players are using it to blow up random citizens on the street.
Not sure how "creative" they can go with it. :kaojoy:

Forum statistics

Threads
112,264
Messages
1,066,923
Members
145,878
Latest member
UnitedStars111
Top