I had a request up on RPGRevolution for a bit, and wasn't able to get anywhere with it. So after doing some more searching I came across what seemed to be exactly what I was looking for. However, there are some things it doesn't do, that I need it to do for my project.
I need this script by Syvkal: http://houseslasher.com/index.php?showtopic=100 (http://houseslasher.com/index.php?showtopic=100) to have two things added to it:
1) Grey out the item's name in Status and Equip Menus (not absolutely necessary, but would be appreciated).
2) Use a "script call" feature, so items may be fixed and un-fixed(so to speak) on a whim.
I haven't found this script anywhere else, nor have I been able to contact Syvkal, and his topic regarding this script was made nearly a year ago. Any help whatsoever will be greatly appreciated!
EDIT: Solved for hopefully the final time. ;D
-Heart of Shadow-
hrm, OK. I'll take a look, though I usually dislike looking at other people's scripts simply because there's a bit of a learning curve to figure out what they're doing.
EDIT::
Your 2nd request is already available. Just use:
$game_actors[actor_id].equip_fix (equipment_index)
SO $game_actors[2].equip_fix (0) would fix the weapon of the second actor in the database.
This script doesn't look like it would work properly though ~ I am going to rewrite a part or two. Hopefully syvkal won't mind.
EDIT 2::
Ok, so it was a bigger modification than I thought it would be, but I retained naming conventions and syvkal's congifuration module, even though I wasn't a big fan. Anyway, here it is and it ought to work. I only incorporated the disabled text in the equip window rather than status because I didn't think it made sense there. I kept the way to lock equipment in game:
$game_actors[actor_id].equip_fix (equip_type) still. See EDIT 1 for an example.
#==============================================================================
# ** Individual Equipment Fix
#------------------------------------------------------------------------------
# By Syvkal (with some modifications by modern algebra @ rmrk.net)
# Version 1.5 (unofficial)
# 05-12-08
#==============================================================================
#
# This script allows you to lock any equipment on any actor individually
# The data is loaded when an actor is added to the party
# I built this in to make it easier for the user
#
# There is some configuration needed, but that comes further down the script
#
# Do not touch the next section, unless you know what you're doing
#
#
#=================================================#
# ** D O N O T T O U C H ** #
#=================================================#
module Equip_fix
$data_actors = load_data("Data/Actors.rvdata")
ACTORS_SIZE = $data_actors.size
ACTORS = []
for i in 0...ACTORS_SIZE
ACTORS.push([false, false, false, false, false])
end
def self.lock_equip(actor, index)
ACTORS[actor-1][index] = true
end
#=================================================#
#=================================================#
# ** C O N F I G U R A T I O N ** #
#=================================================#
#
# This is the part you can configure
#
# Simply follow the instructions to lock any of the actors equipement
#
# Use the 'lock_equip' command to lock any equipment:
#
# lock_equip(actor, equipment)
#
# The equipment is zero indexed. The values are as follow:
#
# 0 - Weapon | 3 - Body Armour
# 1 - Shield or Weapon 2 | 4 - Accessory
# 2 - Helmet
#
# So by putting:
#
# lock_equip(1, 0) - Will lock actor one's weapon
#
# Place your configurations Below
# -----------------------------
lock_equip (1, 0)
lock_equip (1, 2)
#=================================================#
end
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - setup, fix_equipment
# new method - equip_fix
# new public instance variable - fixed_equipment, spec_equip_fix
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :fixed_equipment
attr_accessor :spec_equip_fix
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Setup
# actor_id : the ID of the actor being loaded in this class
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_syvkal_indfix_equipment_setup_854n6 setup
def setup (actor_id)
# Run Original Method
modalg_syvkal_indfix_equipment_setup_854n6 (actor_id)
# Setup fixed equipment
@fixed_equipment = Equip_fix::ACTORS[actor_id - 1]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Fix Equipment
# equip_type : integer corresponding to equipment being tested
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_svkl_fx_equip_indiv_94b6 fix_equipment
def fix_equipment
return @spec_equip_fix == nil ? malg_svkl_fx_equip_indiv_94b6 : @spec_equip_fix
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Equip Fix
# equip_type : integer corresponding to equipment being tested
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def equip_fix (equip_type, value = nil)
# Toggle equipment fix
@fixed_equipment[equip_type] = value == nil ? !@fixed_equipment[equip_type] : value
return @fixed_equipment[equip_type]
end
end
#==============================================================================
# ** Window Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# modified super method - draw_item_name
# aliased method - refresh
#==============================================================================
class Window_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias molg_svkl_rfrsh_ind_fix_equip_984n6 refresh
def refresh
@draw_equip_count = 0
# Run Original Method
molg_svkl_rfrsh_ind_fix_equip_984n6
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Item Name
# item : Item (skill, weapon, armor are also possible)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_item_name (item, x, y, enabled = nil)
# Safety
@draw_equip_count = 0 if @draw_equip_count == nil
# If enabled flag actually sent through, retain it.
if enabled == nil
# Otherwise, send through whether or not this equip is fixed
enabled = !@actor.fixed_equipment[@draw_equip_count]
end
super (item, x, y, enabled)
@draw_equip_count += 1
end
end
#==============================================================================
# ** Scene_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - update_equip_selection
# new method - equip_fix
# new public instance variable - fixed_equipment
#==============================================================================
class Scene_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Equip Region Selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias molg_syvkal_eqp_select_upd_ind_85n67 update_equip_selection
def update_equip_selection
@actor.spec_equip_fix = @actor.fixed_equipment[@equip_window.index]
# Run Original Method
molg_syvkal_eqp_select_upd_ind_85n67
@actor.spec_equip_fix = nil
end
end
Wow, thanks a lot MA! I'll be testing it out to see if it all works today and will get back to ya should I run into any issues or something.
Thanks again for the quick response and help! ;D
EDIT: All right, the script itself works wonderfully(much thanks)... but I haven't found a way to "unlock" said equipment once I lock it via the script call. Did I miss something or is this not possible?
-Heart of Shadow-
It is intended to be possible. I built the method so that:
$game_actors[i].equip_fix (equip_type)
toggles whether or not the equipment is locked. So if it is unlocked, it will lock it. If it is locked, it will unlock it. Alternatively, if you want to set it specifically (AKA you aren't sure whether it is locked or not locked, you can send the value you want it to have with:
$game_actors[i].equip_fix (equip_type, x)
x is either true or false, where true means you want to lock it and false means you want to unlock it
I can't believe I didn't try the true/false way in the first place... lawl
Thanks again, MA! Got it all sorted out and everything works exactly how I need it. :)
-Heart of Shadow-
Apologies for the double post.. but I just ran into an odd issue.
When I call the script to lock an actor's equipment, it also locks that equipment for all the other actors in the party.
Example: Script called to lock actor 42's weapon. It does lock actor 42's weapon.. but it also locks actor 40 and 41's weapons as well(who are in the party as well).
I'm not sure if it's just this script or another one causing this.. but seeing as how this is the only one I have that deals with locking equipment, I'm guessing it's this one.
Any ideas? =/
-Heart of Shadow-
That is strange. You're using this code to lock his equipment?
$game_actors[42].equip_fix (0)
Quote from: Modern Algebra on February 25, 2009, 02:00:53 AM
That is strange. You're using this code to lock his equipment?
$game_actors[42].equip_fix (0)
Yep. Even copied it from there and tried it, seeing if maybe I did it wrong somehow on accident. Still locks all the other members' weapons too.
Strange indeed... :-\
Can you upload a test project for me? Just recreate the error in a new project if you aren't comfortable sharing your main project.
No problemo. I'll have it uploaded in a little bit. Will add it to this post once I do.
It's my actual project.. so I hope it's not too big. When you get it, I've setup the "dwarf" you start near to call the script to lock/unlock actor 42's weapon. Actor 42, by the way, is "Myrh".
-Heart of Shadow-
Hmm, before you do the work, try doing this:
Change this:
FIX = [false, false, false, false, false]
ACTORS = []
for i in 0...ACTORS_SIZE
ACTORS.push(FIX)
end
to:
ACTORS = []
for i in 0...ACTORS_SIZE
ACTORS.push([false, false, false, false, false])
end
I hadn't thought about it, but that might be the problem, maybe.
Hey, that makes it work properly! (for the time being =P)
Anyway, sorry I wasn't able to get back to ya yesterday.. some stuff came up. I was also just about to post and let you know that it happened in a totally blank project with just that script and you could check it out that way... but now there's no need. ;D
So, once again, this has been resolved. Much thanks, MA! :D
-Heart of Shadow-