Message


Show Text
$game_message.face_name  = 'fName'
$game_message.face_index = fIndex
$game_message.background = fBG
$game_message.position   = fPos
$game_message.add("Text")
# fName      - Name of file containing desired face. Also automatically searches
#              files included in RGSS-RTP. File extensions may be omitted.
# fIndex     - Numerical identifier of face (0 is the first face).
# fBG        - [0] Normal, [1] Faded, [2] Transparent
# fPos       - [0] Top, [1] Middle, [2] Bottom


Show Choices
This is not something we recommend to use. Show Choices is very complicated.
params = []
choices = []
choices.push("choice 1")
choices.push("choice 2")
params.push(choices)
params.push(0/1/2 this part is where you press cancel and which choice to default)
setup_choices(params)


Input Number
$game_message.num_input_variable_id = x
$game_message.num_input_digits_max = y

Example Usage:
Input a 3 digit number into variable 5
$game_message.num_input_variable_id = 5
$game_message.num_input_digits_max = 3

Select Key Item
$game_message.item_choice_variable_id = x

Where x is the Variable Dd you want the item number put into.
Show Scrolling Text
$game_message.scroll_mode = true
$game_message.scroll_speed = 1
$game_message.scroll_no_fast = false
$game_message.add("A long time ago,")
$game_message.add("in a galaxy far, far away ...")
$game_message.add("")
$game_message.add("")
$game_message.add("")
$game_message.add("...")


Change HP
# For Single Actor
# ----------------------------------------------
actor = $game_actors[id]
if !actor.dead?
  actor.change_hp(value, enable_death)
  actor.perform_collapse_effect if actor.dead?
end

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor|
  next if actor.dead?
  actor.change_hp(value, enable_death)
  actor.perform_collapse_effect if actor_dead?
}

# Where id (in the first one) is the id of the single actor
# value is the change to make (a positive or negative amount to be added to the current hp)
# 5 will make someone with HP 10 go to 15
# -5 will make someone with HP 10 go to 5
# so it's not SETTING the value, but adjusting it. 
# enable_death is true or false


Change MP
# For Single Actor
# ----------------------------------------------
$game_actors[id].mp += value

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.mp += value }

# where id (in the first one) is the id of the single actor
# value is the amount to change
# You can also do -= or *= or /= instead of += ... that way you can keep value positive


Change State
# Add State For Single Actor
# ----------------------------------------------
actor = $game_actors[id]
already_dead = actor.dead?
actor.add_state(state_id) 
actor.perform_collapse_effect if actor.dead? and !already_dead
actor.result.clear

# Remove State For Single Actor
# ----------------------------------------------
actor = $game_actors[id]
actor.remove_state(state_id)
actor.result.clear

# Add State For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor|
  already_dead = actor.dead?
  actor.add_state(state_id)
  actor.perform_collapse_effect if actor.dead? and !already_dead
}
$game_party.clear_results

# Remove State For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.remove_state(state_id) }
$game_party.clear_results

where id (in the first two) is the id of the individual actor
state_id is the id of the state you want to add or remove

# I'm working on the assumption that removing a state will NOT cause actor death. The interpreter script DOES do the 
# perform_collapse_effect if actor.dead? && !already_dead test even when removing a state. 
# LMK if you think that needs to be added in, and I'll adjust the state remove scriptlets.


Recover All
# For Single Actor
# ----------------------------------------------
$game_actors[id].recover_all

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.recover_all }


Change EXP
# For Single Actor
# ----------------------------------------------
$game_actors[id].change_exp(new_exp, show)

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.change_exp(new_exp, show)

# where id (in the first one) is the id of the individual actor
# show is true or false - if true, it will display a level up message and list new skills if the exp puts them past the current level
# new_exp is what you want to SET the exp to (this is not an adjustment - if they have 50 and you want to add 10, you need to pass 60)
# If you WANT to pass an adjustment, change this:
new_exp
# to this:
actor.exp + value
# where value is a positive or negative amount


Change Level
# For Single Actor
# ----------------------------------------------
$game_actors[id].change_level(new_level, show)

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.change_level(new_level, show)

# where id (in the first one) is the id of the individual actor
# show is true or false (as above, for level up and skills messages)
# new_level is the level you want to change them to (not an adjustment)
# If you WANT to make an adjustment (give them all an extra level, not necessarily make them all the SAME new level), change this:
new_level
# to this:
actor.level + value
# where value is a positive or negative amount


Change Parameters
# For Single Actor
# ----------------------------------------------
$game_actors[id].add_param(pid, value)

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.add_param(pid, value)

# where id is the actor id
# pid is the parameter id (0=MHP, 1=MMP, 2=ATK, 3=DEF, 4=MAT, 5=MDF, 6=AGI, 7=LUK)
# value is the amount to add or subtract


Change Skills
# For Single Actor
# ----------------------------------------------
$game_actors[id].learn_skill(sid)
$game_actors[id].forget_skill(sid)

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.learn_skill(sid) }
$game_party.members.each { |actor| actor.forget_skill(sid) }

# where id is the id of the actor
# sid is the id of the skill to learn or forget


Change Equipment
$game_actors[id].change_equip_by_id(slot, equip) if $game_actors[id]
# id is actor id
# slot is the slot number (0=weapon, 1=shield, 2=head, 3=body, 4=accessory)
# equip is the weapon or armor id


Change Name
$game_actors[id].name = "Name" if $game_actors[id]


Change Class
$game_actors[id].change_class(cid) if $game_actors[id] and $data_classes[cid]
# where id is the actor id
# cid is the class id


Change Nickname
$game_actors[id].nickname = "Nickname" if $game_actors[id]


Party



Change Gold
$game_party.gain_gold(amount)
$game_party.lose_gold(amount)


Alternatively where Value is + or - amount.
$game_party.gain_gold(100)  #Add Gold
$game_party.gain_gold(-100) #Decrease Gold



Change Items
$game_party.gain_item($data_items[n], amount)
$game_party.lose_item($data_items[n], amount)


Change Weapons
$game_party.gain_item($data_weapons[n], amount)
$game_party.lose_item($data_weapons[n], amount)


Change Armor
$game_party.gain_item($data_armors[n], amount)
$game_party.lose_item($data_armors[n], amount)


Change Party Member
# Add Actor by ID
$game_party.add_actor(actor_id)

# Remove Actor by ID
$game_party.remove_actor(actor_id)

# Remove Actor by Party Position
partyMem = $game_party.members
$game_party.remove_actor(partyMem[memPos].id)

# actor_id   - Numerical identifier of actor within database. 
# memPos     - Numerical identifier of actor within current party. 0 = 1st member, 1 = 2nd member, etc


Game Progression



Control Switches
$game_switches[n] = true/false


Control Variables
# ----------------------------------------------
# Set a Value
# ----------------------------------------------
$game_variables[n] = n
# ----------------------------------------------
# Set a Value to a batch of variables
# ----------------------------------------------
(n..n).each { |i|
  $game_variables[i] = value
}
# Example:
(1..5).each { |i|
  $game_variables[i] = 20 
}

# Alternatively, you can use do
(n..n).each do |i|
  $game_variables[i] = value
end
# Example:
(1..5).each do |i|
  $game_variables[i] = 20 
end

# ----------------------------------------------
# For operator references:
# ----------------------------------------------
# Addition
$game_variables[n] += n
# Subtraction
$game_variables[n] -= n
# Multiply
$game_variables[n] *= n
# Division
$game_variables[n] /= n
# Modulus
$game_variables[n] %= n
# String (aka text)
$game_variables[n] = "Insert string here!"
# Another Variable
$game_variables[n] = $game_variables[n] 

# Variable References
$game_variables[$game_variables[n]] = value

# Randomize
$game_variables[n] = rand(value)

# Example for Randomize:
# If you use rand(10) you get a number between 0-9
$game_variables[1] = rand(10)
# To have negative values, put something like "*-5 + rand(11)" to get a number between -5 to 5
$game_variables[1] = (-5 + rand(11))

# ----------------------------------------------
# For Game Data References:
# ----------------------------------------------

# Amount of Items in Inventory
$game_variables[n] = $game_party.item_number($data_items[n])
# Example Usage: Amount of Potions in Inventory is going to be displayed Variable 1
$game_variables[1] = $game_party.item_number($data_items[1])

# Amount of Weapons in Inventory
$game_variables[n] = $game_party.item_number($data_weapons[n])

# Amount of Armors in Inventory
$game_variables[n] = $game_party.item_number($data_armors[n])

# Map ID 
$game_variables[n] = $game_map.map_id

# Gold
$game_variables[n] = $game_party.gold

# Steps
$game_variables[n] = $game_party.steps

# Playtime
$game_variables[n] = $game_system.playtime_s

# Frame Count and Frame Rate
$game_variables[n] = Graphics.frame_count
$game_variables[n] = Graphics.frame_rate

# Timer
$game_variables[n] = $game_timer.sec

# Save Count
$game_variables[n] = $game_system.save_count

# Battle Count
$game_variables[n] = $game_system.battle_count

# Party Members Related
# To reference who's in a particular position in the lineup, it's
$game_variables[n] = $game_party.members[index].id
# where index is the position (starting at 0 for the leader)

# To reference where someone is in the lineup, it's
$game_variables[n] = $game_actors[id].index
# where id is the actor id

# Actor Level
$game_variables[n] = $game_actors[n].level
# Actor HP
$game_variables[n] = $game_actors[n].hp
# Actor Max HP
$game_variables[n] = $game_actors[n].mhp
# Actor MP
$game_variables[n] = $game_actors[n].mp
# Actor Max MP
$game_variables[n] = $game_actors[n].mmp
# Actor Attack
$game_variables[n] = $game_actors[n].atk
# Actor Defense
$game_variables[n] = $game_actors[n].def
# Actor MagAtk
$game_variables[n] = $game_actors[n].mat
# Actor MagDef
$game_variables[n] = $game_actors[n].mdf
# Actor Agility
$game_variables[n] = $game_actors[n].agi
# Actor Luck
$game_variables[n] = $game_actors[n].luk
# Actor Pharmacology
$game_variables[n] = $game_actors[n].pha

# Enemy Troop Stats (use this only in battle!)
$game_variables[n] =  $game_troop.members[index].stat
# where stat = hp or mp or param(id)
# where id = 0:MHP, 1:MMP, 2:ATK, 3:DEF, 4:MAT, 5:MDF, 6:AGI, 7:LUK


Control Self Switch
$game_self_switches[[map, event, 'self_switch']] = value

Map is either @map_id (for the current map) or a number without leading zeros for a map other than the current one
event is either @event_id (for the current event) or a number for an event other than the current one (EV001 would be 1)
self_switch is 'A', 'B', 'C' or 'D' (must have the single or double quotes)
value is either true or false


Control Timer
# Start Timer
$game_timer.start(sec * Graphics.frame_rate)

# Stop Timer
$game_timer.stop


Seconds is the number of seconds to set on the timer. You must convert minutes and seconds to total seconds.


Flow Control



Conditional Branch
For a better explanation of Conditional Branches, search the Help File for Control Structures.
It will give you a better idea of how to use them and what kind of Control Structure to use.
# Basic Conditional Branch
if put condition here
# do stuff
else
# do stuff
end

# Forked Conditions -- basically when you have a lot of conditions going on.
if stuff here happens
 # do stuff
 elsif stuff happens here too!
 # do stuff
 elsif stuff happens again!
 # do stuff
 elsif stuff happens...
 # do stuff
end


Call Common Event
$game_temp.reserve_common_event(ID)