RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Nifty Script Calls for Eventing

0 Members and 1 Guest are viewing this topic.

*
A-pow 2015
Rep:
Level 81
2014 Best RPG Maker User - GraphicsFor frequently finding and reporting spam and spam bots2013 Most Unsung MemberSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.How can I help you? :Da^2 + b^2 = c^2Secret Santa 2012 ParticipantSilver - GIAW 10Silver - GIAW 9Bronze - GIAW HalloweenGold - Game In A Week VII
So Exhydra posted this interesting little tidbit:

Did you know you can move events (and players) fractional squares? I did not, until today!



and it got me to thinking. What other useful script calls would be beneficial to eventers that they otherwise wouldn't know about?

Spoiler for Variable script call:
One that I've learned about recently is "$game_variables[]". It returns the value of the variable number in the brackets. It doesn't sound too impressive on it's own, as there's already a way to change variables with eventing, but there are some neat things that you can do with it.

For example, in RM2k3, there was an option to use "variable references". Basically, this would take the value inside a variable and return the variable of the number that matches the first variable's value.

To do this, you'd use a script call that looks like this:

$game_variables[$game_variables[111]] = 5

This probably seems a little complicated, so let's simplify it a little. Let's assume that variable 111 is equal to 10.
This script call would then be "$game_variables[10] = 5 ". So now variable 10 is equal to 5. Whatever value is in 111 would be the new variable number.

You can also add (+=), subtract(-=), multiply(*=), divide(/=), and mod(%=) variables. This could be useful if you have a lot of variables you want to modify, but that aren't in consecutive order.


If you know of any other useful default script calls, post them here!

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Project of the Year2013 Best RPG Maker User (Programming)Participant - GIAW 11Bronze - GIAW 10
Default Script Calls
Spoiler for:
<SYSTEM>

Spoiler for:
» Game Variables
Spoiler for:
Code: [Select]
$game_variables[varNum]

# Returns value of variable, or nil
# varNum     - Numerical identifier of the variable.

» Game Switches
Spoiler for:
Code: [Select]
$game_switches[swiNum]

# Returns value of switch, or nil
# swiNum     - Numerical identifier of the switch.

» Call Common Event
Spoiler for:
Code: [Select]
$game_temp.reserve_common_event(cevID)

# cevID      - Numerical identifier of the Common Event.

» Call Scene
Spoiler for:
Code: [Select]
SceneManager.call(scene)

# scene         - Scene to load. (example - SceneManager.call(Scene_Skill) )
#
#               Scene_Menu, Scene_Item, Scene_Skill, Scene_Status, Scene_Save
#               Scene_Load, Scene_Name, Scene_Debug, etc.

» Exit Game
Spoiler for:
Code: [Select]
SceneManager.exit



<PARTY>

Spoiler for:
» Gain | Lose Party Members
Spoiler for:
Code: [Select]
# 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.

» Gain | Lose Inventory
Spoiler for:
Code: [Select]
# Gain | Lose Item(s)
$game_party.gain_item($data_items[iID], amount)
$game_party.lose_item($data_items[iID], amount)

# Gain | Lose Weapon(s)
$game_party.gain_item($data_weapons[iID], amount)
$game_party.lose_item($data_weapons[iID], amount)

# Gain | Lose Armor
$game_party.gain_item($data_armors[iID], amount)
$game_party.lose_item($data_armors[iID], amount)

# Gain | Lose Gold
$game_party.gain_gold(amount)
$game_party.lose_gold(amount)

# iID        - Numerical identifier of the item, weapon or armor.
# amount     - Numerical amount of the item, weapon, armor or gold.

» Gather Followers
Spoiler for:
Code: [Select]
$game_player.followers.gather

» Toggle Followers
Spoiler for:
Code: [Select]
$game_player.followers.visible = bVal

# bVal       - [True, False] Boolean value.



<MAP>

Spoiler for:
» Map ID
Spoiler for:
Code: [Select]
$game_map.map_id

» Map Name
Spoiler for:
Code: [Select]
$game_map.name

» Show Picture
Spoiler for:
Code: [Select]
$game_map.screen.pictures[index].show(fName, placement, x, y, xZoom, yZoom, opacity, blend)

# fName      - Also automatically searches files included in RGSS-RTP.
#              File extensions may be omitted.
# placement  - [0] Upper Left, [1] Center
# x          - X value of image.
# y          - Y value of image.
# xZoom      - [100; Default] Horizontal scaling of image.
# yZoom      - [100; Default] Vertical scaling of image.
# opacity    - [255; Default] Opacity of image.
# blend      - [0] Normal, [1] Add, [2] Sub

» Move Picture
Spoiler for:
Code: [Select]
$game_map.screen.pictures[imgNum].move(placement, x, y, xZoom, yZoom, opacity, blend, duration)

# imgNum     - Numerical identifier of the image.
# placement  - [0] Upper Left, [1] Center
# x          - X value of image.
# y          - Y value of image.
# xZoom      - [100; Default] Horizontal scaling of image.
# yZoom      - [100; Default] Vertical scaling of image.
# opacity    - [255; Default] Opacity of image.
# blend      - [0] Normal, [1] Add, [2] Sub
# duration   - Duration of time to move image.
#              NOTE : Does not pause script. Use one of the following instead :
#
#              wait(iFrames)
#              iFrames.to_i.times { Fiber.yield }
#
# iFrames    - Number of frames to wait (1000 is equal to 1 second)

» Picture Tone Change
Spoiler for:
Code: [Select]
$game_map.screen.pictures[imgNum].start_tone_change(tone, duration)

# imgNum     - Numerical identifier of image.
# tone       - Tone information :
#
#              Tone.new(red, blue, green, grey)
#
# duration   - Duration of time to alter image.
#              NOTE : Does not pause script. Use one of the following instead :
#
#              wait(iFrames)
#              iFrames.to_i.times { Fiber.yield }
#
# iFrames    - Number of frames to wait (1000 is equal to 1 second)

» Change Event|Player Location
Spoiler for:
Code: [Select]
# Event Usage
$game_map.events[evID].moveto(x, y)

# Player Usage
$game_player.moveto(x, y)

# evID       - Numerical identifier of the event.
# x          - X value of event or player. May be fractional (example - 5.5, 1.42)
#              NOTE : Use of fractional destinations will break event action
#                     detection (player touch, event touch, etc).

» Transfer Player | Change Map
Spoiler for:
Code: [Select]
$game_temp.fade_type = fade
$game_player.reserve_transfer(map_id, x, y, dir)

# fade       - Fade style
#              [0; Default, Black], [1] White, [2] None
# map_id     - Numerical identifier of the map.
# x          - X value of destination.
# y          - Y value of destination.
# dir        - Direction of facing.
#              [0; Default, Retain], [2] Down, [4] Left, [8] Up, [6] Right

» Tint Screen
Spoiler for:
Code: [Select]
$game_map.screen.start_tone_change(tone, duration)

# tone       - Tone information :
#
#              Tone.new(red, blue, green, grey)
#
# duration   - Duration of time to alter image.
#              NOTE : Does not pause script. Use one of the following instead :
#
#              wait(iFrames)
#              iFrames.to_i.times { Fiber.yield }
#
# iFrames    - Number of frames to wait (1000 is equal to 1 second)

» Player | Event Map Coordinates
Spoiler for:
Code: [Select]
$game_player.x
$game_player.y

$game_map.events[evID].x
$game_map.events[evID].y

# evID       - Numerical identifier of the event.

» Player | Event Map Region ID
Spoiler for:
Code: [Select]
$game_player.region_id

$game_map.events[evID].region_id

# evID       - Numerical identifier of the event.

» Is Player Moving?
Spoiler for:
Code: [Select]
$game_player.moving?

# Returns boolean value (true or false)

» Is Player Dashing?
Spoiler for:
Code: [Select]
$game_player.dash?

# Returns boolean value (true or false)

» Is Player Jumping?
Spoiler for:
Code: [Select]
$game_player.jumping?

# Returns boolean value (true or false)

» Is Event Moving?
Spoiler for:
Code: [Select]
$game_map.events[evID].moving?

# Returns boolean value (true or false)
# evID       - Numerical identifier of the event.

» Is Event Jumping?
Spoiler for:
Code: [Select]
$game_map.events[evID].jumping?

# Returns boolean value (true or false)
# evID       - Numerical identifier of the event.

» Erase Event
Spoiler for:
Code: [Select]
$game_map.events[evID].erase

# evID       - Numerical identifier of event.

» Is User Pressing Button?
Spoiler for:
Code: [Select]
Input.trigger?(input)

# Returns boolean value (true or false)
# input      - Button to check.
#
#              Input::DOWN, Input:LEFT, Input::RIGHT, Input::UP
#              Input::A, Input::B, Input::C, Input::X, Input::Y
#              Input::Z, Input::L, Input::R
#              Input::SHIFT, Input::CTRL, Input:ALT
#              Input::F5, Input::F6, Input::F7, Input::F8, Input::F9

» Start Screen Shake
Spoiler for:
Code: [Select]
$game_map.screen.start_shake(power, speed, duration)

# power            - Intensity of shaking.
# speed            - Speed of shaking.
# duration         - Specified time for shaking to occur.

» Change Screen Weather
Spoiler for:
Code: [Select]
$game_map.screen.change_weather(type, power, time)

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

» Screen Clean-Up
NOTE: Excellent for clean-up between player transfers
Spoiler for:
Code: [Select]
# 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

» Is Event Near Player?
Spoiler for:
Code: [Select]
$game_map.events[evID].near_the_player?

# Returns boolean value (true or false). Distance for detection is 20 squares.
# evID       - Numerical identifier of the event.

» Event Self-Switch
Spoiler for:
Code: [Select]
aKey = [mapID, evID, 'swiLetter']
$game_self_switches[aKey] = bVal

# mapID      - Numerical identifier of the map.
# evID       - Numerical identifier of the event.
# swiLetter  - Letter identifier of the self-switch (example - 'A', 'B', etc).
# bVal       - Boolean value to set the self-switch to.

» Move Route
Spoiler for:
Code: [Select]
newRoute           = RPG::MoveRoute.new
newRoute.repeat    = false
newRoute.skippable = true
newRoute.wait      = false
newCommand         = RPG::MoveCommand.new

# Single Action
newCommand.code       = moveCode       # See List Below
newCommand.parameters = [""]
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)

# Player Usage :
$game_player.force_move_route(newRoute)

# Event Usage :
$game_map.events[evID].force_move_route(newRoute)


# evID       - Numerical identifier of the event.
# moveCode   - Movement code.

#~   ROUTE_END               = 0             # End of Move Route
#~   ROUTE_MOVE_DOWN         = 1             # Move Down
#~   ROUTE_MOVE_LEFT         = 2             # Move Left
#~   ROUTE_MOVE_RIGHT        = 3             # Move Right
#~   ROUTE_MOVE_UP           = 4             # Move Up
#~   ROUTE_MOVE_LOWER_L      = 5             # Move Lower Left
#~   ROUTE_MOVE_LOWER_R      = 6             # Move Lower Right
#~   ROUTE_MOVE_UPPER_L      = 7             # Move Upper Left
#~   ROUTE_MOVE_UPPER_R      = 8             # Move Upper Right
#~   ROUTE_MOVE_RANDOM       = 9             # Move at Random
#~   ROUTE_MOVE_TOWARD       = 10            # Move toward Player
#~   ROUTE_MOVE_AWAY         = 11            # Move away from Player
#~   ROUTE_MOVE_FORWARD      = 12            # 1 Step Forward
#~   ROUTE_MOVE_BACKWARD     = 13            # 1 Step Backward
#~   ROUTE_JUMP              = 14            # Jump
#~   ROUTE_WAIT              = 15            # Wait
#~   ROUTE_TURN_DOWN         = 16            # Turn Down
#~   ROUTE_TURN_LEFT         = 17            # Turn Left
#~   ROUTE_TURN_RIGHT        = 18            # Turn Right
#~   ROUTE_TURN_UP           = 19            # Turn Up
#~   ROUTE_TURN_90D_R        = 20            # Turn 90 Degrees Right
#~   ROUTE_TURN_90D_L        = 21            # Turn 90 Degrees Left
#~   ROUTE_TURN_180D         = 22            # Turn 180 Degrees
#~   ROUTE_TURN_90D_R_L      = 23            # Turn 90 Degrees Right/Left
#~   ROUTE_TURN_RANDOM       = 24            # Turn at Random
#~   ROUTE_TURN_TOWARD       = 25            # Turn toward player
#~   ROUTE_TURN_AWAY         = 26            # Turn away from Player
#~   ROUTE_SWITCH_ON         = 27            # Switch ON
#~   ROUTE_SWITCH_OFF        = 28            # Switch OFF
#~   ROUTE_CHANGE_SPEED      = 29            # Change Speed
#~   ROUTE_CHANGE_FREQ       = 30            # Change Frequency
#~   ROUTE_WALK_ANIME_ON     = 31            # Walking Animation ON
#~   ROUTE_WALK_ANIME_OFF    = 32            # Walking Animation OFF
#~   ROUTE_STEP_ANIME_ON     = 33            # Stepping Animation ON
#~   ROUTE_STEP_ANIME_OFF    = 34            # Stepping Animation OFF
#~   ROUTE_DIR_FIX_ON        = 35            # Direction Fix ON
#~   ROUTE_DIR_FIX_OFF       = 36            # Direction Fix OFF
#~   ROUTE_THROUGH_ON        = 37            # Pass-Through ON
#~   ROUTE_THROUGH_OFF       = 38            # Pass-Through OFF
#~   ROUTE_TRANSPARENT_ON    = 39            # Transparent ON
#~   ROUTE_TRANSPARENT_OFF   = 40            # Transparent OFF
#~   ROUTE_CHANGE_GRAPHIC    = 41            # Change Graphic
#~   ROUTE_CHANGE_OPACITY    = 42            # Change Opacity
#~   ROUTE_CHANGE_BLENDING   = 43            # Change Blending
#~   ROUTE_PLAY_SE           = 44            # Play SE
#~   ROUTE_SCRIPT            = 45            # Script

# parameters - Extra parameters. Used with Jump, Wait, Switch On, Switch Off,
#              Change Speed, Change Frequency, Change Graphic, Change Opacity,
#              Play SE and Script.



<MESSAGE>

Spoiler for:
» Show Text
Spoiler for:
Code: [Select]
$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



<AUDIO>

Spoiler for:
» Start | Stop Audio
Spoiler for:
Code: [Select]
# Play BGM
Audio.bgm_play(fName, volume, pitch, pos)

# Play BGS
Audio.bgs_play(fName, volume, pitch, pos)

# Play ME
Audio.me_play(fName, volume, pitch)

# Play SE
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


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


# 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


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

# 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

# Play Battle Music
BattleManager.play_battle_bgm

# Play Battle Victory Music
BattleManager.play_battle_end_me



EDIT: Merged the two listings. Added 'Audio' section.
« Last Edit: August 27, 2013, 11:38:31 AM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
Project of the Year 20142014 Best RPG Maker User - Story2014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
This is a tremendous help, especially with the RTP challenge! Thanks guys. :D I think this will really even out things for everyone in the challenge, and open up some new doorways!

*edit*

I'm assuming everything falls under the challenge guidlines, except the "Scriptlets" section, right?
« Last Edit: August 27, 2013, 03:04:53 AM by yuyubabe »
Spoiler for 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]


*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Project of the Year2013 Best RPG Maker User (Programming)Participant - GIAW 11Bronze - GIAW 10
Yeap, the scriptlets require actual editing of the default script (but I thought they were neat anyway). Since the thread is basically just about default scripts, I'll remove them.

Also, this is not even a full listing. I highly suggest everyone poke, prod and experiment with functions available within the default scripts.
« Last Edit: August 27, 2013, 03:32:41 AM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
Rep:
Level 85
I solve practical problems.
For taking arms in the name of your breakfast.
This stuff sure is nifty, excellent work Exhydra!

*
A-pow 2015
Rep:
Level 81
2014 Best RPG Maker User - GraphicsFor frequently finding and reporting spam and spam bots2013 Most Unsung MemberSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.How can I help you? :Da^2 + b^2 = c^2Secret Santa 2012 ParticipantSilver - GIAW 10Silver - GIAW 9Bronze - GIAW HalloweenGold - Game In A Week VII
Wow, that's a nice list Exhydra. :o
Not a script call, but I just learned that you can select multiple event commands by holding shift.

*
A-pow 2015
Rep:
Level 81
2014 Best RPG Maker User - GraphicsFor frequently finding and reporting spam and spam bots2013 Most Unsung MemberSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.How can I help you? :Da^2 + b^2 = c^2Secret Santa 2012 ParticipantSilver - GIAW 10Silver - GIAW 9Bronze - GIAW HalloweenGold - Game In A Week VII
I don't think that's possible with just script calls since event data is on an 'on map' basis. I think there are some scripts out there for that though.

***
Rep:
Level 70
RMRK Junior
I've got to add some stuff to this.

First off, I dont have VXA, but the concepts between XP and VXA are probably quite similar.

One thing I screwed with was to make ANY event an Autorun or Parallel by putting the word "start" in a Move Route Script call.  Other things you can do with those script calls inside the Move Routes is to mess with Triggers.  For example, change a Parallel into an Event Touch by first making it a Parallel Event, then running a Script "@trigger = 2".  Or if you want an Event that can NEVER be triggered, Move Route Script "@trigger = -1"

Those short little Script calls inside the Move Route can make your Events do damn near ANYTHING.

For example, if you want an Exclamation Point Animation from a Move Rotue Script (XP) "@animation_id = 98"

Trigger an Event remotely:

$game_map.events[@event_id].start

Works even if the Event is set to NEVER trigger wtih @trigger = -1

The Move Route that I am referring to is the Autonomous Move Route where you set the Event to Fixed, Random, Approach or Custom, and use Custom.  So select Custom, set the Move Route, put in your Scripts, and uncheck Repeat.  Note:  If "Repeat" is NOT checked, then you are in the wrong Move Route window.  You do NOT want the one that appears when you double click on the RIGHT side.

A little scripting knowledge and a bit of cleverness goes a long way.

You can literally do ANYTHING inside a Script call.  Change Game Switches, Variables, other Event Self Switches, ANYTHING.

$game_switches[switch_id] = true / false
$game_variables[variable_id] = ANYTHING, including Strings, Arrays, Objects, etc!
$game_self_switches[[@map_id, @event_id, 'A']] = true / false

Hell, you can MOVE other Events from an external Events Move Route Command:

$>Move Down
$>Move Right
$>Script: $game_map.events[47].turn_left

You can even put in CONDITIONAL BRANCHES into your Move Route Scripts!

$>Script: turn_left if ($game_player.x == 42 and $game_player.y == 19)

I dont know how much niftier you can get other than to have FULL CONTROL over EVERYTHING in the entire game from nothing short of a Move Route Script!
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

*
Rep:
Level 85
I am the wood of my broom
2010 Project of the YearProject of the Month winner for January 2009Project of the Month winner for January 2010Project of the Month winner for April 2010
This topic is amazing ;~;


***
Rep:
Level 77
RMRK Junior
What's the script call for changing actor graphics? I can't seem to find it...

*
Rep:
Level 85
I am the wood of my broom
2010 Project of the YearProject of the Month winner for January 2009Project of the Month winner for January 2010Project of the Month winner for April 2010
Code: [Select]
# 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


***
Rep:
Level 70
RMRK Junior
[XP] Probably works on VX and VXA also.

Heres a couple more, this one I recently came up with, that works like an Internal "Wait for Move's Completion" from within the Move Route itself.

$>Wait: 1 Frame(s)
$>Script: @move_route_index -= 2 if (@y != 27)
$>Move Left

You can put whatever you want inside the () as a Condition.  You can also do other things that take care of an Event with an unpredictable position.  Parenthesis () are usually optional.

$>Move Right
$>Script: @move_route_index -= 2 if @x < 35
$>Move Down
$>Move Down
$>Turn Left

If you have additional Scripts installed, you can use Character and Event Methods that are defined from within those Scripts.  You can also call methods defined in Interpreter by using a Global and pointing to the 'map_interpreter'.  This is one trick I like to use for Animals that don't talk, but play a Sound.  It uses ForeverZer0's Event Range Conditions.  The Animal normally wanders with an Autonomous Move Route.  Then when the Player triggers the Animal, it plays a Sound then uses Set Move Route to continually turn toward the Player until the Player moves away from the Animal.  Otherwise the Animal just plays a sound and ignores the Player completely, which doesnt come across as being quite right.

@>Play SE: '067-Animal02, 80, 100
@>Set Move Route: This Event (Repeat Action)
 $>Turn Toward Player
 $>Script>@move_route.repeat = ($game_system.map_interpreter.range?(2, @id) ) ? true : false

As soon as the Player is more than 2 tiles away, the Repeat property is set to False, and the Animal goes back to doing what it was doing before.  You could also use a Move Away From Player with an Ignore if Cant Move Option for Squirrels and less human friendly small critters.  They 'run away'

Autonomous Move Route:
Speed: 3: Slow (doesnt matter as the Move Route changes the Speed)
Freq: 3: Low
$> Change Speed: 3
$>Turn at Random
$>1 Step Forward
(Repeat, Ignore)

Trigger: Event Touch

---

List of Event Commands:

@>Play SE: '077-Small04, 80, 100
@>Set Move Route: This Event (Repeat Action, Ignore If Can't Move)
  $>Change Speed: 5
  $>Move Away From Player
  $>Script>@move_route.repeat = ($game_system.map_interpreter.range?(4, @id) ) ? true : false

The above Move Route will play a Sound, then Repeat the Move Route until the Player moves away from the small Animal.

---

One that I find for Dialogue Heavy NPC's is to disable their Event Triggers by setting it to -1 to prevent Retriggering for one second.  It gives the Player a chance to walk away before becoming trapped in the Dialogue again.

Move Type: Random

@>(lots and lots of dialogue where Player spams the Action Button)
@>Set Move Route: This Event
  $>@trigger = -1 # Untriggerable
  $>@Wait: 20 frame(s)
  $>@trigger = 0 # Action Button
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

****
Rep:
Level 43
Somewhat got a project? (\ô/)
GIAW 14: ParticipantParticipant - GIAW 11
This is a really helpful and awesome topic. Can be really useful in my project too. :) (\s/)

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
Project of the Year 20142014 Best RPG Maker User - Story2014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
Oooh, neat ideas! Thanks for sharing, Heretic! :)
Spoiler for 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]