This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
INTRODUCTION
This script uses switches, states and variables to alter the actor's graphics. This includes a way to change actor's opacity, creating an invisibility effect; Actor-specific switches, which (when ON) changes different actor's into different forms. Global switches, which change the entire party into a specified form. State induced alteration of graphics. And a method for use of changing actor graphic dependent upon a variable's value. This can be used for an aging system, wherein, as the variable rises, the actor begins to look older or a power-up (almost like Altered Beast), when the variable rises, the actor's develop a more deadly appearance.
FEATURES
graphic changes based on switches
graphic changes based on actor-specific switches
graphic changes based on variable
graphic changes based on state
opacity of actor based on switch and constant
SCREENSHOTS
"Images"
Above, the normal graphics of actors
The actor in "DEAD" state
Altered by global switch
'Invisible'
The actors getting old.
HOW TO USE
This script can be plug and play. However, you'll want to read through the instructions to set up the script to better suit the project you're creating.
Just put the script in the script editor, above main and below materials. Then read through the instructions to better understand them. Please note that
specific graphics alterations have priority over others. The invisibility has priority over all other changes. States have priority over actor-specific switches. Actor-specific switches have priority over global switches. global switches hold priority over variable alteration. If you follow directions, the script shouldn't give you much trouble, but again, you'll need to set it up so it best fits your needs.
################################################################################
# SYSTEM SHAPESHIFT
# By: IXFURU
# 8/20/12
#
################################################################################
# This script allows you to exchange actor graphic in
# the event of states or game switches. In other words, if an actor is under
# a specific state, his/her graphic changes. Likewise if a switch is on.
# This will be good if you want an image to display say when the actor is dead,
# or when they use some sort of shapeshift.
# The script has also been adapted to use an aging system, wherein, a game
# variable of your choice can be used to manipulate the base form of actors.
# Though this is recognized by this script as the "AGE_VARIABLE", it DOES NOT
# keep time, nor is it restrained in that capacity. It may be of use, however,
# in a time system, where a variable displays and tracks years.
################################################################################
# :INSTRUCTIONS:
# This script is not noob friendly at all. Though, I suppose it could be
# plug n play, for better results, you'll need to read through the scripts comments
# carefully and adjust the constants in the module in order to fit your needs.
# Place the script above main and below materials in the script editor. Only
# one method is aliased in this script, so it should be compatible with other
# scripts. At the least, you must set up an ACTOR BASE for every actor to be
# effected.
################################################################################
# A note on the system:
# To understand the way the script works, it's imperative to know the heiarchy
# of the system. In that certain factors take precendence over others. The
# following should help explain.
#
# The invisibility switch takes priority over all and effects all, regardless of id.
# States take precedence over switches,
# Switches take precendence over the age variable.
################################################################################
################################################################################
# SPECIAL THANKS:
# HungrySnake and ???noBody???
# for their insight into $game_actor iteration and
# changing character's opacity.
################################################################################
# ::::CREDITS::::
# Feel free to use this in your non-commercial project. You have the right to
# modify it as you see fit, but don't claim you've produced and or written the
# contents herein. Please don't post the script in other forum Script Submission
# sections, without first contacting me via RPGMakerVX.net at The Finish Line
# forum, or by way of PM either there or on RMRK.net. If you wish to use the
# script commercially, please contact me and we'll discuss it. I will need at
# least a copy of the project.
# ENJOY!
################################################################################
module ISSS
#This first value refers to how many actors in the database should be used in
# the system. Make sure you set the actors effected at the top of the database
# actors list. This allows you to create actors who are not effected by the
# Shapeshift. If you set this value to 6, then the first 6 actors from the
# database will be effected by the system. Those later in the list will
# be ignored.
ACTORS_TO_EFFECT = 4
#Switch Range is used to evaluate switches and makes it possible to iterate
# a given number of switches, rather than ALL the switches in the game. Here,
# you will decide the low and high of that range. Any switches with ids
# including and in between the the range low and high will be used in the
# iteration. For incomplete prjoects, it's recommended that you give yourself
# ample room for future switch applications. Be sure to set the switches
# in the other parts of th script to switches with ids between these two
# constants.
SWITCH_RANGE_LO = 1
SWITCH_RANGE_HI = 10
# The next constant allows you to set a switch which will be defined as the
# invisibility switch. When this switch is on, the character will become
# 'invisible'. Just how invisible the character will become will be modified
# in the following constant, which is for opacity. You must set it between
# 0 and 255.
INVISIBLE_SWITCH = 1
INVISIBLE_OPACITY = 125
# The next part is a boolean, a variable and then a hash. If you set the boolean
#"USE_AGING", The character will turn back into a different form depending on
# the value of the variable. This way, you can have the variable track years,
# and then change them back into graphics dependent upon the value of the
# said variable.
USE_AGING = true
AGE_VARIABLE = 1
# Here, the double hash is set up like this:
# actor_id => age_variable= [graphic, index, face, index]
# In this hash, replace actor_id with the id of the actor in the database.
# Replace age_value with the value of the AGE_VARIABLE used to determine when
# the change is necessary. Replace graphic and face with character and face
# graphics you wish to use, and index with the corresponding sheet index for the
# graphics chosen. Keep in mind, for one actor, you can have several different
# variations.
AGING_BASES = { #<<<<Don't delete this!!
#################PLEASE READ IF YOU ARE USING THE AGING SYSTEM################
# If you are using the aging system, it is important to know the comparitive
# manner in which the system operates. The variable AGING_VARIABLE is used in
# all comparisons against the the key values of the inner hash.
# Step one, checks to see if the variable is below the first value. If so, it
# uses the ACTOR_BASE constant to change the character and face of the actor.
# if this is not the case, it takes the variable and compares the first key
# value with the second. If the variable is greater than the first value, but
# less than the second, it will change the character in correspondence to the
# first value. If it's greater than or equal to the second, it advances to the
# third and compares the 2nd and 3rd values. In this way, it proceeds, until
# it decides where the value lies. The only place where this is not true is the
# final key value in the hash. In the final key, it only compares to see if the
# variable is greater than the value given.
# Take the following example:
# 6 => {11 => ['People1', 3, 'People1', 3]
# 16 => ['People1', 6, 'People1', 6]
# 40 => ['People3', 2, 'People3', 2]}
# In the above example, actor number 6 in the database would change into 'People1',
# 3 when only when the variable is greater than or equal to 11. It would only
# use 'People1, 6, if the variable was greater than or equal to 16, but less than
# 40. In this equation, once the variable reached 40, it would change to 'People3,
# 2, when the variable was above 40.
################################################################################
# Next, set up the original character and face for
# the actors. So they can be turned back from there graphics into their
# original form when the state or switch no longer has effect. If you are
# using aging, the graphics found here will only be used if the aging variable
# has not yet reached the first key value of the AGING_BASES inner hash.
# Use:
# actor_id = [graphic, index, face, index]
# Wherein, the actor_id is replaced with the id from the database of the given
# actor. Graphic is set to the graphic file you wish to use, and index for the
# character index in the given sheet. If you are using individual character
# sheets, just use 0 for the index.
# To set up the hash below, use:
# state_id => [graphic, index, face, index]
# Replace state_id with the database id of the state. Replace graphic with the
# graphic file you want to use, and index to the character index of the file.
# Do the same with the face. Again, if you're using individual character sheets,
# use 0 as the index. This is universal for ALL actors. The higher id of State
# holds precedence over lower database id states. Therefor, if you want the
# incapacitated (dead) default state to hold precedence, you should copy and
# paste it below all other states in the database.
STATE_GRAPHICS = { #<<<<Don't touch this!!!
1 => ['Monster', 1, 'Monster', 1]
} #<<<< Don't delete this!!
#Another hash, sets up switches to control the appearance of the actors. When
# the switches set here are on, the actors are turned into the graphics and faces
# in the array, (set up like above). This is universal for ALL actors. Setup is
# as follows:
# switch_id => [graphic, index, face, index]
SWITCH_GRAPHICS = {#<<<<Don't delete this!!!
2 => ['Evil', 2, 'Evil', 2],
3 => ['Evil', 3, 'Evil', 3],
}#<<<< Don't delete this
# The last double hash, sets up actor-specific switches. When switch is on, it has a
# different effect on individual actors. Set up is as follows:
# switch_id => {actor_id => [graphic, index, face, index]}
ACTOR_SWITCHES = { #<<<< Don't delete this!!!
4 => {1 => ['People4', 0, 'People4', 0],
2 => ['People4', 1, 'People4', 1]},
5 => {1 => ['Evil', 7, 'Evil', 7],
2 => ['Spiritual', 6, 'Spiritual', 6]}
} #<<<<<Don't delete this!!!
################################################################################
# !!!IF YOU EDIT BELOW HERE, YOU RISK SCREWING THINGS UP!!!!
################################################################################
end
#===============================================================================
# GAME CHARACTER
#===============================================================================
class Game_Character
attr_writer :opacity # make opacity accessible
end
#===============================================================================
# GAME ACTOR
#===============================================================================
class Game_Actor < Game_Battler
include ISSS
alias isss_ga_setup setup unless $@ #alias the setup method
def setup(actor_id)
isss_ga_setup(actor_id) #call the original method
@actor_base = [] #create array
@change_switches = []
@change_states = []
get_actor_base #call new method
get_change_switches
get_change_states
end
#-----------------------------------------------------------------------------
# GET ACTOR BASE
#-----------------------------------------------------------------------------
def get_actor_base
if @actor_id <= ACTORS_TO_EFFECT #if actor is among those effected
if ACTOR_BASE.has_key?(@actor_id) #is actor's id a key in the hash
@actor_base = ACTOR_BASE[@actor_id] # set actor's base graphic
end
end
end
#-----------------------------------------------------------------------------
# GET CHANGE SWITCHES
#-----------------------------------------------------------------------------
def get_change_switches
if @actor_id <= ACTORS_TO_EFFECT #if actor is among those effected
for switch in SWITCH_RANGE_LO..SWITCH_RANGE_HI # once for every switch in range
if SWITCH_GRAPHICS.has_key?(switch) # if switch id is a hash key
@change_switches.push(switch) #place switch in array
end
if ACTOR_SWITCHES.has_key?(switch) #is switch's id a key in the hash
if ACTOR_SWITCHES[switch].has_key?(@actor_id) #is actor's id a key in the inner hash
@change_switches.push(switch) #place switch in array
end
end
end
end
end
#-----------------------------------------------------------------------------
# GET CHANGE STATES
#-----------------------------------------------------------------------------
def get_change_states
if @actor_id <= ACTORS_TO_EFFECT #is actor among those effected
for state in STATE_GRAPHICS.keys #for every key in hash
@change_states.push(state) #place state in array
end
end
end
#-----------------------------------------------------------------------------
# UPDATE GRAPHIC CHANGES
#-----------------------------------------------------------------------------
def update_graphic_changes
@shifted = false
if @actor_id <= ACTORS_TO_EFFECT #is actor among those effected
if $game_party.members.include?($game_actors[@actor_id]) #is actor in the party
invisible = INVISIBLE_SWITCH #set local variable to constant
invisible_opacity = INVISIBLE_OPACITY #set local variable to constant
if $game_switches[invisible] == true #is invisible switch on
$game_party.members.include?($game_actors[@actor_id]) # is actor in the party
$game_player.opacity = invisible_opacity #change opacity to variable
else
$game_party.members.include?($game_actors[@actor_id])
$game_player.opacity = 255
end
if USE_AGING == true
age_var = $game_variables[AGE_VARIABLE] #set local variable to constant
if AGING_BASES.has_key?(@actor_id) #is actor's id found in hash keys
year = AGING_BASES[@actor_id].keys
for i in year
if age_var >= i # is age variable greater than the array element
age = AGING_BASES[@actor_id] #create local array
set_graphic(age[i][0], age[i][1], age[i][2], age[i][3]) #set graphic to array elements
@shifted = true
end
end
end
end
unless @change_switches.empty?
for switch in @change_switches #once for every switch in the array
if $game_switches[switch] == true # is the array switch is on
if SWITCH_GRAPHICS.has_key?(switch) # is the switch id found in hash keys
grafx = SWITCH_GRAPHICS[switch] # set local variable to hash and key
set_graphic(grafx[0], grafx[1], grafx[2], grafx[3]) # set graphic to hash key
@shifted = true
else
grafx = ACTOR_SWITCHES[switch] # set local variable to hash and key
#set graphic to hash key
set_graphic(grafx[@actor_id][0], grafx[@actor_id][1], grafx[@actor_id][2], grafx[@actor_id][3])
@shifted = true
end
end
end
end
unless @change_states.empty?
for state in @change_states #once for every state in the array
if @states.include?(state) # does actor have state
gfx = STATE_GRAPHICS[state] # set local variable to hash and key
set_graphic(gfx[0], gfx[1], gfx[2], gfx[3]) # set graphic to hash key
@shifted = true
end
end
end
check_actor_base(@shifted)
end
end
end
#-----------------------------------------------------------------------------
# CHECK ACTOR BASE
#-----------------------------------------------------------------------------
def check_actor_base(shifted)
if shifted == false
base = ACTOR_BASE[@actor_id]
set_graphic(base[0], base[1], base[2], base[3])
end
end
end
#===============================================================================
# SCENE_MAP
#===============================================================================
class Scene_Map < Scene_Base
include ISSS
alias isss_sm_update update
def update
isss_sm_update
update_sss
end
#-----------------------------------------------------------------------------
# UPDATE SSS
#-----------------------------------------------------------------------------
def update_sss
for actor in $game_party.members
actor.update_graphic_changes
$game_player.refresh
end
end
end
#===============================================================================
# SCENE_MENU
#===============================================================================
class Scene_Menu < Scene_Base
alias isss_smenu_update update unless $@
def update
isss_smenu_update
for actor in $game_party.members
actor.update_graphic_changes
$game_player.refresh
end
end
end
#===============================================================================
# WINDOW_MENU_STATUS
#===============================================================================
class Window_MenuStatus < Window_Selectable
alias isss_wms_refresh refresh unless $@
def refresh
isss_wms_refresh
for actor in $game_party.members
actor.update_graphic_changes
$game_player.refresh
end
end
end
PATCHES
Though the script works well with [url=http://"http://www.rpgmakervx.net/index.php?showtopic=2926&st=0&p=34022&#entry34022"]Trickster's Caterpillar[/url], I noticed that the 'invisibility' portion of the script did not. So I took the liberty of making a patch for it. You'll find it below:
#===============================================================================
# GAME PARTY
#===============================================================================
class Game_Party
include ISSS
alias isss_gp_update_followers update_followers unless $@
def update_followers
isss_gp_update_followers
if $game_player.opacity < 255
@followers.each do |x|
x.opacity = $game_player.opacity
end
end
end
end
FAQ Q For some reason, I'm not getting a change in graphic, even though I've set up the actor's graphics in the module...How to fix it? A Make sure you set the 'ACTORS_TO_EFFECT' constant in the module to a value which will include the actor you're trying to change. I made this constant so that you could make actors who wouldn't be
effected by the script, as long their ids were out of range.
Q The switch is on, but no change was made to my actor's graphic. What gives? A Much like the actor ids, I set the switches up so that all switches ids used in the script would be found in a specific range. Check the constants 'SWITCH_RANGE_LO' and 'SWITCH_RANGE_HI', and make sure the switch you are trying to use has an id which falls somewhere between the two.
CREDIT AND THANKS
Credit me if you use this script. Also, you may use it in non-commerical projects as long as you want, just the credit is good enough. For commercial project, let me know. I'm sure I won't have a problem with it, as long as credit is given, and you give me a copy of the finished project.
EXTRA SPECIAL THANKS
I must take a moment to thank both ???noBody??? and HungrySnake. They've been crucial to my finishing this script.
AUTHORS NOTES
If you have any problem with this script, please post in the topic. If no response, post in [url=http://"http://www.rpgmakervx.net/index.php?showforum=94"]THE FINISH LINE FORUM[/url]. If no response, PM me. If still no response, I may have died or said to hell with it. But I'm probably just sleeping.