The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on March 13, 2011, 08:58:52 PM

Title: Manual Leader Control
Post by: modern algebra on March 13, 2011, 08:58:52 PM
Manual Leader Control
Version: 1.0
Author: modern algebra
Date: March 13, 2011

Version History



Description


This script allows you to override the default fact that the lead actor in the party is the one shown on the map and instead control it by setting an in-game variable to the ID of the actor you want. This makes it useful for games where you either don't want the main character to be in battles or where you have a party organization screen and always want the main character showing.

Features


Instructions

Paste this script into its own slot in the script editor, above Main but below Materials. For instructions on use, see the header.

Script


Code: [Select]
#==============================================================================
#    Manual Leader Control
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: March 13, 2011
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to override the default fact that the lead actor in
#   the party is the one shown on the map and instead control it by setting an
#   in-game variable to the ID of the actor you want. This makes it useful for
#   games where you either don't want the main character to be in battles or
#   where you have a party organization screen and always want the main
#   character showing.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot above Main and below Materials in the
#   script editor.
#
#    To set which in-game variable controls this script, simply go down to line
#   32 and change it to the ID of the variable you want. By default, it is 1,
#   which means that changing the value of the first in-game variable will
#   change which actor is shown. If the variable's value is 0 or does not refer
#   to an existing actor, then it will go back to the default of showing the
#   lead actor.
#==============================================================================

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LEAD_CHARACTER_VAR_ID = 1 # For description, see instructions at line 21.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////
 
#==============================================================================
# ** Game Player
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - refresh
#==============================================================================

class Game_Player
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias marvx52_mnldr_refrs_4gb7 refresh
  def refresh (*args, &block)
    actor = $game_actors[$game_variables[LEAD_CHARACTER_VAR_ID]]
    if actor.nil?
      marvx52_mnldr_refrs_4gb7 (*args, &block)
    else
      @character_name = actor.character_name
      @character_index = actor.character_index
    end
  end
end

#==============================================================================
# ** Game Variables
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - []=
#==============================================================================

class Game_Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias marv52_manlead_setvar_6tc2 []=
  def []=(variable_id, *args)
    marv52_manlead_setvar_6tc2 (variable_id, *args)
    $game_player.refresh if variable_id == LEAD_CHARACTER_VAR_ID
  end
end

Credit



Thanks


Support


Please post in this topic at RMRK.net if you encounter any problems with this script or have any suggestions for improvement.

Known Compatibility Issues

No currently known compatibility issues, though it won't work well with Caterpillar scripts. If you put it below the caterpillar, then this script will still work, but I would assume that it won't show the first actor in the party as a follower. It will also override scripts like No Zombie Leaders if placed under it.
Title: Re: Manual Leader Control
Post by: Infinate X on March 14, 2011, 01:42:04 AM
Thank you SOOOOO much for making this for me!!!!!! Here's something that looks like pac-man with the flu (for ur troubles):  :V

EDIT: I forgot to ask before but is it alright if I post this on another website and credit you for making it for me and I also made a crappy demo for when I was testing. Do you want it?

EDIT2: Lol next comment is by someone wholikes pac-man a lot (probably) and I put a pac-man ^ up there ;D
Title: Re: Manual Leader Control
Post by: pacdiggity on March 14, 2011, 05:47:29 AM
I am Pac-man with the flu!
This is actually a very good idea for inactive actors. And I suppose that you could recreate the No Zombie Leaders with this script, by placing a parellel process common event that says that if the first actor is unconious or dead you change the variable so that it doesn't display him/her anymore. I could explain that more in-depth, if you want, but that's probably not nessacery.
How long did it take to script this, MA?
Title: Re: Manual Leader Control
Post by: modern algebra on March 14, 2011, 10:48:10 PM
10 minutes, + 15 to add all the instructions and comments.
Title: Re: Manual Leader Control
Post by: Infinate X on April 09, 2011, 03:05:50 AM
i don't want the topic to die...
Title: Re: Manual Leader Control
Post by: modern algebra on April 09, 2011, 01:43:11 PM
Script topics never die.
Title: Re: Manual Leader Control
Post by: Infinate X on April 10, 2011, 02:01:25 AM
After 60 days most people wont reply because of the necropost warning and I didn't want that to happen to this awesome new script
Title: Re: Manual Leader Control
Post by: pacdiggity on April 10, 2011, 02:08:17 AM
He means that you can post in script threads whenever, regardless of last post. People won't (and don't) refrain from posting in them. The same applies for recourse threads.
However, you might get yelled at if you have nothing important to say. If you say "dis script is relly good gaiz." after 2 years, people get mad.
Also, can you please make your sig smaller?
Title: Re: Manual Leader Control
Post by: Infinate X on April 10, 2011, 02:17:27 AM
He means that you can post in script threads whenever, regardless of last post. People won't (and don't) refrain from posting in them. The same applies for recourse threads.
However, you might get yelled at if you have nothing important to say. If you say "dis script is relly good gaiz." after 2 years, people get mad.
Also, can you please make your sig smaller?

You can't get banned for necroposting? Well sorry for my sig but I can make the dog smaller.
Title: Re: Manual Leader Control
Post by: hiromu656 on April 10, 2011, 02:32:05 AM
Is there a way to activate and deactivate the script?
Title: Re: Manual Leader Control
Post by: modern algebra on April 10, 2011, 02:33:00 AM
Yeah, you set the variable to 0.
Title: Re: Manual Leader Control
Post by: Infinate X on April 10, 2011, 03:05:10 AM
I just remembered something!!!!!!!!


If you don't want the actor graphics to start as Party Member 1, is the only possibility to add the actors to your party after the variable is set? What that would do is make the illusion of your character being invisible for the first second of the game in which case not as many people would acknowledge it. (I couldn't remember how to spell acknowledge  :-[)
Title: Re: Manual Leader Control
Post by: modern algebra on April 10, 2011, 03:54:05 AM
That's how you spell it. And a parallel process in the very first map should take care of it before you see the screen even for a second I would think. If not, then another option would be just to make the first actor in the party be the actor you want to lead, and then remove that actor from the party as soon as you set the variable. That way there wouldn't be any dissonance and it would be quick enough that the player could never visit the menu and see the fake actor there.
Title: Re: Manual Leader Control
Post by: Infinate X on April 15, 2011, 11:15:51 PM
i didn't think of that! Thanks for your help!


EDIT: It's been exactley 1 month...   :D