Miscellanous


Debugging Tools
# 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


Input Commands
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.


Movement Commands
$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)

# ----------------------------------------------
# Follower Move Route Option
# ----------------------------------------------
$game_player.followers[n].force_move_route(move_route)
# For Followers (0 for first after actor, 1 for second after actor, etc.)


Player Equipment
# 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.


Unsorted
# 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)