Main Menu
  • Welcome to The RPG Maker Resource Kit.

Script Call Collection

Started by Nessiah, April 05, 2014, 12:09:13 PM

0 Members and 1 Guest are viewing this topic.

Nessiah

Table of Contents


† Message † Party † Actor †
† Game Progression † Flow Control †
† Movement † Timing † Picture and Weather †
† Character † Screen Effect † Music and Sounds †
† Scene Control † Map † System Settings †
† Battle † Movie †
†  Other Useful Things! †
Things to Remember!
ANY numbers you key in should NOT have leading zeros -
e.g. map numbers, event numbers, variable/switch numbers.
(E.g. Don't type EV002, just type in 2)
Special Thanks and Credits!
Shaz for handling all my questions and missing functions!
Galv for taking time to figure out script call commands with me!
Yami for helping me find some missing functions and teaching about damage formulas which got referenced here!
GrandmaDeb and everyone for reminding me that this should be done.


Nessiah

Message

Show Text[spoiler]

$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

[/spoiler]
Show Choices[spoiler]
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)

[/spoiler]
Input Number[spoiler]

$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
[/spoiler]
Select Key Item[spoiler]

$game_message.item_choice_variable_id = x

Where x is the Variable Dd you want the item number put into.[/spoiler]
Show Scrolling Text[spoiler]

$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("...")
[/spoiler]

Party

Change HP[spoiler]


# 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
[/spoiler]

Change MP[spoiler]

# 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
[/spoiler]

Change State[spoiler]

# 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.
[/spoiler]

Recover All[spoiler]

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

# For Entire Party
# ----------------------------------------------
$game_party.members.each { |actor| actor.recover_all }
[/spoiler]

Change EXP[spoiler]

# 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
[/spoiler]

Change Level[spoiler]

# 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
[/spoiler]

Change Parameters[spoiler]

# 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
[/spoiler]

Change Skills[spoiler]

# 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
[/spoiler]

Change Equipment[spoiler]

$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
[/spoiler]

Change Name[spoiler]

$game_actors[id].name = "Name" if $game_actors[id]
[/spoiler]

Change Class[spoiler]

$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
[/spoiler]

Change Nickname[spoiler]

$game_actors[id].nickname = "Nickname" if $game_actors[id]
[/spoiler]

Party

Change Gold[spoiler]

$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

[/spoiler]

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

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

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

Change Party Member[spoiler]
# 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
[/spoiler]

Game Progression

Control Switches[spoiler]
$game_switches[n] = true/false[/spoiler]

Control Variables[spoiler]

# ----------------------------------------------
# Set a Value
# ----------------------------------------------
$game_variables[n] = n

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

# Alternatively, you can use do
(n..n).each do |i|
  $game_variables = value
end
# Example:
(1..5).each do |i|
  $game_variables = 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
[/code][/spoiler]

Control Self Switch[spoiler]
$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
[/spoiler]

Control Timer[spoiler]

# 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.
[/spoiler]

Flow Control

Conditional Branch[spoiler]
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
[/spoiler]

Call Common Event[spoiler]
$game_temp.reserve_common_event(ID)[/spoiler]


Nessiah

Movement

Transfer Player[spoiler]

$game_temp.fade_type = fade
$game_player.reserve_transfer(map_id, x, y, direction)
# Fade/Fade Style =  [0; Default, Black], [1] White, [2] None
# For direction: [0; Default, Retain], [2] Down, [4] Left, [8] Up, [6] Right
[/spoiler]

Set Vehicle Location[spoiler]

# ----------------------------------------------
# To set Vehicle Location
# ----------------------------------------------
$game_map.vehicles[n].set_location(map_id, x, y)
# n = [0] boat, [1] ship, [2] airship

# ----------------------------------------------
# To Refer Game Vehicles
# ----------------------------------------------
$game_map.vehicles[n]
$game_map.vehicles[n].x
$game_map.vehicles[n].y
# n = [0] boat, [1] ship, [2] airship

# To find a Vehicle's Map ID, you would need to add a accessor reader.
# Add the following code in Script Editor:
class Game_Vehicle < Game_Character
  attr_reader   :map_id
end

# or Edit Game_Vehicle and add attr_reader   :map_id
[/spoiler]

Set Event and Player Location[spoiler]

# Move Event ID to new X and new Y Position
# ----------------------------------------------
$game_map.events[id].moveto(new_x, new_y)

# Move Player to new X and new Y Position
# ----------------------------------------------
$game_player.moveto(x, y)
[/spoiler]

Scroll Map[spoiler]

Fiber.yield while $game_map.scrolling? # Add this if just the script call below doesn't work.
$game_map.start_scroll(direction, distance, speed)
# Direction = [2]Down [4]Left [6]Right [8]Up
# Distance = How many tiles you want it to scroll
# Speed = [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster
[/spoiler]

Set Move Route[spoiler]

move_route = RPG::MoveRoute.new
move_route.repeat = false           # This means the event will repeat the action
move_route.skippable = true         # This means the event will skip the move route if it's not possible
m = RPG::MoveCommand.new
m.code = 45                         # The List of M Code can be found over Game_Character Default Script, this current m.code is call script
m.parameters = ["script call here"] # This is if you use #45 in M.code
# To show animation in move route just type animation_id = n, for balloons it's balloon_id = n
move_route.list.insert(0,m.clone)

$game_player.force_move_route(move_route)         # For Player
$game_map.events[ID].force_move_route(move_route) # For Events

# ----------------------------------------------
# Other Move Route Options
# ----------------------------------------------

# Single Action
newCommand.code       = moveCode       # See List in Game_Character Default Script
newCommand.parameters = [""]           # This refers to Jump, Wait, Switch On, Switch Off, Change Speed,
                                       # Change Frequency, Change Graphic, Change Opacity, Play SE and Script.
newRoute.list.insert(0,newCommand.clone)

# Multiple Actions (Example)
# newCommand.code       = 1
# newRoute.list.insert(0,newCommand.clone)
# newCommand.code       = 3
# newRoute.list.insert(0,newCommand.clone)
# newCommand.code       = 1
# newRoute.list.insert(0,newCommand.clone)

# For Turning
$game_map.events[eventid].set_direction(n) # For Events
$game_player.set_direction(n)              # For Players
#Direction n = [2]Down [4]Left [6]Right [8]Up

# Changing Event Graphic
$game_map.events[id].set_graphic("character_name", character_index)
# id is the id of the event you want to change.
# "character_name" is the name of the graphic file you want to change to (make sure to keep the quotation marks).
# character_index is the index on the character sheet (it starts counting at 0).
[/spoiler]

Get On/Off Vehicle[spoiler]
$game_player.get_on_off_vehicle =  true/false[/spoiler]

Timing

Wait[spoiler]

Wait(n)

# From a move route or something like that, you'd need the following:
SceneManager.scene.wait(x)

#The following should work as well from anywhere.
x.times { Fiber.yield }
[/spoiler]

Picture and Weather

Show Picture[spoiler]
screen.pictures[index].show(file_name, position, x, y, x zoom, y zoom, opacity, blend type)
# position = [0] Top Left, [1] = Center
# blend type = [0] Normal, [1] Add, [2] Sub
[/spoiler]

Move Picture[spoiler]
screen.pictures[n].move(position, x, y, x zoom, y zoom, opacity, blend type, wait)
# position = [0] Top Left, [1] = Center
# blend type = [0] Normal, [1] Add, [2] Sub
[/spoiler]

Rotate Picture[spoiler]
screen.pictures[n].rotate(n)[/spoiler]

Tint Picture[spoiler]
screen.pictures[n].start_tone_change(Tone.new(0, 0, 0, 0), wait)[/spoiler]

Erase Picture[spoiler]

screen = $game_party.in_battle ? $game_troop.screen : $game_map.screen # The first line is not required
screen.pictures[n].erase                                               # if you're using this in an event on the map.
[/spoiler]

Set Weather Effects[spoiler]
$game_map.screen.change_weather(type, power, duration)

# type  = :none, :rain, :storm, or :snow
# power = Intensity of weather. If weather type is none (:none), set power (target value of intensity)
#         to 0 to represent gradual stopping of rain, but only in this case.
# time  = Specified time to fade weather in or out.
[/spoiler]

Character

Change Transparency[spoiler]
$game_player.transparent = true/false[/spoiler]

Change Player Followers[spoiler]

$game_player.followers.visible = true/false
$game_player.refresh
[/spoiler]

Gather Followers[spoiler]
$game_player.followers.gather[/spoiler]

Show Animation[spoiler]

$game_player.animation_id = n              # For Player
$game_map.events[eventid].animation_id = n # For Events
[/spoiler]

Show Balloon Icon[spoiler]

$game_player.balloon_id = n               # For Player
$game_map.events[eventid].balloon_id = n  # For Events
# Top Row is 1 (Exclamation by Default).
[/spoiler]

Erase Event[spoiler]
$game_map.events[event_id].erase[/spoiler]

Screen Effects

Fade Out Screen[spoiler]

Fiber.yield while $game_message.visible
screen.start_fadeout(30)
wait(30)
# Note: 30 can be change to any number
[/spoiler]

Fade In Screen[spoiler]

Fiber.yield while $game_message.visible
screen.start_fadein(30)
wait(30)
# Note: 30 can be change to any number
[/spoiler]

Tint Screen[spoiler]

tone = Tone.new(R,G,B,Opacity)
$game_map.screen.start_tone_change(tone, duration)
wait(n)                                       # Add these too to allow 'wait till the screen changes tint.
n.to_i.times { Fiber.yield }                  # Number of frames to wait (1000 is equal to 1 second)
[/spoiler]

Flash Screen[spoiler]

color = Color.new(R,G,B,Opacity)
screen.start_flash(color, t)
wait(t)
# t = time
# Example below:
color = Color.new(255,255,25,100)
screen.start_flash(color, 6)
wait(6)
[/spoiler]

Shake Screen[spoiler]

$game_map.screen.start_shake(power, speed, duration)

# power            - Intensity of shaking.
# speed            - Speed of shaking.
# duration         - Specified time for shaking to occur.
[/spoiler]

Musics and Sounds

Play BGM/ME/BGS/SE[spoiler]

RPG::BGM.new("BGM Name", volume, pitch).play
RPG::ME.new("ME Name", volume, pitch).play
RPG::BGS.new("BGS Name", volume, pitch).play
RPG::SE.new("SE Name", volume, pitch).play

# Alternative Script Calls
# ----------------------------------------------
Audio.bgm_play(fName, volume, pitch, pos)
Audio.bgs_play(fName, volume, pitch, pos)
Audio.me_play(fName, volume, pitch)
Audio.se_play(fName, volume, pitch)
# fName      - Name of file containing desired sound file. Also automatically searches
#              files included in RGSS-RTP. File extensions may be omitted.
# volume     - [100; Default - Max:100, Min:0] Volume of sound. OPTIONAL
# pitch      - [100; Default - Max:500, Min:1] Pitch of sound. OPTIONAL
# pos        - Position of sound file. OPTIONAL

# Play Map BGM (Does not Save Position)
# ----------------------------------------------
$game_map.autoplay

# Play Battle Music
# ----------------------------------------------
BattleManager.play_battle_bgm

# Play Battle Victory Music
# ----------------------------------------------
BattleManager.play_battle_end_me


[/spoiler]

Save BGM/Replay BGM/Fade Out BGM/Stop BGM[spoiler]


# Save BGM
# ----------------------------------------------
$game_system.save_bgm

# Save BGM and BGS
# ----------------------------------------------
BattleManager.save_bgm_and_bgs

# Replay BGM
# ----------------------------------------------
$game_system.replay_bgm

# Replay BGM and BGS
# ----------------------------------------------
BattleManager.replay_bgm_and_bgs

# Fade BGM/BGS/ME
# ----------------------------------------------
RPG::BGM.fade(seconds * 1000)
RPG::BGS.fade(seconds * 1000)
RPG::ME.fade(seconds * 1000)

# Alternative Script Calls
# ----------------------------------------------
# Fade BGM
# ----------------------------------------------
RPG::BGM.fade(time)
# Or ...
Audio.bgm_fade(time)

# Fade BGS
# ----------------------------------------------
RPG::BGS.fade(time)
# Or ...
Audio.bgs_fade(time)

# Fade ME
# ----------------------------------------------
RPG::ME.fade(time)
# Or ...
Audio.me_fade(time)

# time = Number of milliseconds (1000 is equal to 1 second)

# Stop BGM
# ----------------------------------------------
RPG::BGM.stop
RPG::BGS.stop
RPG::ME.stop

# Alternative Script Calls
# ----------------------------------------------
# Halt BGM (Immediate)
# ----------------------------------------------
RPG::BGM.stop
# Or ...
Audio.bgm_stop

# Halt BGS (Immediate)
# ----------------------------------------------
RPG::BGS.stop
# Or ...
Audio.bgs_stop

# Halt ME (Immediate)
# ----------------------------------------------
RPG::ME.stop
# Or ...
Audio.me_stop

# Halt SE (Immediate)
# ----------------------------------------------
RPG::SE.stop
# Or ...
Audio.se_stop
[/spoiler]


Nessiah

Scene Control

Battle Processing[spoiler]


troop_id = variable
e = true/false (if escape enabled)
l = true/false (if continue when lose)

BattleManager.setup(troop_id, e, l)
BattleManager.event_proc = Proc.new {|n|
@branch[@indent] = n }
$game_player.make_encounter_count
SceneManager.call(Scene_Battle)
Fiber.yield

# Example Script Call below:
troop_id = 1
e = true
l = true

BattleManager.setup(troop_id, e, l)
BattleManager.event_proc = Proc.new {|n|
@branch[@indent] = n }
$game_player.make_encounter_count
SceneManager.call(Scene_Battle)
Fiber.yield

# OR

BattleManager.setup(1, true, true)
BattleManager.event_proc = Proc.new {|n|
@branch[@indent] = n }
$game_player.make_encounter_count
SceneManager.call(Scene_Battle)
Fiber.yield
[/spoiler]

Shop Processing[spoiler]

goods = [[type, id, price_override_flag(, price)]]
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, true)

# Example Script Call:
goods = [[0,1,1,25],[0,2,0]]
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, true)

# You can also use a loop to add the elements to the array:
goods = []
for id in 1..20
  goods.push([0, id, 0])
end

[/spoiler]

Name Input Processing[spoiler]

SceneManager.call(Scene_Name)
SceneManager.scene.prepare(actor_id, chars)
Fiber.yield
# Actor ID = Actor ID, Chars = How many characters long the name can be.
[/spoiler]

Open Save/Load/Exit/Game Over/Scenes[spoiler]

SceneManager.call(Scene_Save)
SceneManager.call(Scene_Load)
SceneManager.exit
SceneManager.call(Scene_Gameover)

SceneManager.call(scene)
# scene = Scene to load. (example - SceneManager.call(Scene_Skill) )
#         Scene_Menu, Scene_Item, Scene_Skill, Scene_Status, Scene_Title
#         Scene_Save, Scene_Load, Scene_Name, Scene_Debug, etc.
[/spoiler]

Map

Change Map Display Name[spoiler]
$game_map.name_display = true/false[/spoiler]

Change Tileset[spoiler]
$game_map.change_tileset(n)[/spoiler]

Change Battleback[spoiler]
$game_map.change_battleback("battleback1", "battleback2")[/spoiler]

Change Parallax Back[spoiler]
$game_map.change_parallax("graphicname", Loop Horizontal, Loop Vertical, HScroll, VScroll)
# Loop Horizontal and Loop Vertical = true/false
# HScroll, VScroll = numbers
# Example: $game_map.change_parallax("BlueSky", true, true, 0, 0)
[/spoiler]

Check Location[spoiler]


# X and Y's
# ----------------------------------------------
$game_player.x
$game_player.y

$game_map.events[n].x
$game_map.events[n].y
# n  = Event ID


# Check Terrain Tag
# ----------------------------------------------
$game_map.terrain_tag(x, y)
$game_player.terrain_tag
$game_map.events[event_id].terrain_tag

# Check Region ID
# ----------------------------------------------
$game_map.region_id(x, y)
$game_player.region_id == n
$game_map.events[event_id].region_id == n

# Check Map Name and Map ID
# ----------------------------------------------
$game_map.name
$game_map.map_id

# Check if Event is Near Player
# ----------------------------------------------
$game_map.events[n].near_the_player?

# True/False. Distance for detection is 20 squares.
# n  = Event ID
[/spoiler]

System Settings

Change Actor/Event Graphic[spoiler]

# Event Change Graphic
# ----------------------------------------------
$game_map.events[id].set_graphic("character_name", character_index)
# id is the id of the event you want to change.
# "character_name" is the name of the graphic file you want to change to (make sure to keep the quotation marks).
# character_index is the index on the character sheet (it starts counting at 0).

# Actor Change Graphic
# ----------------------------------------------
hero = $game_actors[ID]
hero.set_graphic("characterset_filename", character_index, "Faceset_filename", faceset_index)
$game_player.refresh
# ID = Actor Index
# character_index = Starts from 0 (Top Left), 1, 2, ...
# faceset_index = Starts from 0 (Top Left), 1, 2, ...

# Example:
hero = $game_actors[1]
hero.set_graphic("Actor1", 1, "Actor4", 1)
$game_player.refresh
[/code][/spoiler]


Nessiah

Miscellanous

Debugging Tools[spoiler]

# Add every Item/Skill/Weapon/Etc. without blank fields.
# ----------------------------------------------
$data_items.each { |i|
next if i.nil? or i.name == ""
$game_party.gain_item(i, 99)
}
# Change $data_items to $data_weapons or something else and the amount you want.

# Use Items immediately
# ----------------------------------------------
$game_actors[id].use_item($data_items[x])
$game_party.leader.use_item($data_items[x])
$game_party.members[index].use_item($data_items[x])

# Check Party Member Size
# ----------------------------------------------
$game_party.members.size
$game_party.all_members.size
# If In Battle, use this instead. This checks the total size of your party (not just battlers).

# Checking Availability
# ----------------------------------------------
$game_actors[X].equips.include?($data_weapons[Y])         # Checks if the actor X has weapon Y equipped
$game_actors[X].equips.include?($data_armors[Y])          # Checks if the actor X has equipment (shield, armor, helmet or accessory)
                                                          # Y equipped
$game_actors[X].skills.include?($data_skills[Y])          # Checks if the actor X has learned skill Y
$game_actors[X].states.include?($data_states[Y])          # Checks if the actor X is afflicted by status effect Y

$game_actors[actorid].skill_learn?($data_skills[skillid]) # If Player learned Skill. actorid and skillid are the ids from the database of
                                                          # the actor and skill you're interested in.
                                                          # It will return true if they have that skill, and false if they don't.
 
# Example Usage:
# if xxx weapon type is the same as unless xxx == nil
$game_actors[x].equips[y].wtype_id if $game_actors[x].equips[y]

# Check for Name/ID of Player Equipment
# ----------------------------------------------
$game_actors[X].equips[Y].id unless $game_actors[X].equips[Y] == nil   # Returns the ID of the equipment on actor X, equipped in slot Y
$game_actors[X].equips[Y].name unless $game_actors[X].equips[Y] == nil # Returns the name of the equipment on actor X equipped in slot Y

# NOTE: If using any scripts that give or take equipment slots, the #Y is the number of the character's slot,
# not the slot's number in the script. I.E. using Yanfly Equip Menu script - if your character has equipment
# slots 6,7,8,15,15,32,75 available then $game_actors[1].equips[0].id would return the ID of the item equipped
# in the slot defined as slot 6 in Yanfly script because it's the 1st equipment slot for the specific character.

# Checking Actors
# ----------------------------------------------
$game_actors[X].name       # Returns the name of the actor X
$game_actors[X].nickname   # Returns the nickname of the actor X
$game_actors[X].class.id   # Returns the ID of the actor X class
$game_actors[X].class.name # Returns the name of the actor X class

# Screen Clean Up
# ----------------------------------------------
# Clear Fade
# Clear Tone
# Clear Flash
# Clear Shake
# Clear Weather
# Clear Pictures
$game_map.screen.clear


# Clear Tone (Immediate)
$game_map.screen.clear_tone

# Clear Shake (Immediate)
$game_map.screen.clear_shake

# Clear Weather (Immediate)
$game_map.screen.clear_weather

# Clear Pictures (Immediate)
$game_map.screen.clear_pictures

[/spoiler]

Input Commands[spoiler]

Input.trigger?(:A)
Input.repeat?(:A)
Input.press?(:A)
# Change A to your desired key, refer to F1 when you testplay and see the keys.
[/spoiler]

Movement Commands[spoiler]

$game_player.moving?
$game_player.dash?
$game_player.jumping?
$game_map.events[event_id].moving?
$game_map.events[event_id].jumping?

$game_map.passable?(X, Y, D)
$game_player.passable?(x, y, d)
$game_map.events[event_id].passable?(x, y, d)

# $game_map.passable? only tells you whether you can leave one tile in the direction of the other.
# The player and event versions take it further and tell you if you can leave that tile in the direction of the other
# AND if you can enter the other tile from the tile you're on now (for example, if you are facing right and the tile
# in front of you is the edge of a cliff that is higher than you - $game_map.passable? would tell you that you CAN
# step right from the current tile. But $game_player.passable? would tell you that you could not move onto the next
# tile from the left). It also looks to see if there is an event on your target tile which would stop you going there,
# but $game_map.passable? would not tell you that.

# Q: I want to check the position of Player and compare with the position at side of Events.
# ----------------------------------------------
# Variable [6] = Position X Player
# Variable [7] = Position Y Player
# Variable [8] = Position X Event
# Variable [9] = Position Y Event

# If you only want them to be beside the event (positions 1 or 3), use this:
$game_variables[7] == $game_variables[9] and ($game_variables[6] - $game_variables[8]).abs == 1
# which says if the y value is the same and there is a difference of 1 between the x values.
# Note: abs = absolute value

# If you want them to be on any of the 4 numbered tiles, use this:
($game_variables[6] - $game_variables[8]).abs + ($game_variables[7] - $game_variables[9]).abs == 1
# which says there is a difference of 1 between the x values OR a difference of 1 between the y values
# It is comparing the difference between the x position of the player and the tile of interest.
# Using abs lets me take one away from the other in any order and still end up with a positive number -
# it doesn't matter which has the # higher or lower x value. Then it does the same with the y position of
# the player and the tile of interest. Then it adds them together (+ means plus, not and).
# So if the sum of the x distance and the y distance between the two tiles is 1, it means the player is on
# a tile that is directly touching the tile of interest (and not corner-ways, as then the sum of the numbers would be 2)
[/spoiler]

Player Equipment[spoiler]

# Change an actor's equipment.
# ----------------------------------------------
$game_actors[1].change_equip(n,$data_weapons[1])
# Change n with one of the following:
# 0 = weapon, 1 = shield, 2 = headgear, 3 = body-gear (armor), 4 = accessory

# Check Conditional Branch: if [Actor] has [Weapon] Equipped
# ----------------------------------------------
$game_actors[actor id].weapons.include?($data_weapons[weapon id])
right_hand = $game_actors[actor_id].equips[0]
left_hand = $game_actors[actor_id].equips[1]

# To get the items. Replace the index in equips for the item you're looking for:
# 0 = right hand, 1 = left hand, 2 = head, 3 = body, 4 = accessory
# provided you're not using any scripts that change that. You can check their types with:

if right_hand.is_a?(RPG::Weapon)
    # do something
  elsif right_hand.is_a?(RPG::Armor)
   # do something else
  end

# Or get their properties with with:
  right_hand.id
  right_hand.name
  right_hand.icon_index
  right_hand.description
  # etc..
 
# Example: if you want to check if you have a Prinny Gun equipped on your first weapon slot:
  right_hand = $game_actors[actor_id].equips[0]
  if !right_hand.nil? && right_hand.name.eql?("Prinny Gun")
    # Do something
  end

# You don't even need to keep track of the IDs, really (unless you want to, for some reason).
# If there's no way to not have a weapon equipped in your game, you can also take out the ".nil?" check.

[/spoiler]

Unsorted[spoiler]

# Currency unit set from the system tab:
# ----------------------------------------------
$data_system.currency_unit

# Move Events and players by fractional squares
# ----------------------------------------------
$game_map.events[ID].moveto(x, y)
$game_player.moveto(x, y)

# Example of fractional squares
$game_map.events[1].moveto(0, 5.5)
$game_player.moveto(7.5, 3)
end
# The Collission box is still seen as 32x32

# Script Call Battle Logs!
# ----------------------------------------------
# First add this scriptlet:
class Scene_Battle < Scene_Base
  attr_accessor:log_window
end

# To load your own battle logs
SceneManager.scene.log_window.add_text("Insert custom text here")
# It doesn't clear out and just stays there until something else replaces it.
SceneManager.scene.log_window.wait
# If you want it to clear make sure to use this.
SceneManager.scene.log_window.wait_and_clear 

# You can also do something like this!
x  = "Hi."
x += " Hello."
x += " This is getting long eh?"
x += " Surely so long. wahahahahahaha"
SceneManager.scene.log_window.add_text(x)

# or:
y = SceneManager.scene.log_window
y.add_text(text)

[/spoiler]


Nessiah

- Reserved -

Feel free to change stuff EXHydra or any admin that find some stuff wrong.
(Please tell me when you do so I can update my copy too.)


yuyu!

I apologize if I skipped over the answer somewhere. ;9

Does anyone know if there's a specific way to call a variable (via conditional branch) and check if it is one of multiple values? Basically calling "$game_variables[2] == 1 or 10" (I don't think the "or" quite works, unless my testing skills fail that badly haha). Although, when I tried it with "or" it did run the event...for literally everyone no matter what, haha.

[Spoiler=What I wants to do (because sometimes I suck at explaining)]
I'm working on a game where you can play as many different characters of differing personalities, but writing all that dialogue is a pain in the buttocks. So, I've made it where (for the unimportant stuff) certain characters will say the same thing, usually grouped together by general personality traits.

Let's say I want Arthemes (#1), Diora (#6), and Elsie (#10) to say the same thing because they're all fairly calm and serious people.

Instead of having to call a ton of conditional branches like so:

[If] 2: Character # = 1
    [If] 2: Character # = 6
        [If] 2: Character # = 10
[Obligatory dialogue]

I could just do a conditional branch script call:

[If] $game_variables[2] == 1 or 6 or 10
[Obligatory dialogue]
[/Spoiler]

If this is actually a thing, it'd be pretty awesome and really save on space and confusion, haha. If anyone knows if that's a proper call, please let me know. :)

Thanks again, everyone!

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]

D&P3

#7
When using a conditional branch, with a script call:
$game_variables[2] == 1 || $game_variables[2] == 6 || $game_variables[2] == 10       (And so on)



The '||' means 'or' in the programming world. However in the case of Ruby/RGSS you can simply say 'or'.
So this would work also:
$game_variables[2] == 1 or $game_variables[2] == 6 or $game_variables[2] == 10       (And so on)


Be wary though. Because The following would crash your game:
$game_variables[2] == 1 or $game_variables[2] == 6 or $game_variables[2] == 10 or
You've set no 'or' condition after the last one. So if you have that command there, your game will blow up and your CPU will hate you!





A nicer (and more clean looking) way however, might be to use the following in that script call instead:
[1, 6, 10].any? { |i| $game_variables[2] == i }

Where '[1, 6, 10]' would be the numbers you are looking for, and are each separated by a comma.
For Example: '[1, 4, 7, 12, 18]' would check the variable against those numbers to see if 'any?' of them matched up.
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

yuyu!

Oh wow, it worked perfectly!! Thank you so, so much! ^_^

This is going to save on a ton of space and make everything look a lot cleaner! ;_;

[Spoiler=My Games and Art]
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]

[/Spoiler]