Professional Documents
Culture Documents
VXA Version:
https://docs.google.com/spreadsheets/d/1SPWPqSZ3I_LgilZse2I2sDPq-QyNQphb4T3i5aWMQic/edit?
UPDATED (04/23/2021, GMT+8:30) Discussion Thread:
usp=drive_web&ouid=112741546968112756440
- Updated Show Choices If you have any suggestions, just go here. This thread is being maintained by Archeia.
http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/
- Reformatting Spreadsheet https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/
http://forums.rpgmakerweb.com/index.php?/topic/46456-rpg-maker-mv-script-call-list/&page=1
Event Page 1
Message
$gameMessage.setFaceImage('Actor1',0)
$gameMessage.setBackground(1)
Show Text
$gameMessage.setPositionType(1)
$gameMessage.add("Show Text Script Call")
defaultType = The default choice that is selected when you press cancel button.
cancelType:
0 = If you cancel, First Choice will be automatically selected.
-1 = Disallow Cancelling
-2 = Show Cancel Button
Background:
0 = Window
1 = Dim
// Initialize Choices Array
2 = Transparent
const choices = ["choice1", "choice2", "choice3", "choice4", "choice5", "choice6", "choice7", "choice8"];
// Set Message Choices
Position Type:
$gameMessage.setChoices(choices, defaultType, cancelType);
0 = Left
// Set Message Background
1 = Center
$gameMessage.setChoiceBackground(background);
2 = Right
Show Choices // Set Message Position
$gameMessage.setChoicePositionType(positionType);
You can also use variables to form an array for Show Choices to something like this:
// Record Outcome in Variable #1
$gameMessage.setChoiceCallback(n => {
// Initialize Choices Array
this._branch[this._indent] = n;
$gameVariables.setValue(2,
$gameVariables.setValue(variableIndex, n);
[
});
"This is choice #1",
"This is choice #2",
"This is choice #3",
"This is choice #4",
"This is choice #5",
"This is choice #6",
"This is choice #7",
"This is choice #8"
]);
Party
Change Gold $gameParty.gainGold(n);
$gameParty.gainItem($dataItems[itemId], n);
Change Items
$gameParty.loseItem($dataItems[ID], amount);
Change Weapons $gameParty.gainItem($dataWeapons[weaponId], n, true/false *note); *note if decreasing, true will mean it will include already equipped weapons.
Change Armor $gameParty.gainItem($dataArmors[armorId], n, true/false *note); *note if decreasing, true will mean it will include already equipped armors.
$dataItems.forEach(function(item) {$gameParty.gainItem(item,99,false);});
Get All Items $dataArmors.forEach(function(armor){ $gameParty.gainItem(armor,99,false);});
$dataWeapons.forEach(function(weapon){ $gameParty.gainItem(weapon,99,false);});
$dataItems.forEach(function(item) {if (item && item.name) {$gameParty.gainItem(item,99,false);}});
Get All Items (unless the name is empty) $dataArmors.forEach(function(armor) {if (armor && armor.name) {$gameParty.gainItem(armor,99,false);}});
$dataWeapons.forEach(function(weapon) {if (weapon && weapon.name) {$gameParty.gainItem(weapon,99,false);}});
$gameParty.addActor(n);
Change Party Member To initialize: $gameActors.actor(actorId).setup(actorId);
$gameParty.removeActor(n);
Check Party Leader $gameParty.leader().actorId() == ID Replace ID with the ID of the actor you want to check.
Check Party Size $gameParty.members().length
Replace ACTORID with the ID of the actor you want to check
Check Party Index of a Character $gameParty.members().indexOf($gameActors.actor(ACTORID))
You can also use it like this: $gameParty.members().indexOf($gameActors.actor(1)) == 0
Game Progression
If you want to use in a condition's script condition with multiple switches to check:
Control Switches $gameSwitches.setValue(num, true/false); ($gameSwitches.value(1) == true) && ($gameSwitches.value(2) == true) && ($gameSwitches.
value(3) == true)
Example Randomized Variable Value:
Math.random()
It's from 0.0 to 1.0
// set variable 1 to an array of numbers
$gameVariables.setValue(1, [1, 2, 3]);
// Access variable 1, and index into the second element and set it to 10
$gameVariables.value(1)[1] = 10;
// print out variable 1, which is the array, which should now be [1, 10, 3]
console.log($gameVariables.value(1))
$gameMap._mapId
var key = [mapId, eventId, A-D]
Control Self Switch
$gameSelfSwitches.setValue(key, true); to check the current map id instead of manually inputting numbers.
Example:
var mapid = $gameMap._mapId;
var key = [mapid, 2, 'A'];
$gameSelfSwitches.setValue(key, true);
Flow Control
Conditional Branch if (code) { stuff } else { stuff }
Loop while (;;) { stuff }
Break Loop break;
Exit Event Processing $gameInterpreter._index = $gameInterpreter._list.length;
Exit Game SceneManager.exit();
$gameTemp.reserveCommonEvent(n);
Common Event
$gameTemp.clearCommonEvent(n);
Label
Jump to Label
// For Single Lines
// Is good for only a small chunk of code.
/* item */ is good if you want to batch comment.
Comment /* For
Multiple lines like this.
Not super useful for script calls though due to 210 line limit.
*/
Actor
Also allow using party member index: $gameParty.members()[index].gainHp(n)
Example Uses:
var m = $gameActors.actor(id)
-- Decrease Actor ID #1 by 70%
var d = damage
Change HP var m = $gameActors.actor(1)
var KO = true/false
var d = Math.round(-0.7*m.mhp)
Game_Interpreter.prototype.changeHp.call(this, m, d, KO);
var KO = true
Game_Interpreter.prototype.changeHp.call(this, m, d, KO);
$gameParty.members().forEach(function(m){ $gameParty.members().forEach(function(m){
m.recoverAll(); m.gainHp(Math.round(1*(m.mhp)));
Recover All }); m.gainMp(Math.round(1*(m.mmp)));
});
You can also use something like this for battle to include reserved members.
$gameParty.battleMembers().forEach(function(member){member.gainHp(your_formula_here)})
Change EXP $gameActors.actor(actorId).gainExp(n); Negative n if you want the actor to lose Exp.
NAME SCRIPT CALL COMMENT
Change Level $gameActors.actor(actorId).changeLevel(n, true/false); n = level the actor will become. true/false to show level up.
Negative n if you wish the actor to lose stats. Params: 0-MaxHP, 1-MaxMP, 2-ATK, 3-DEF, 4-
Change Parameters $gameActors.actor(actorId).addParam(paramId, n);
MAT, 5-MDEF, 6-AGI, 7-LUK
$gameActors.actor(actorId).learnSkill(n);
Change Skill
$gameActors.actor(actorId).forgetSkill(n);
Add All Skills $dataSkills.forEach(function(skill){ if(skill) $gameParty.leader().learnSkill(skill.id);}); replace $gameParty.leader() with any other actor
Change Equipment $gameActors.actor(actorId).changeEquip(slotId, item); item = $dataWeapons[n] or $dataArmors[n]
If you want to change an Actor's name based on another Actor's name:
Change Name $gameActors.actor(actorId).setName(n)
$gameActors.actor(actorId).setName($gameActors.actor(actorId).name())
Change Class $gameActors.actor(actorId).changeClass(n, keepExp) keepExp is either true or false
Change Nickname $gameActors.actor(actorId).setNickname(n)
Change Profile $gameActors.actor(actorId).setProfile(n)
Event Page 2
Movement
direction = Down(2), Left(4), Right(6), Up(8)
Transfer Player $gamePlayer.reserveTransfer(mapId, x, y, direction, fade type);
fade type = 0-Black, 1-White, 2-None
Set Vehicle Location $gameMap.vehicle(vehicleId).setLocation(mapId, x, y); t
Set Event Location $gameMap.event(eventID).setPosition(x, y);
direction = Down(2), Left(4), Right(6), Up(8)
Set Event Direction $gameMap.event(eventID).setDirection(direction); Example:
$gameMap.event(this._eventId).setDirection(2)
$gameMap.event(eventId).x
Check Event X / Y
$gameMap.event(eventId).y
$gameMap.event(eventId).screenX()
Check Event Screen X / Y
$gameMap.event(eventId).screenY()
Check Event Direction $gameMap.event(eventID).direction();
Set Player Location $gamePlayer.locate(x, y);
Set Player Direction $gamePlayer.setDirection(dir); direction = Down(2), Left(4), Right(6), Up(8)
Check Player Location $gamePlayer.pos(x, y)
Check Player Direction $gamePlayer.direction(); direction = Down(2), Left(4), Right(6), Up(8)
$gamePlayer.x;
Check Player Coordinates
$gamePlayer.y;
Set Follower Location $gamePlayer.followers().follower(index).setPosition(X, Y); Index starts at 0
Set Follower Direction $gamePlayer.followers().follower(index).setDirection(dir); direction = Down(2), Left(4), Right(6), Up(8)
$gamePlayer.followers().follower(index).x
Check Follower Coordinates Index starts at 0
$gamePlayer.followers().follower(index).y
Check Follower Direction $gamePlayer._followers.follower(index).direction();
TouchInput._x
Mouse / Touch Input X / Y
TouchInput._y
Check Map ID $gameMap._mapId;
Scroll Map $gameMap.startScroll(direction, distance, speed); direction = Down(2), Left(4), Right(6), Up(8)
Example:
$gameScreen.startZoom($gamePlayer.screenX(), $gamePlayer.screenY(), 2.5, 60);
Instant Zoom:
Zoom $gameScreen.startZoom(x,y,zoom,wait);
$gameScreen.setZoom(x,y,zoom);
Clear Zoom
$gameScreen.clearZoom();
Change Player Camera Position $gamePlayer.center(x, y) replace x/y with map coordinates.
Change Map Camera $gameMap.setDisplayPos(x, y)
In rpg_objects.js look for the following:
Game_Character.prototype.processMoveCommand = function(command) {
Example:
Set Movement Route For Events: $gameMap.event(5).moveStraight(4);
$gameMap.event(id).command(x);
$gameMap.event(id)._moveType = x;
0 = Fixed, 1 = Random, 2 = Approach
$gameMap.event(id)._trigger = x;
0 = Action, 1 = Player Touch, 2 = Event Touch, 3 = Autorun, 4 = Parallel
//for this example "charEvent" is the event you want to move, but you can use $gameMap._events
var charEvent = $gameMap._events[id];
Set Movement Route (Default Pathfinding) Remember that default pathfinding has a limit
// THIS IS THE IMPORTANT LINE, of course you have to put real coordinates instead of x & y
charEvent.moveStraight( charEvent.findDirectionTo(x, y) );
Set Destination $gameTemp.setDestination(mapX, mapY)
Get ON/OFF Vehicle $gamePlayer.getOnOffVehicle();
Timing
Only one wait will work in a script call. It's because a script call runs everything at once within that
Wait this.wait(frames)
block. The only way to work around with it is having a custom method or set a timeout.
Character
Change Transparency $gamePlayer.setTransparent(flag) flag = true / false
Change Player Followers $gamePlayer.showFollowers(); $gamePlayer.hideFollowers(); Might need $gamePlayer.refresh();
Gather Followers $gamePlayer.gatherFollowers(); this.setWaitMode('gather');
Replace character with one of these:
- $gamePlayer;
- $gameMap.event(ID);
- For "This Event" $gameMap.event(this._eventId)
For Example:
var character = $gameMap.event(1);
var id = 1;
character.requestAnimation(id);
Replace character with one of these: $gamePlayer; $gameMap.event(ID);
Show Balloon Icon character.requestBalloon(id); this.setWaitMode('balloon');
For example: $gameMap.event(6).requestBalloon(3); this.setWaitMode('balloon');
Erase Event $gameMap.eraseEvent(this._eventId);
Screen
Fadeout Screen $gameScreen.startFadeOut(fade_speed); Default is 24
FadeIn Screen $gameScreen.startFadeIn(fade_speed); might want to call wait to go with it, by default the event command does
red,green,blue between -255 to 255, grey between 0 and 255, if you want wait for completion call
Tint Screen $gameScreen.startTint([red,green,blue,grey], duration);
the following $gameInterpreter.wait(duration);
All between 0 and 255, if you want wait for completion call the following $gameInterpreter.wait
Flash Screen $gameScreen.startFlash([red, green, blue, intensity], duration);
(duration);
Shake Screen $gameScreen.startShake(power, speed, duration); If you want wait for completion call the following $gameInterpreter.wait(duration);
Weather = "none","rain","storm","snow". If you want wait for completion call the following
Set Weather Effect $gameScreen.changeWeather("weather", power, duration);
$gameInterpreter.wait(duration);
Picture
$gameScreen.showPicture(pictureId, name, origin, x, y,
Show Picture
scaleX, scaleY, opacity, blendMode)
$gameScreen.movePicture(pictureId, origin, x, y, scaleX,
Move Picture
scaleY, opacity, blendMode, duration)
Picture Blend Mode $gameScreen._pictures[id]._blendMode = #
alernatively:
Rotate Picture $gameScreen.rotatePicture(pictureId, speed);
$gameScreen._pictures[ID]._angle = Math.floor($gameScreen._pictures[ID]._angle + NUM)
Tint Picture $gameScreen.tintPicture(pictureId, tone, duration);
Erase Picture $gameScreen.erasePicture(pictureId);
// Erase Pictures
for (var i = 1; i <= 100; ++i) {
Erase all displayed pictures
$gameScreen.erasePicture(i);
}
Audio & Video
Sound Object: { name: filename, volume: n, pitch: n, pan: n }
Play BGM AudioManager.playBgm( refer to sound object above );
Fadeout BGM AudioManager.fadeOutBgm(n);
Save BGM $gameSystem.saveBgm();
Replay BGM $gameSystem.replayBgm();
Play BGS AudioManager.playBgs( refer to sound object above );
Fadeout BGS AudioManager.fadeOutBgs(n);
Play ME AudioManager.playMe( refer to sound object above );
Play SE AudioManager.playSe( refer to sound object above );
Stop SE AudioManager.stopSe();
Play Movie Graphics.playVideo(path/name.ext);
Event Page 3
Scene Control
BattleManager.setup(troopId, true/false, true/false);
Battle Processing $gamePlayer.makeEncounterCount(); First true/false is for allowing to Escape, 2nd true/false is for allowing the player to lose
SceneManager.push(Scene_Battle);
Shop Processing SceneManager.push(Scene_Shop);
SceneManager.push(Scene_Name);
Name Input Processing
SceneManager.prepareNextScene(actorId, name length);
Open Menu Screen SceneManager.push(Scene_Menu);
If you want to check if your game has any savefiles at all:
DataManager.isAnySavefileExists()
Open Save Screen SceneManager.push(Scene_Save);
Useful for custom title screens that are evented.
Open Load Screen SceneManager.push(Scene_Load);
$gameSystem.onBeforeSave();
if (DataManager.saveGame(index)) {
Create Save File Replace index with the save file you want. e.g. StorageManager.remove(1);
StorageManager.cleanBackup(index);
} or for Loading use below. (Warning might cause page error if versionId is not working properly.)
StorageManager.removeAllStorage = function() {
for (var i = 0; i < 20; i++) {
A simple script call where it loops to delete 20 save files: this.remove(i);
}
var i; };
Delete all Save Files
for (i = 0; i < 20; i++) { and script call will be:
StorageManager.remove(i);
} StorageManager.removeAllStorage();
There is no way out of the box to know the maximum file size MV has since it's hardcoded. You
could change the 20 to like a plugin parameter if you have a plugin that changes the max amount
though.
Check if any Save File exists DataManager.isAnySavefileExists() returns true/fase
Check if a Save File exists StorageManager.exists(id) id = save file slot. Starting from 1.
Game Over SceneManager.goto(Scene_Gameover);
Return to Title Screen SceneManager.goto(Scene_Title);
You can also in theory do something like this:
$gameMap.event(ID).copyPosition({_x: 0, _y: 0, _realX: 100, _realY: 100, _direction: 8});
$gameMap.event(ID).copyPosition($gameMap.event(ID));
Copy Position of the Player/Event/Object
Basically it means you can make a variable and set it to that object and have events clone that. So
if it changes everything is cloning from the same place. At least in terms of position.
Copy just the direction of the Player/Event/Object $gameMap.event(ID).setDirection($gameMap.event(ID).direction())
You can either use it as the following:
$gameMap.event(8).start();
$gameMap.event(EventID, EventPage).start();
Call Event
(or use this instead since this is more complicated: http://yanfly.moe/2016/06/24/yep-110-call-event-rpg-maker-mv/)
For a specific page:
$gameMap.event(8,3).start();
Map
$gameMap.enableNameDisplay();
Change Map Name Display
$gameMap.disableNameDisplay();
Change Tileset $gameMap.changeTileset(n);
Change Tileset Z Value $dataMap.data[(Z * $dataMap.height + Y) * $dataMap.width + X] = TILEID; Used to change a tile in coordonate X,Y with (TILEID) on the layer Z!
Change Battleback $gameMap.changeBattleback(filename, filename);
Change Parallax $gameMap.changeParallax(name, loopX, loopY, speed x, speed y);
$gameMap.terrainTag(x, y);
Get Location Info $gameMap.eventIdXy(x, y);
$gameMap.tileId(x, y, layer);
$gamePlayer.regionId() Use gamePlayer version to grab player's region ID.
Get Region for Player and Events
$gameMap.regionId(x, y); Set x and y to the x, y of the tile or event.
System Settings
Change Battle BGM $gameSystem.setBattleBgm(name);
Change Victory ME $gameSystem.setVictoryMe(name);
Change Defeat ME $gameSystem.setDefeatMe(name);
Change Vehicle BGM $gameMap.vehicle(vehicleId).setBgm(name);
$gameSystem.disableSave();
Change Save Access
$gameSystem.enableSave();
$gameSystem.disableMenu();
Change Menu Access
$gameSystem.enableMenu();
$gameSystem.disableEncounter();
Change Encounter
$gameSystem.enableEncounter();
$gameSystem.disableFormation();
Change Formation Access
$gameSystem.enableFormation();
Change Window Color $gameSystem.setWindowTone(tone); (red, green, blue, gray);
$gameActors.actor(actorId).setCharacterImage("name", index);
$gameActors.actor(actorId).setFaceImage("name", index):
Change Actor Images Might need $gamePlayer.refresh();
$gameActors.actor(actorId).setBattlerImage("name");
Battle
Use negative n if you want the enemy to lose HP.
Example:
var m = $gameTroop.members()[ID]
var d = damage
Change Enemy HP Kill an enemy immediately:
var KO = true/false
var m = $gameTroop.members()[0]
Game_Interpreter.prototype.changeHp.call(this, m, d, KO);
var d = Math.round(-m.mhp)
var KO = true
Game_Interpreter.prototype.changeHp.call(this, m, d, KO);
Change Enemy MP $gameTroop.members()[enemyIndex].gainMp(n); Use negative n if you want the enemy to lose MP.
Change Enemy TP $gameTroop.members()[enemyIndex].gainTp(n); Use negative n if you want the enemy to lose TP.
$gameTroop.members()[enemyIndex].addState(n);
Change Enemy State
$gameTroop.members()[enemyIndex].removeState(n);
Enemy Recover All $gameTroop.members()[enemyIndex].recoverAll();
Enemy Appear $gameTroop.members()[enemyIndex].appear();
Enemy Transform $gameTroop.members()[enemyIndex].transform(n); n is the enemy ID you want the enemy to transform into.
Show Battle Animation $gameTroop.members()[enemyIndex].startAnimation(animationId, true/false, delayN); true/false is for mirror. delayN is for the frames to delay the animation.
$gameParty.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameParty.members()[index]);
Force Action TargetIndex= "-1" for random and "-2" for last target.
$gameTroop.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameTroop.members()[index]);
Abort Battle BattleManager.abort();
Advanced
var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
Actor Stats
HP $gameActors.actor(actorId).hp
MaxHP $gameActors.actor(actorId).mhp
MP $gameActors.actor(actorId).mp
MaxMP $gameActors.actor(actorId).mmp
ATK $gameActors.actor(actorId).param[2]
DEF $gameActors.actor(actorId).param[3]
MAT $gameActors.actor(actorId).param[4]
MDF $gameActors.actor(actorId).param[5]
AGI $gameActors.actor(actorId).param[6]
LUK $gameActors.actor(actorId).param[7]
You can also check for multiple skills. Example:
var a = Actor ID
$gameActors.actor(1).skills().contains($dataSkills[14,15,16]);
Check if an Actor have X Skill var b = Skill ID
$gameActors.actor(a).skills().contains($dataSkills[b]);
This will check if character has skills 14, 15, 16
# 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
# Checking Actors
# ----------------------------------------------
$game_actors[X].name # Returns the name of the actor X
$game_actors[X].nickname # Returns the nickname of the $gameActors.actor(actorId).name()
actor X $gameActors.actor(actorId).nickname()
$game_actors[X].class.id # Returns the ID of the actor X $gameActors.actor(actorId).currentClass().id
class $gameActors.actor(actorId).currentClass().name
$game_actors[X].class.name # Returns the name of the
actor X class
# Screen Clean Up
# ----------------------------------------------
# Clear Fade
# Clear Tone
# Clear Flash
# Clear Shake $gameScreen.clear();
# Clear Weather
# Clear Pictures $gameScreen.clearTone();
$game_map.screen.clear
$gameScreen.clearFlash();
# Clear Tone (Immediate)
$game_map.screen.clear_tone $gameScreen.clearShake();
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)
# ----------------------------------------------
# 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.)
# 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
$gameActors.actor(actor_id).equips()[slot_id] == null;
*change null to id
# Or get their properties with with:
right_hand.id
right_hand.name
right_hand.icon_index
right_hand.description
# etc..
# 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.
# or:
y = SceneManager.scene.log_window
y.add_text(text)
# ----------------------------------------------
# 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.)
$game_player.center($game_player.x, $game_player.y)
You can set an event or the player to be in the center of the $gamePlayer.center($gamePlayer.x, $gamePlayer.y)
screen. It snaps but it's pretty good :D!
$gameSystem.onBeforeSave();
DataManager.save_game(0)SceneManager.goto(Scene_Map) DataManager.saveGame(id);
SceneManager.goto(Scene_Map);
example use:
callErik = function(){
Load Script Calls from js file PluginManager.loadScript(filename); alert('Erik is gay af');
};
call Erik();