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,452
Reaction score
14,815
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,452
Reaction score
14,815
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

image_2021-06-13_213812.png

Todays Lesson: Tiles are a pain to make xD
The game is not even 2% complete, but i just wanted to release something for funsies. :)
It's on my google drive.
It would be awesome if i could get a couple ideas and the like!
So yesterday Dad took me to Volcano Bay, and it was almost ruined by a thunderstorm... then it passed by and the lightning warning got lifted, leading to an awesome time sliding and swimming. Hopefully we get to go to the arcade tonight. The one we're planning on has a restaurant built in with AWESOME food. Not to mention how big the arcade itself is!
image_2021-06-13_150033.png

Maybe I'll actually try making a retro pack. Already have the shark fin made so why not xD
Hey everyone, for everybody following along with my RPG Maker MZ streams: There will unfortunately not be a stream tonight. There is a big exciting event that will go live next week that has been taking all my time, so look forward to that!

Forum statistics

Threads
112,201
Messages
1,066,540
Members
145,809
Latest member
StShiner
Top