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
815
Reaction score
361
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,101
Reaction score
14,635
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
815
Reaction score
361
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,101
Reaction score
14,635
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
815
Reaction score
361
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

Daz3D has the weirdest number scheme for model generations...
Genesis 4 is the 4th generation and oldest currently available, Genesis 1 is the 5th generation, Genesis 2 is the 6th, 3 is the 7th.... And then it goes Genesis 8. So 4, 1, 2, 3, 8. So when looking through there store you have to remember that sometimes they'll say 6 but they mean 3, and vice versa. :kaoswt:
Would opening a topic with the tutorial be interesting?

Forum statistics

Threads
111,115
Messages
1,058,404
Members
144,332
Latest member
SpringJoker6068
Top