10-11-2006, 01:00 PM
Morphing Script V1
by Nick
Oct 11 2006
Changelog:
Basically, this is a script to let any battler (actor, enemy) change their form to adjust HP, SP or any other stats.
It can even adjust the elemental effeciency, set immunities for magic and physic attacks, set the ability to do magic and physic attacks and everything you program it to. This script is designed for the easy of the game maker, although he/she should know some scripting to get the max out of this. I'll start off with the script in the spoiler. Please leave the little disclaimer
Please note that this is an early release of this script and may still contain bugs. If you find a bug, post here or send me a PM and i'll check it out. Note that im still working on this script and building improvements. I might stop supporting this script anytime i want.
Now, i've written some basic tutorials to help you understand this script and how to use it a bit.
Oh, here's a little snippet i used to test this script, just do a script call for "standard", "ghost" or "god" and the first character will change to that form. This is a simple script, to test, so screenshots and demo's arent needed at this time.
by Nick
Oct 11 2006
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.
No support is given. If you are the owner of the thread, please contact administration.
Changelog:
- November 4, 2006: Updated to version 1.04. Small bugfixes, form specific graphics and changing the form by skill. (request of sonica) Also added 2 tuts regarding this.
- October 29, 2006: Used ruby format instead of the normal code.
- October 11, 2006: Released first version.
Basically, this is a script to let any battler (actor, enemy) change their form to adjust HP, SP or any other stats.
It can even adjust the elemental effeciency, set immunities for magic and physic attacks, set the ability to do magic and physic attacks and everything you program it to. This script is designed for the easy of the game maker, although he/she should know some scripting to get the max out of this. I'll start off with the script in the spoiler. Please leave the little disclaimer
The Actual Script
Code:
#--------------------------------------------------------------------------
# Morphing Script V 1.04 by Nick.
# Credits to Pie and all people on Creation Asylum for being nice!
# This script is just a BASE, you need to expand/use it your own way!
# This script is free for all to use, i just want a little entry in the credits.
# This script might be used for reference and stuff without credit.
# Dont try to make cheap redo's of this script unless I approve.
# I have the right to make any adjustments to this script without notice.
# I might disallow you from using this in your game for reasons stated above.
# Copyright to myself and any game which might have given me the idea.
#--------------------------------------------------------------------------
# This contains all morphable forms, just follow the instructions.
module MorphList
# The standard form, just follow the examples
def self.standard(req = "form")
h = {}
# The name, just for reference
h["name"] = "Normal"
# Stat effects (percents)
h["maxhp"] = 100
h["maxsp"] = 100
h["str"] = 100
h["dex"] = 100
h["agi"] = 100
h["int"] = 100
h["atk"] = 100
h["pdef"] = 100
h["mdef"] = 100
# Immunities
h["physic_immune"] = false
h["magic_immune"] = false
# Abilities
h["physic_able"] = true
h["magic_able"] = true
# Elemental Efficieny
h["elef"] = {}
# If you want to add more, just do h["elef"][ELEMENT_NAME] = VALUE
# You dont have to fill in if the efficiency for the standard "C" value
# Status Efficieny
h["stef"] = {}
# Same goes here, just fill in stef instead of elef
if req == "hash"
return h
else
return Form.new(h)
end
end
# The ghost form, as example.
def self.ghost(req = "form")
# This imports the hash from standard to reduce amount of code.
h = standard("hash")
h["name"] = "Ghost"
h["maxsp"] = 150
h["mdef"] = 25
# Immunities
h["physic_immune"] = true
# Abilities
h["physic_able"] = false
# Elemental Efficieny
h["elef"]["vs Undead"] = "A"
if req == "hash"
return h
else
return Form.new(h)
end
end
# Godform, to test
def self.god(req = "form")
# This imports the hash from standard to reduce amount of code.
h = standard("hash")
h["name"] = "God"
# Stat effects (percents)
h["maxhp"] = 500
h["maxsp"] = 500
h["str"] = 500
h["dex"] = 500
h["agi"] = 500
h["int"] = 500
h["atk"] = 500
h["pdef"] = 500
h["mdef"] = 500
# Same goes here, just fill in stef instead of elef
if req == "hash"
return h
else
return Form.new(h)
end
end
end
# The class which contains the data of the form, which will be read back as actor.form
class Form
attr_reader :name
attr_reader :maxhp
attr_reader :maxsp
attr_reader :str
attr_reader :dex
attr_reader :agi
attr_reader :int
attr_reader :atk
attr_reader :pdef
attr_reader :mdef
attr_reader :physic_immune
attr_reader :magic_immune
attr_reader :physic_able
attr_reader :magic_able
attr_reader :elef
attr_reader :stef
attr_reader :autodesc
# Just the main initialize stuff
def initialize(h)
@name = h["name"].downcase
@autodesc = h["name"] + ":\n"
@maxhp = h["maxhp"]
@autodesc += "The maximum HP is changed to #{@maxhp} percent.\n" unless @maxhp == 100
@maxsp = h["maxsp"]
@autodesc += "The maximum SP is changed to #{@maxsp} percent.\n" unless @maxsp == 100
@str = h["str"]
@autodesc += "The strength is changed to #{@str} percent.\n" unless @str == 100
@dex = h["dex"]
@autodesc += "The dexterity is changed to #{@dex} percent.\n" unless @dex == 100
@agi = h["agi"]
@autodesc += "The agility is changed to #{@agi} percent.\n" unless @agi == 100
@int = h["int"]
@autodesc += "The intelligence is changed to #{@int} percent.\n" unless @int == 100
@atk = h["atk"]
@autodesc += "The attack is changed to #{@atk} percent.\n" unless @atk == 100
@pdef = h["pdef"]
@autodesc += "The physical defense is changed to #{@pdef} percent.\n" unless @pdef == 100
@mdef = h["mdef"]
@autodesc += "The magical defense is changed to #{@mdef} percent.\n" unless @mdef == 100
@physic_immune = h["physic_immune"]
@autodesc += "This form is immune to physical attacks.\n" unless @physic_immune == false
@magic_immune = h["magic_immune"]
@autodesc += "This form is immune to magical attacks.\n" unless @magic_immune == false
@physic_able = h["physic_able"]
@autodesc += "This form cannot use physical attacks.\n" unless @physic_able == true
@magic_able = h["magic_able"]
@autodesc += "This form cannot use magical attacks.\n" unless @magic_able == true
@elef = []
# First, enter all standard values of elemental efficiency
for i in 0...$data_system.elements.size
@elef[i] = 2
end
# Enter all altered values now.
for i in h["elef"]
n = ["A","B","C","D","E","F"].index(i[1])
n = 2 if n == nil
elem = 0
for e in 0...$data_system.elements.size
elem = e if $data_system.elements[e] == i[0]
end
next if elem == 0
@autodesc += "This form's efficiency of the \"#{i[0]}\" element is \"#{i[1]}\""
@elef[elem] = n + 1
end
@stef = []
# Same goes for states
for i in 0...$data_states.size
@stef[i] = 2
end
for i in h["stef"]
n = ["A","B","C","D","E","F"].index(i[1])
n = 2 if n == nil
state = 0
for s in 1...$data_states.size
state = s if $data_states[s].name == i[0]
end
next if state == 0
@autodesc += "This form's effiency of the \"#{i[0]}\" state is \"#{i[1]}\""
@stef[state] = n + 1
end
@autodesc += "There is nothing special about this form." if @autodesc == h["name"] + ":\n"
end
end
# Adjustments to Game_Battler
class Game_Battler
attr_reader :form
alias morph_form_initialize initialize
#--------------------------------------------------------------------------
# Small adjust to set the form to standard in the start.
def initialize
@form = MorphList.standard
morph_form_initialize
end
#--------------------------------------------------------------------------
# The form changing.
def form=(form_name = "standard")
# Downcase the form name
form_name.downcase!
# Get the percents of HP/SP compared with their max.
hper = @hp / maxhp
sper = @sp / maxsp
# Check if form exists, if not, return.
if MorphList.singleton_methods.include?(form_name)
form = form_name
else
return
end
# If it does exist, make it the active one.
@form = toto("MorphList.#{form}")
# Restore the HP and SP with their percents
@hp = maxhp * hper
@sp = maxsp * sper
end
#--------------------------------------------------------------------------
# The adjustments to stats, it just does the percents.
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 999999].min
n *= (@form.maxhp / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 999999].min
return n
end
#--------------------------------------------------------------------------
def maxsp
n = [[base_maxsp + @maxsp_plus, 0].max, 9999].min
n *= (@form.maxsp / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].maxsp_rate / 100.0
end
n = [[Integer(n), 0].max, 9999].min
return n
end
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
n *= (@form.str / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
def dex
n = [[base_dex + @dex_plus, 1].max, 999].min
n *= (@form.dex / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].dex_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
def agi
n = [[base_agi + @agi_plus, 1].max, 999].min
n *= (@form.agi / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].agi_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
def int
n = [[base_int + @int_plus, 1].max, 999].min
n *= (@form.int / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].int_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
def atk
n = base_atk
n *= (@form.atk / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].atk_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
def pdef
n = base_pdef
n *= (@form.pdef / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].pdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
def mdef
n = base_mdef
n *= (@form.mdef / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].mdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# Different battlers for different forms maybe?
def battler_name
if FileTest.exist?("Graphics/Battlers/#{@battler_name}_#{@form.name}.png")
return "#{@battler_name}_#{@form.name}"
else
return @battler_name
end
end
#--------------------------------------------------------------------------
# The adjustments to states_plus, to use the form adjustment
def states_plus(plus_state_set)
# Clear effective flag
effective = false
# Loop (added state)
for i in plus_state_set
# If this state is not guarded
unless self.state_guard?(i)
# Set effective flag if this state is not full
effective |= self.state_full?(i) == false
# If states offer [no resistance]
if $data_states[i].nonresistance
# Set state change flag
@state_changed = true
# Add a state
add_state(i)
# If this state is not full
elsif self.state_full?(i) == false
rank = self.state_ranks[i]
rank = @form.stef[i] if @form.name.downcase != "standard"
# Convert state effectiveness to probability,
# compare to random numbers
if rand(100) < [0,100,80,60,40,20,0][rank]
# Set state change flag
@state_changed = true
# Add a state
add_state(i)
end
end
end
end
# End Method
return effective
end
#--------------------------------------------------------------------------
# The adjustments to skill_can_use? to check if the battler isnt disabled
# to use magic or physic attacks
def skill_can_use?(skill_id)
# If magic is not able, return
return false if @form.magic_able == false and $data_skills[skill_id].atk_f == 0
return false if @form.physic_able == false and $data_skills[skill_id].atk_f != 0
# If there's not enough SP, the skill cannot be used.
return false if $data_skills[skill_id].sp_cost > self.sp
# Unusable if incapacitated
return false if dead?
# If silent, only physical skills can be used
return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
# Get usable time
occasion = $data_skills[skill_id].occasion
# If in battle
if $game_temp.in_battle
# Usable with [Normal] and [Only Battle]
return (occasion == 0 or occasion == 1)
# If not in battle
else
# Usable with [Normal] and [Only Menu]
return (occasion == 0 or occasion == 2)
end
end
#--------------------------------------------------------------------------
# Adjustments to attack_effect to check if the battler isnt immune for physics attacks
def attack_effect(attacker)
# Clear critical flag
self.critical = false
# First hit detection
hit_result = (rand(100) < attacker.hit)
hit_result = false if @form.physic_immune
# If hit occurs
if hit_result == true
# Calculate basic damage
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage = atk * (20 + attacker.str) / 20
# Element correction
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Critical correction
if rand(100) < 4 * attacker.dex / self.agi
self.damage *= 2
self.critical = true
end
# Guard correction
self.damage /= 2 if self.guarding?
end
# Dispersion
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# Second hit detection
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# If hit occurs
if hit_result == true
# State Removed by Shock
remove_states_shock
# Substract damage from HP
self.hp -= self.damage
# State change
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# When missing
else
# Set damage to "Miss"
self.damage = "Miss"
# Clear critical flag
self.critical = false
end
# End Method
return true
end
#--------------------------------------------------------------------------
# Checking if the battler isnt immune for magic or physic attacks
def skill_effect(user, skill)
# Change to a god
if skill.name == "Godly Body"
self.form = "god"
return true
end
# Clear critical flag
self.critical = false
# If skill scope is for ally with 1 or more HP, and your own HP = 0,
# or skill scope is for ally with 0, and your own HP = 1 or more
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# End Method
return false
end
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= skill.common_event_id > 0
# First hit detection
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
hit_result = false if @form.physic_immune and skill.pdef_f != 0
hit_result = false if @form.magic_immune and skill.pdef_f == 0
# If hit occurs
if hit_result == true
# Calculate power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculate rate
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate basic damage
self.damage = power * rate / 20
# Element correction
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Guard correction
self.damage /= 2 if self.guarding?
end
# Dispersion
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# Second hit detection
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
end
# If hit occurs
if hit_result == true
# If physical attack has power other than 0
if skill.power != 0 and skill.atk_f > 0
# State Removed by Shock
remove_states_shock
# Set to effective flag
effective = true
end
# Substract damage from HP
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# State change
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# If power is 0
if skill.power == 0
# Set damage to an empty string
self.damage = ""
# If state is unchanged set damage to "Miss"
self.damage = "Miss" unless @state_changed\
end
# If miss occurs
else
# Set damage to "Miss"
self.damage = "Miss"
end
# If not in battle set damage to nil
self.damage = nil unless $game_temp.in_battle
# End Method
return effective
end
end
# Some actor thingies
class Game_Actor
# Changes to maxhp
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
n *= (@form.maxhp / 100.0) unless @form.name.downcase == "standard"
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# The element rate imported from the form
def element_rate(element_id)
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
rank = $data_classes[@class_id].element_ranks[element_id]
rank = @form.elef[element_id] if @form.name.downcase != "standard"
result = table[rank]
# If this element is protected by armor, then it's reduced by half
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# If this element is protected by states, then it's reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
end
# Some mods to the enemy too, they also got forms.
class Game_Enemy
# The element rate imported from the form
def element_rate(element_id)
# Get a numerical value corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
rank = $data_enemies[@enemy_id].element_ranks[element_id]
rank = @form.elef[element_id] if @form.name.downcase != "standard"
result = table[rank]
# If protected by state, this element is reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
#--------------------------------------------------------------------------
# Changes to the actions, to check if the enemy is able to do the action
def make_action
# Clear current action
self.current_action.clear
# If unable to move
unless self.movable?
# End Method
return
end
# Extract current effective actions
available_actions = []
rating_max = 0
for action in self.actions
# Confirm turn conditions
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
next if (b == 0 and n != a) or (b > 0 and (n < 1 or n < a or n % b != a % b))
# Confirm HP conditions
next if self.hp * 100.0 / self.maxhp > action.condition_hp
# Confirm level conditions
next if $game_party.max_level < action.condition_level
# Confirm switch conditions
switch_id = action.condition_switch_id
next if switch_id > 0 and $game_switches[switch_id] == false
# Check if form doesnt disable action
if action.kind == 1
next if action.basic == 0 and @form.physic_able == false
else
next if @form.magic_able == false and $data_skills[action.skill_id].atk_f == 0
next if @form.physic_able == false and $data_skills[action.skill_id].atk_f != 0
end
# Add this action to applicable conditions
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# Calculate total with max rating value at 3 (exclude 0 or less)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# If ratings total isn't 0
if ratings_total > 0
# Create random numbers
value = rand(ratings_total)
# Set things that correspond to created random numbers as current action
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
end
# Updates in scene_battle
class Scene_Battle
#--------------------------------------------------------------------------
# Changes in the command window
def update_phase3_basic_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go to command input for previous actor
phase3_prior_actor
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
if @active_battler.form.physic_able
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
else
$game_system.se_play($data_system.buzzer_se)
end
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
end
return
end
end
end
Please note that this is an early release of this script and may still contain bugs. If you find a bug, post here or send me a PM and i'll check it out. Note that im still working on this script and building improvements. I might stop supporting this script anytime i want.
Now, i've written some basic tutorials to help you understand this script and how to use it a bit.
Adding a Form
Well, this is very simple.
1. Add the form to the MorphList
In module Morphlist, make a new method (lets say our form is "Pie") so "def self.pie(req="form")" will be added in this case.
If you know a little scripting, you should know what this means.
Then, on the next line, we should import a hash from another form. To do so add "h = standard("hash")"
Now we should program the changes, in this case, we'll do the name only for ease. We'll add another line "h["name"] = "Pie"" in this case.
If there are no further changes, we should end this method with the "end" command.
2. You're done!
Yes, its really that simple! Test it yourself by using "*battlerclass*.form = "Pie""
1. Add the form to the MorphList
In module Morphlist, make a new method (lets say our form is "Pie") so "def self.pie(req="form")" will be added in this case.
If you know a little scripting, you should know what this means.
Then, on the next line, we should import a hash from another form. To do so add "h = standard("hash")"
Now we should program the changes, in this case, we'll do the name only for ease. We'll add another line "h["name"] = "Pie"" in this case.
If there are no further changes, we should end this method with the "end" command.
2. You're done!
Yes, its really that simple! Test it yourself by using "*battlerclass*.form = "Pie""
Adding a Variable
This too is very simple.
1. Add the variable to the default.
We'll only adjust the default in this case, since if you read the tutorial "How to create another form" you should know how to change.
Before the "end" of the form, we'll add the new variable we will call "pie" once again, the standard values will be 5. To do so, we'll add "h["pie"] = 5".
2. Add the value to the form class.
We'll go to the Form class, to def initialize. Before the last @autodesc addition, we'll add our variable.
We will use the following code for that: "@pie = h["pie"]. Now, we will add our very own auto description.
For that, use the code "@autodesc += "This form's love for pie is #{@pie}.\n" unless @pie == 5", the unless thingie is to check if it isnt the default.
3. You're done!
Yes, this one is simple aswell. Try reading your new variable by using "*battlerclass*.form.pie"
1. Add the variable to the default.
We'll only adjust the default in this case, since if you read the tutorial "How to create another form" you should know how to change.
Before the "end" of the form, we'll add the new variable we will call "pie" once again, the standard values will be 5. To do so, we'll add "h["pie"] = 5".
2. Add the value to the form class.
We'll go to the Form class, to def initialize. Before the last @autodesc addition, we'll add our variable.
We will use the following code for that: "@pie = h["pie"]. Now, we will add our very own auto description.
For that, use the code "@autodesc += "This form's love for pie is #{@pie}.\n" unless @pie == 5", the unless thingie is to check if it isnt the default.
3. You're done!
Yes, this one is simple aswell. Try reading your new variable by using "*battlerclass*.form.pie"
Using autodescription
This one is very easy, each time a form is created, an autodesc is generated using the values you set.
1. How to call
Well, just do *form*.autodesc. To read from the first actor in the party, for example, use $game_party.actors[0].form.autodesc. It is just in
default string format, with every new line separated bij the well known "\n" command.
2. You're done!
1. How to call
Well, just do *form*.autodesc. To read from the first actor in the party, for example, use $game_party.actors[0].form.autodesc. It is just in
default string format, with every new line separated bij the well known "\n" command.
2. You're done!
How do form specific graphics work?
This is not a tutorial, just an explanation.
The script autodetects if there is a correct graphic. The correct graphic is: original battlername_form name.png
If you got that in the battlers folder, it will change into that battler when you change the form.
The script autodetects if there is a correct graphic. The correct graphic is: original battlername_form name.png
If you got that in the battlers folder, it will change into that battler when you change the form.
Skills to change forms
By default, on line 422 def skill_effect starts. If not, search it.
You'll see a comment with "Change to a god" there, for your ease. You can change the skill name to your skill name and form name to your form name. You can copy that as many times as you want and change the skills.
You'll see a comment with "Change to a god" there, for your ease. You can change the skill name to your skill name and form name to your form name. You can copy that as many times as you want and change the skills.
Oh, here's a little snippet i used to test this script, just do a script call for "standard", "ghost" or "god" and the first character will change to that form. This is a simple script, to test, so screenshots and demo's arent needed at this time.
The Test Code
Code:
# Some code to quickly change the leading actor to a ghost
class Interpreter
def standard
$game_party.actors[0].form = "standard"
end
def ghost
$game_party.actors[0].form = "ghost"
end
def god
$game_party.actors[0].form = "god"
end
end