The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on December 28, 2008, 02:25:45 AM

Title: Editable Actor Options
Post by: modern algebra on December 28, 2008, 02:25:45 AM
Editable Actor Options
Version: 1.0
Author: modern algebra
Date: December 27, 2008

Version History




Description



This script allows you to change the actor options of Two Swords Style, Fix Equipment, Auto Battle, Super Guard, Pharmacology, and Critical Bonus in game, so that actors can learn these special feats in-game instead of either having them at the start of the game or not at all

Features


Screenshots

Not useful

Instructions

   Paste this script above Main and below Materials in the Script Editor.
  To change the actor options in game, merely use a call script and write this code:

         change_actor_options (actor ID, option ID, value)

  where: actor ID - the ID of the actor whose options you want to change
         option ID - the ID of the option you want to change, as follows -
           0 => Two Swords Style
           1 => Fix Equipment
           2 => Auto Battle
           3 => Super Guard
           4 => Pharmacology
           5 => Critical Bonus
         value - true or false; whether you want the actor to have the  ability or not. So true means the actor will
                      have the ability and false will mean the actor will not have the ability. If you leave value empty, it will
                      toggle the ability - if it's on, it will turn off - if it's off it will turn on.

 Examples:

  change_actor_options (1, 2, true)  ## Actor 1 - Auto Battle Turned ON
  change_actor_options (6, 0, false) ## Actor 6 - Two Swords Style turned OFF
  change_actor_options (3, 4)        ## Actor 3 - Phamacology toggled

Script




#==============================================================================
#  Editable Actor Options
#  Version: 1.0
#  Author: modern algebra (rmrk.net)
#  Date: December 27, 2008
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This script allows you to change the actor options of Two Swords Style,
#   Fix Equipment, Auto Battle, Super Guard, Pharmacology, and Critical Bonus
#   in game, so that actors can learn these special feats in-game instead of
#   either having them at the start of the game or not at all
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Paste this script above Main and below Materials in the Script Editor.
#   To change the actor options in game, merely use a call script and write
#   this code:
#
#          change_actor_options (actor ID, option ID, value)
#
#   where: actor ID - the ID of the actor whose options you want to change
#          option ID - the ID of the option you want to change, as follows -
#            0 => Two Swords Style
#            1 => Fix Equipment
#            2 => Auto Battle
#            3 => Super Guard
#            4 => Pharmacology
#            5 => Critical Bonus
#          value - true or false; whether you want the actor to have the
#            ability or not. So true means the actor will have the ability and
#            false will mean the actor will not have the ability. If you leave
#            value empty, it will toggle the ability - if it's on, it will turn
#            off - if it's off it will turn on.
#
#  Examples:
#
#   change_actor_options (1, 2, true)  ## Actor 1 - Auto Battle Turned ON
#   change_actor_options (6, 0, false) ## Actor 6 - Two Swords Style turned OFF
#   change_actor_options (3, 4)        ## Actor 3 - Phamacology toggled
#==============================================================================

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    methods overwritten - two_swords_style, fix_equipment, auto_battle,
#                       super_guard, pharmacology
#    methods aliased - setup, cri
#    new instance variables - two_swords_style, fix_equipment, auto_battle,
#                       super_guard, pharmacology, critical_bonus
#==============================================================================

class Game_Actor
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Public Instance Variables
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 attr_accessor :two_swords_style
 attr_accessor :fix_equipment
 attr_accessor :auto_battle
 attr_accessor :super_guard
 attr_accessor :pharmacology
 attr_accessor :critical_bonus
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Setup
 #    actor_id : the ID of the actor being set up
 #``````````````````````````````````````````````````````````````````````````
 #  Initialize instance variables
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias modalg_strfyre_stup_actr_edt_options_93n5 setup
 def setup (actor_id)
   # Run Original Method
   modalg_strfyre_stup_actr_edt_options_93n5 (actor_id)
   # Initialize new instance variables
   @two_swords_style = actor.two_swords_style
   @fix_equipment = actor.fix_equipment
   @auto_battle = actor.auto_battle
   @super_guard = actor.super_guard
   @pharmacology = actor.pharmacology
   @critical_bonus = actor.critical_bonus
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Get Critical Ratio
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias modalg_strfyr_edt_actr_opt_crit_84nbd cri
 def cri
   # Run Original Method
   n = modalg_strfyr_edt_actr_opt_crit_84nbd
   n -= 4 if actor.critical_bonus
   n += 4 if @critical_bonus
   return n
 end
end

#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - change_actor_options
#==============================================================================

class Game_Interpreter
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Change Actor Options
 #    actor_id  : the ID of the actor to perform the operation on
 #    option_id : the ID of option to change
 #    value     : value to set that option to
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def change_actor_options (actor_id, option_id, value = -1)
   # Get Actor
   actor = $game_actors[actor_id]
   # Set option by ID. If no value specified, toggle option
   case option_id
   when 0 # Two Swords Style
      actor.change_equip (1, nil) if value != actor.two_swords_style
     actor.two_swords_style = value == -1 ? !actor.two_swords_style : value
   when 1 # Fix Equipment
     actor.fix_equipment = value == -1 ? !actor.fix_equipment : value
   when 2 # Auto Battle
     actor.auto_battle = value == -1 ? !actor.auto_battle : value
   when 3 # Super Guard
     actor.super_guard = value == -1 ? !actor.super_guard : value
   when 4 # Pharmacology
     actor.pharmacology = value == -1 ? !actor.pharmacology : value
   when 5 # Critical Bonus
     actor.critical_bonus = value == -1 ? !actor.critical_bonus : value
   end
 end
end


Credit




Thanks


Support



Please post in this topic for the swiftest response. I will provide any bug support, and if you have any suggestions to improve this script, I will certainly listen to them even if I do not act upon them.

Known Compatibility Issues

No known compatibility issues, though a script that changes how critical bonuses are calculated will interfere with this script.

Demo



No Demo necessary



Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Editable Actor Options
Post by: Grafikal on December 28, 2008, 03:25:49 AM
rofl

QuoteDescription


<Describe the script. Say what it does and what purpose it serves>

I like this. I saw Star's request, you really pounded this out really fast. Nice work :D
Title: Re: Editable Actor Options
Post by: modern algebra on December 28, 2008, 04:01:31 AM
 :mad: Fixed.

Yeah, it was a very easy script to write.
Title: Re: Editable Actor Options
Post by: Kebin on December 28, 2008, 05:14:37 AM
This is awesome. Thanks and great work. :)
Title: Re: Editable Actor Options
Post by: Raiden on January 21, 2009, 01:16:52 AM
Whats script for how you choose your name?
If you don't mind me asking,  ;)
Thanks,
-Raiden
Title: Re: Editable Actor Options
Post by: modern algebra on January 21, 2009, 04:08:05 AM
What are you talking about? What has that to do with this topic?

It sounds like you're asking how to get a player choose their own name, in which case you don't need a script, you just need to look at your event command list and see that there is a command on the third page that does exactly that.
Title: Re: Editable Actor Options
Post by: Raiden on January 21, 2009, 05:20:33 AM
Quote from: Modern Algebra on January 21, 2009, 04:08:05 AM
What are you talking about? What has that to do with this topic?

It sounds like you're asking how to get a player choose their own name, in which case you don't need a script, you just need to look at your event command list and see that there is a command on the third page that does exactly that.
Sorry for being in the wrong place, just this Topic made me think about it :p
Thank you.