HomeGame GuidesAPI Code - Ficterra

API Code – Ficterra

Published on

ADVERTISEMENT

By northernamusements

Lists the functions, events, variables etc. you can utilize when coding mods for Ficterra in Miniscript.

Events

Event Functions

bind(event, func) – Binds a function (func) to be called when an event triggers. The Event should be from the list below (Event.x), the function should be a function you have created. Use @myFunction to reference a function.

Event List

Event.OnBiomeEntered – Triggers when your player enters a biome

id – the id of the Biome

name – the name of the biome

Event.OnItemEquipped – Triggers when your player equips an Item

id – the id of the Item

name – the name of the Item

Event.OnItemUnEquipped – Triggers when your player unequips an Item

id – the id of the Item

name – the name of the Item

Event.OnKilledMonster – Triggers when you players kills a monster

id – the id of the Monster (item id of the monster)

name – the name of the Monster

totalKilled – number of monsters with the same id this player has killed

Event.OnGainedItem – Triggers when your player gains an Item

id – the id of the Item

name – the name of the Item

totalAmount – the amount of the item your player now has

Event.OnRemovedItem – Triggers when your player loses an Item

id – the id of the Item

name – the name of the Item

totalAmount – the amount of the item your player now has

Event.OnFinishedCrafting – Triggers when your player finishes crafting

id – the id of the Crafting Plan

name – the name of the Crafting Plan

Event.OnFinishedResearch – Triggers when your player finished research

id – the id of the Research

name – the name of the Research

Event.OnCompletedQuest – Triggers when your player completes a Quest

id – the id of the Quest

Event.OnPlayerMoved – Trigger when your player has moved

playerId – net id of the player

Item Events

Item Event Functions

bindToItem(itemEvent, func, itemId) – Binds a function (func) to be called when an item event triggers for a specific type of item. The Item Event should be from the list below (ItemEvent.x), the function should be a function you have created, and the itemId is the id of the item this applies to. Use @myFunction to reference a function.

bindItemUpdate(func, itemId, setupFunc) – Binds a function (func) to be called in an item’s update loop. The itemId is the id of the item this applies to, func is the function that is called when the item updates (every tick), and setupFunc is a function that runs once to setup values or whatever you might need for the loop. Use @myFunction to reference a function.

Item Event List

ItemEvent.OnTriggerEntered – Triggers when an object enters this objects trigger area (is it has one)

objectId – the unique instance id of the object

itemId – the item id of the object

playerEnteredId – id of the entering player (if entered by a player)

objectEnteredId – id of the entering object (if entered by an object)

ItemEvent.OnTriggerExited – Triggers when an object exits this objects trigger area (is it has one)

objectId – the unique instance id of the object

itemId – the item id of the object

playerEnteredId – id of the entering player (if exited by a player)

objectEnteredId – id of the entering object (if exited by an object)

ItemEvent.OnInteract – Triggers when a player interacts with an object

objectId – the unique instance id of the object

itemId – the item id of the object

playerId – net id of the interacting player

ItemEvent.OnPlaceableCreated – Triggers when an object is created in the world

objectId – the unique instance id of the object

itemId – the item id of the object

Item Data

ItemData.Strength – Strength of a Cube

ItemData.MoveSpeed – Speed bonus while on the Cube

ItemData.Metallic – Metallic look of the Cube (from 0 to 1)

ItemData.Smoothness – Smoothness look of a Cube (from 0 to 1)

Damage Type

This is a list of all Damage Type values

  • DamageType.Sharp
  • DamageType.Blunt
  • DamageType.Piercing
  • DamageType.Fire
  • DamageType.Ice
  • DamageType.Electric
  • DamageType.Poison
  • DamageType.Metal
  • DamageType.Wood
  • DamageType.Stone
  • DamageType.Sonic
  • DamageType.Water
  • DamageType.Martial
  • DamageType.Radiation
  • DamageType.Acid
  • DamageType.Jade

Stat

This is a list of all Stat types

  • Stat.Health
  • Stat.Stamina
  • Stat.Speed
  • Stat.Carry_Limit
  • Stat.Armor
  • Stat.Woodworking
  • Stat.Masonry
  • Stat.Blacksmithing
  • Stat.Damage
  • Stat.Attack_Speed
  • Stat.Cooldown_Reduction
  • Stat.Body_Type
  • Stat.Elemental_Power
  • Stat.Resting_Heal
  • Stat.Crit_Chance
  • Stat.Penetration
  • Stat.Mastery
  • Stat.Dodge
  • Stat.Block
  • Stat.Battle_Regen
  • Stat.Life_Steal
  • Stat.Mend_Wounds

Global Variables and Functions

vector(x,y,z) – Creates a 3D Vector with x,y,z as coordinates (x is right, y is up, z is forward)

color(r,g,b,a) – Creates an RGBA Color

r – red value (0-1)

g – green value (0-1)

b – blue value (0-1)

a – alpha value (0-1, 0 is entirely transparent, 1 is opaque)

addVector(v1, v2) – Adds two vectors, v1 and v2 and returns the resulting vector

saveWorldStorage() – Saves your custom data associated with the world or game

loadWorldStorage() – Loads your custom data associated with the world or game

savePlayerStorage() – Saves your custom data associated with players

loadPlayerStorage() – Loads your custom data associated with players

getItemId(itemName, [modIdentifier]) – Gets an item id from an item’s name and optional mod identifier

getQuestId(questName, [modIdentifier]) – Gets an quest id from an quest’s name and optional

mod identifier

getResearchId(researchName, [modIdentifier]) – Gets an research id from an research’s name and optional mod identifier

getCubeId(cubeName, [modIdentifier]) – Gets an cube id from an cube’s name and optional mod identifier

hasQuest(questId) – Returns 1 if you have the quest, 0 otherwise

deltaTime() – Returns the time elapsed since the last update

getPlayer(playerId) – Gets an player object from its id

getLocalPlayer() – Gets the player object for your player

getPlaceable(placeableId) – Gets a placeable object from its unique id

giveItem(itemId, [amount],[playerId]) – Gives an ‘amount’ of item of itemId to player with id playerId. Amount is default 1 and playerId is by default your player’s id

takeItem(itemId, [amount],[playerId]) – Takes an ‘amount’ of item of itemId to player with id playerId. Amount is default 1 and playerId is by default your player’s id

giveQuest(questId, [ignorePrereq]) – Gives a quest of ‘questId’ to your player. Pass in 1 to ignorePrereq if you want to skip checking the prerequisites for the quest

playMusic(musicName) – Plays music with a given name

playSfx(sfxName) – Plays a sound effect with a given name

playSfxAtPoint(sfxName, position) – Plays a sound effect with a given name at a certain position. Position is a vector

takeDamage(target, damage, damageTypeId) – Causes target to take damage equal to ‘damage’ of the type ‘damageTypeId’. Target can be either a playerId or an object Id. DamageTypeId is from DamageType.X

heal(target, amount) – Causes target to heal equal to amount. Target can be either a playerId or an object Id.

runCommand(command) – Runs a console command. This is any of the commands that can be typed into the console ingame

moveTo(objectId,position,speed) – Moves an object to a position travelling at speed given

rotateTo(objectId,rotation,speed) – Rotates an object to a rotation with a angular velocity of speed. The Rotation is in euler angles

announce(text) – Shows text on the screen

getPlayerCount() – Returns the number of players in the game

createPlaceable(itemId,position) – Creates a new placeable object of the item with itemId at a position. Returns the unique instance id of the placeable object

setItemData(key,value,itemId) – Sets a value of all items of itemId. The key is from the ItemData.X.

getItemData(key,itemId) – Returns a value of all items of itemId. The key is from the ItemData.X.

Also the Inventory Object has 1 method:

hasItem(itemId, amount) – checks if the inventory has at least amount of an item given by itemId. Amount default is 1.

Player

These function are called on a Player object, ie player.func()

getPosition() – returns the position of the player

getRotation() – returns the rotation of the player (in euler angles)

getDirection() – returns the direction the player is facing

getCurrentStat(stat) – gets the current value of a player’s stat. Stat is from Stat.X

getMaxStat(stat) – gets the maximum value of a player’s stat. Stat is from Stat.X

setCurrentStat(stat) – sets the current value of a player’s stat. Stat is from Stat.X

setMaxStat(stat) – sets the maximum value of a player’s stat. Stat is from Stat.X

inventory() – gets the player’s inventory object

giveItem(itemId,amount) – gives the player ‘amount’ of an item with itemId

takeItem(itemId,amount) – takes the player ‘amount’ of an item with itemId

respawn() – causes the player to respawn

unlock(researchName) – unlocks a research for this player

giveResearch(researchName) – gives a research as an option for this player to research

Placeable

These functions are for a Placeable object, ie placeable.function()

getPosition() – returns the placeable’s position

getRotation() – returns the placeable’s rotation (in euler angles)

setPosition(position) – sets the placeable’s position

setRotation(rotation) – sets the placeable’s rotation (in euler angles)

getDirection() – returns the placeable’s facing direction

inventory() – returns the placeable’s facing direction

isAlive(id) – static function to check if a placeable with id still exists

isBeingCarried() – return 1 if currently being carried, otherwise 0

getData(key) – gets data saved on the placeable stored under key

setData(key,value) – sets data saved on the placeable stored under key as value

saveData() – saves stored data on this placeable to file (soon)

Latest articles

SEVENTEEN’s THE8 Gets Shocked By A Live Frog During A Fansign

An whole residing and respiration frog. ...

Minecraft Preview 1.19.40.23 brings improved vanilla parity, experimental adjustments, and extra

What it's essential knowMinecraft Preview 1.19.40.23 is the newest pre-release construct to turn into...

5 Letter Words with SOC in Them – Wordle Clue

There are so many alternative 5-letter phrases which may work for a...

Sunbreak 12.0 Update Brings New Quests, Monsters, And “Layered Equipment” System

Monster Hunter Rise: Sunbreak simply acquired its second Free Title Update, bringing new monsters,...
ADVERTISEMENT

More like this

SEVENTEEN’s THE8 Gets Shocked By A Live Frog During A Fansign

An whole residing and respiration frog. ...

Minecraft Preview 1.19.40.23 brings improved vanilla parity, experimental adjustments, and extra

What it's essential knowMinecraft Preview 1.19.40.23 is the newest pre-release construct to turn into...

5 Letter Words with SOC in Them – Wordle Clue

There are so many alternative 5-letter phrases which may work for a...