Skip to content

Script calls User API

Pheonix KageDesu edited this page Dec 29, 2023 · 13 revisions

⚠️ Information actual for version 0.9.2 and above


⚠️ Examples you can find in Demo Project, map uAPI (ID 5) 🗺️

ABS System

uAPI.resumeABS();
uAPI.pauseABS();
uAPI.scriptAction(ACTION, CHAR, DELAY);

ACTION - Script action
CHAR - null, $gamePlayer, event object or this (current Event) (OPTIONAL)
DELAY - delay before call in milliseconds (OPTIONAL)

Example: play Balloon animation 1 above this Event after 100ms delay - uAPI.scriptAction("ba_1", this, 100);
Example: turn ON self switch A for event 18 - uAPI.scriptAction("ss_A_true_18");

uAPI.playExtraAnimation(X, Y, FILENAME, SE, OX, OY);  // play extra animation in map point X, Y  

Extra animation - it's animation implemented by image separated by frames
It's same as <extraAnimation> ABS Skill parameter, read here for more details

Example: uAPI.playExtraAnimation(10, 10, "MeteorRain(19,3)", "Thunder8")

UI

uAPI.editUI(); // starts UI editor scene
uAPI.showUI();
uAPI.hideUI();
uAPI.resetUserUISettings(); // reset all UI settings (changed via Editor or Script calls) to defaults (from Plugin Parameters)  

Skill Panel

uAPI.setSkillToPanel(ID, SLOT_SYMBOL);
uAPI.setItemToPanel(ID, SLOT_SYMBOL);

ID - it's skill or item ID from database
SLOT_SYMBOL - it's slot key (1,2 or E...)

For remove item, use 0 instead ID
Example: Remove any skill from Slot 5 uAPI.setSkillToPanel(0, 5);

For add item\skill in any empty skill slot, not use any SLOT_SYMBOL (keep empty)
Example: Add item 10 in any empty slot uAPI.setItemToPanel(10);

uAPI.getSkillIdFromPanel(SLOT_SYMBOL);  //return skill or item ID from skill slot, or 0 if slot is empty

Camera

uAPI.enableMapScroll();
uAPI.disableMapScroll();
uAPI.resetMapScroll();  // reset camera to center

Enemies

uAPI.gainExpForEnemyDb( ENEMY_DB_ID, IS_SHOW_NOTIFY );  //get experience for enemy by his database ID
uAPI.gainExpForEnemyEv( EVENT_ID, IS_SHOW_NOTIFY );  //get experience for enemy by his Event ID on map (only for ABS events)  

IS_SHOW_NOTIFY - show popUp? true or false
Example: uAPI.gainExpForEnemyDb(10, true);

⚠️ Examples you can find in Demo Project, map Exp (ID 14) 🗺️

uAPI.getEnemyByLabel( LABEL );  //return first Game_Event object from Map by matching label ABS parameter
uAPI.getEnemiesByLabel( LABEL );  //return all Game_Events objects (array) from Map by matching label ABS parameter

Example: uAPI.getEnemyByLabel("boss"); // returns Game_Event object with enemy that have ABS parameter <label: boss>

uAPI.resetHpForEnemy( MAP_ID, EVENT_ID );  //reset stored HP for Event ID on MAP_ID

// EVENT_ID can be 0 - then for all events on MAP_ID
// MAP_ID can be 0 - then for all events on all maps (complete reset)

Example: uAPI.resetHpForEnemy(4); // reset stored HP value for ALL enemies on map with ID 4

Skills

uAPI.lastUsedSkill();   //return last used skill database object
uAPI.lastSkillUser();  // return last skill user, Character object (Event or Game_Player)
uAPI.lastUsedSkillTarget();  // return last used skill target, Character object (Event or Game_Player)

⚠️ Example (in Demo project) -> Skill 301 uses <onHit:ce_4> and call this script calls via Common Event 4

Pop Up's

You can show custom Pop Up's

uAPI.showPopUpOnChar(CHAR_ID, STYLE_ID, VALUE, IS_TEXT); // Show Pop Up Above Map Character (Event)

STYLE_ID - style ID from Plugin Parameters -> Pop Up Settings -> Pop Up Tables. Can be null (default style)

AABSZ_PopUpStyleId

IS_TEXT - show value as is, if IS_TEXT is true, in other case value will be Extended value

Example: uAPI.showPopUpOnChar(10, null, 'test', true) // Show "Test" Pop Up above Event with ID 10

uAPI.showPopUpOnMap(X, Y, STYLE_ID, VALUE, IS_TEXT); // Show Pop Up Above Map Cell (X, Y)
uAPI.showPopUpOnScreen(X, Y, STYLE_ID, VALUE, IS_TEXT); // Show Pop Up On Screen (X, Y - in pixels)

Other

uAPI.gainExpForParty(VALUE); //gain experience for party with PopUp
uAPI.gainGoldForParty(VALUE); //gain gold for party with PopUp
uAPI.gainHpForBattler(CHAR_ID, VALUE, IS_CRIT); //change enemy or character HP with PopUp text

Example: uAPI.gainHpForBattler(8, -10, false)// decrease HP by 10 for Enemy (event 8) and show's PopUp text above

uAPI.gainMpForBattler(CHAR_ID, VALUE, IS_CRIT); //change enemy or character MP with PopUp text
uAPI.makePlayerDodge(IS_FORCE); //make player dodge action, if IS_FORCE `true` - without any check

Example: uAPI.makePlayerDodge(false)// make player dodge action when it's ready (and can perform it)

⚠️ Examples you can find in Demo Project, map uAPI (ID 5) 🗺️

AABSZ_uAPIPOPUP