Jump to content
Sign in to follow this  
Tarq

Script Call Master List

Recommended Posts

First things first. I did not compile the following list.   I don't remember who did, its not the same one Archeia posted previously. If the original poster has some issue with this being reposted pm me or report the thread and I'll remove it.

Anyways, I'm just reposting this as I had a local copy and I remembered that a lot of the previous links to 'script call master lists' were broken when this site and the Degica one upgraded software. So, here it is: (I'm too lazy to reformat it :P )

 

Variables
$game_variables[n]
Switches
$game_switches[n]
Conditional Branch
if #something
#something
else
#something
end
Show Picture
screen.pictures[index].show(file_name, upperleft/center, x, y, x zoom, y zoom, opacity, blend type)
Move Picture
screen.pictures[n].move(0/1 (top left or center), x, y, zoom1, zoom2, opacity, blend type (0,1, 2), wait)
Picture Tone
screen.pictures[n].start_tone_change(Tone.new(0, 0, 0, 0), wait)
Looping
For
#something
end
Move Event
move_route = RPG::MoveRoute.new
move_route.repeat = false
move_route.skippable = true
m = RPG::MoveCommand.new
m.code = 45 #The List of M Code can be found over Game_Character, this current m.code is call script
m.parameters = ["script call here"]
move_route.list.insert(0,m.clone)
$game_player.force_move_route(move_route)
Transfer Event Location
$game_map.events[id].moveto(new_x, new_y)
Transfer Player
$game_player.reserve_transfer(map_id, x, y, direction)
Screen Tint
t = Tone.new(red,green,blue, gray)
screen.start_tone_change(t, duration)
Shake Screen
@params = []
@params[0] = power or $game_variables[x]
@params[1] = speed or $game_variables[y]
@params[2] = duration or $game_variables[z]
Note: (Neonblack and Fomar0153 found this glitch!)
The shake screen has an option in the editor where you can add a "wait" or not. But the glitch involves that it will wait no matter what. But it will only wait a number of frames equal to whatever the speed is set to the default option. For example, the setting is 5 power, 5 speed, 60 frames, and wait. It will wait for 5 frames, no matter what.
 
Call Common Event:
 
$game_temp.reserve_common_event(id)
Play SE/ME/BGS/BGM:
 
RPG::SE.new("SE Name", volume, pitch).play
RPG::ME.new("ME Name", volume, pitch).play
RPG::BGS.new("BGS Name", volume, pitch).play
RPG::BGM.new("BGM Name", volume, pitch).play
Show Text:
 
$game_message.add("Text")
Gain/lose Item:
 
$game_party.gain_item($data_items[id], amount)
$game_party.lose_item($data_items[id], amount)
(For weapons/armor use $data_weapons or $data_armors in place of $data_items.)

Gather Followers:
 
$game_player.followers.gather
Change Player Followers:
 
$game_player.followers.visible = true or false
Erase Event:
 
$game_map.events[event_id].erase
Some conditional script calls to add to Celianna's:
Button pressing
 
Input.repeat?:)A)
Input.press?:)A)
Movement
 
$game_player.dash?
$game_player.jumping?
$game_map.events[event_id].moving?
$game_map.events[event_id].jumping?
Location
 
$game_map.events[event_id].x
$game_map.events[event_id].y
$game_player.x
$game_player.y
Remove Actor
 
$game_party.remove_actor(actor_id)
Add Actor
 
$game_party.add_actor(actor_id)
Remove Party Member from position (where x = party position. 0 = 1st member, 1 = 2nd member, etc.)
 
m = $game_party.members
$game_party.remove_actor(m[x].id)
If you ever wanted to add every item/skills/weapons for debugging purpose (or something else?) it can be kind of tedious to add them all if you have alot. This small script call will help immensely:
 
$data_items.each { |i|
next if i.nil? or i.name == ""
$game_party.gain_item(i, 99)
}
Of course, if you want you can change $data_items to $data_weapons or something else and the amount you want.

When checking for input triggers/pressing you can actually shorten that a bit:
 
Input.trigger?:)CTRL)
There is no need to write Input::CTRL anymore.

To get the leader of the party you can do this:
 
$game_party.leader
Gain/lose gold:
 
$game_party.gain_gold(amount)
$game_party.lose_gold(amount)
Check for current max gold:
 
$game_party.max_gold
Get map id and name:
 
$game_map.map_id
$game_map.name
To correct the screen shake bug thing do the following at Game_Interpreter:
 
def command_225
screen.start_shake(@params[0], @params[1], @params[2])
wait(@params[2]) if @params[2]
end
Now it will wait the right amount of frames and not 5.
 
$game_player.region_id == n
$game_map.events[event_id].region_id == n
Show Choices
 
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)
It is pretty easy to fake the When [**] command (402).
The definition is just

 
command_skip if @branch[@indent] != @params[0]
Where @params stores the choice number for that specific branch (0, 1, 2, ... )

So all you have to do is replace @params[0] with an integer

 
if @branch[@indent] == 0
# branch for first choice
elsif @branch[@indent] == 1
# branch for second choice
end
Editor line continuation
$game_variables[12] = ($game_variables[6] ==
$game_variables[10]) && ($game_variables[7] == $game_variables[11]) &&
($game_variables[8] == $game_variables[10]) &&
($game_variables[9] == $game_variables[11])
change the text dialog background:
$game_message.background = 1 #0 = default blue, 1 = dim, 2 = transparent
 
Equip weapon
$game_actors[1].change_equip(0,$data_weapons[1])
the 0 value in the above code snippet can have the following values:
0 = weapon
1 = shield
2 = headgear
3 = body-gear (armor)
4 = accessory
 
 
Transfer player
$game_player.reserve_transfer(map_id, x, y, $game_player.direction)
$game_player.followers.visible = true or false
Audio.se_play(name, volume, pitch)
Is Weapon Equipped?
$game_actors[actor id].weapons.include?($data_weapons[weapon id])
Access self switches
$game_self_switches[[mapid, eventid, 'A']] = true

Make sure you use [[...]] and not just [...]
Get Currency Unit
$data_system.currency_unit
For any equipment, you can use this:
  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..
 i.e. 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.
 
Showing a text box with pure script
 
$game_message.position = X
0 -Top
1- Middle
2- Bottom


$game_message.background = X
0 - Normal
1 - Faded
2 - Transparent
 
$game_message.face_name = 'Actor1' <- Name of the graphic plate
$game_message.face_index = 0 <- Position in the plate of the face you are using.
 
$game_message.face_name = 'Actor1'
$game_message.face_index = 0
$game_message.background = 2
$game_message.position = 0
$game_message.add("Text")
$game_player.passable?(x, y, d) and $game_map.events[event_id].passable?(x, y, d)

are extensions to this that do a little more detailed checking.

$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.
Check HP
You can check an actor's current hp with:
 
$game_actors[x].hp
Or the leader's current hp:
 
$game_party.leader.hp
Or a member of the party:
 
$game_party.members[x].hp
Check Items
Here's the script from Game_Interpreter that places the quantity of an item into a variable:
 
$game_party.item_number($data_items[param1])
So you'd just change param1 to the item id you're interested in, and add your condition around it:
 
if $game_party.item_number($data_items[32]) == 15
Checking how many of a particular type of weapon or armor is very similar:
 
$game_party.item_number($data_weapons[param1])
$game_party.item_number($data_armors[param1])
Access Event by Name
# Code by Filip H.F. "FiXato" Slagter
# Place this under Materials and above Main Process and before any scripts that would make use of it.
# Allows you to also use Game Switch *names* instead of just IDs in $game_switches[] calls.
class Game_Switches
# Overload the [] method so we can also call switches by their name, for instance:
# $game_switches['my switch']
alias_method :find_by_name, :[]
def [](switch)
switch_id = (switch.kind_of?(String) ? $data_system.switches.find_index(switch) : switch)
find_by_name(switch_id)
end
 
# Overload the []= method so we can also set switches by their name, for instance
# $game_switches['my switch'] = true
alias_method :set_by_name, :[]=
def []=(switch,value)
switch_id = (switch.kind_of?(String) ? $data_system.switches.find_index(switch) : switch)
set_by_name(switch_id, value)
end
end

    Recover All for your entire party:

@params = [0, 0]
command_314
 
 
 
 
Show a named animation (in this case 'Sleep') for the player and wait for it to end:
animation_name = 'Sleep'
animation_id = $data_animations.find_index{|ani|ani && ani.name == animation_name}
@params = [-1, animation_id, true]
command_212
Move_Route_Turn
$game_map.events[eventid].set_direction(#)
2 = down, 4 = left, 6 = right, 8 = up.
 
Event Ballon
$game_map.events[eventid].balloon_id = # where # is the row of the balloon spritesheet you want to show (I think the top row is 1, not 0), and eventid is the id of the event
Player Facing
$game_player.direction

2 = down
4 = left
6 = right
8 = up
If ActorX or ActorY is in party
$game_party.members.include?($game_actors[X]) or $game_party.members.include?($game_actors[Y])
Or
$game_party.members.any? {|a| [X,Y].include?(a.id)}
Change Actor Graphic
actor.set_graphic(character_name, character_index, face_name, face_index)
Use Item
$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])
Show Battle Animation
Show Battle Animation:

    @enemy_index = 0
    @animation_id = 1
     
    iterate_enemy_index(@enemy_index) do |e|
    e.animation_id = @animation_id if e.alive?
    end

That will show a battle animation.
 
Shop Processing
# goods = [[type, id, price_override_flag(, price)]] Ex:
goods = [[0,1,1,25],[0,2,0]]
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, true)
Or
goods = []
for id in 1..20
goods.push([0, id, 0])
end
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, true)
 
Store Actor Level
$game_variables[x] = $game_actors[id].level
Control Weather
$game_map.screen.change_weather(type, power, duration)
where type is :none, :rain, :storm, or :snow, and power and duration are what you would have set the sliders to on the box.

followed by Wait X Frames if you want it to halt processing until the weather is set.
Move Set Route -> 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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×