These are the exported Core Scripting API functions available from all modules. There are numerous types used in this documentation:
You can try out a Blockly interface for the scripting API here
| Return type | Function and Description |
|---|---|
Action |
ActionAttack(Creature target)
Create attack action
|
Action |
ActionCastSpellAt(String id,
int x,
int y)
Create cast spell action
|
Action |
ActionCastSpellOn(String id,
Creature target)
Create cast spell action
|
Action |
ActionForceMove(int x,
int y,
Map m)
Create force move action
|
Action |
ActionInteract(int x,
int y)
Create interact action
|
Action |
ActionMove(int x,
int y)
Create move action
|
Action |
ActionTeleport(int x,
int y,
Map m)
Create teleport action
|
Action |
ActionUseItemAt(Item item,
int x,
int y)
Create use item action
|
Action |
ActionUseItemOn(Item item,
Creature target)
Create use item action
|
Action |
ActionUseSkillAt(String id,
int x,
int y)
Create use skill action
|
Action |
ActionUseSkillOn(String id,
Creature target)
Create use skill action
|
void |
AddClass(String id,
String name)
Add character class to be used for creating new PCs
|
void |
AddItemToContainer(Container c,
Item item)
Add item to container
|
void |
AddQuestEntry(String questId,
String entryId)
Add quest entry
|
void |
AddQuestLog(String id,
boolean finished)
Add quest log supplied as finished or active
|
void |
AddSkill(Creature pc,
String id)
Add skill (learn it) to creature
|
void |
AddSP(Creature pc,
int sp)
Add SP for player
|
void |
AddSpell(Creature pc,
String id)
Add spell (learn it) to creature
|
void |
AddTextLog(String line)
Add line to text log shown to player
|
void |
Animation(int x,
int y,
int icon,
int start,
int length,
String text)
Animation to be run, will lock UI until finished
|
void |
ApplyEffect(Effect fx,
Creature c)
Apply effect on creature
After applying the effect the effect object should not be applied to another creature
|
TileEffect |
ApplyEffectAtPosition(Effect fx,
Map map,
int x,
int y)
Add effect as a TileEffect
|
void |
AutoSave()
Auto saves game on a auto save spot
|
int |
CalculateToHit(Creature attacker,
Creature target)
Get to hit % if attacking target with current weapon
|
boolean |
CanSee(Creature c,
int x,
int y)
Check if creature can see tile
|
Container |
CreateContainer()
Create an empty container
|
Entity |
CreateEntity(String id)
Create new entity using supplied blueprint
|
Container |
CreateLoot(Map map,
int x,
int y)
Create loot container
|
void |
Debug(String s)
Debug print out
|
void |
DestroyEntity(Entity e) |
int |
DiceRoll(String s)
Roll dice from string, i.e.
|
boolean |
DoAction(Creature pc,
Action a)
Do action instantly
|
Effect |
EffectBless(int dur,
int amount)
Create BLESS effect
|
Effect |
EffectBurn(int dur,
int amount)
Create BURN effect
|
Effect |
EffectCure()
Create CURE effect
|
Effect |
EffectCurse(int dur,
int amount)
Create CURSE effect
|
Effect |
EffectCustom(int dur,
String onApply,
String onRemove)
Create CUSTOM effect
|
Effect |
EffectDamage(int amount)
Create DAMAGE effect
|
Effect |
EffectFreeze(int dur,
int amount)
Create FREEZE effect
|
Effect |
EffectHaste(int dur,
int amount)
Create HASTE effect
|
Effect |
EffectHeal(int amount)
Create HEAL effect
|
Effect |
EffectPierce(int dur,
int amount)
Create PIERCE effect
|
Effect |
EffectPoison(int dur,
int amount)
Create POISON effect
|
Effect |
EffectShield(int dur,
int amount)
Create SHIELD effect
|
Effect |
EffectSlow(int dur,
int amount)
Create SLOW effect
|
Effect |
EffectStrengthen(int dur,
int amount)
Create a STRENGTHEN effect
|
Effect |
EffectVisual(int dur,
int icon)
Create VISUAL effect
|
Effect |
EffectWeaken(int dur,
int amount)
Create WEAKEN effect
|
void |
EndGame()
End module
|
LuaTable |
FindPath(Map m,
int fx,
int fy,
int tx,
int ty)
Find shortest path from one space to another
|
LuaTable |
FindPathThroughDoors(Map m,
int fx,
int fy,
int tx,
int ty)
Find shortest path from one space to another through doors
|
int |
GetAIR(Creature c)
Get AIR skill value
|
int |
GetAP(Creature c)
Get current AP
|
int |
GetARC(Creature c)
Get ARC skill value
|
int |
GetArmor(Creature c)
Get total armor for creature
|
int |
GetArmorPenalty(Creature c)
Get total armor penalty
|
int |
GetATK(Creature c)
Get ATK skill value
|
String |
GetBlueprintId(Entity e)
Get blueprint id from entity
|
Container |
GetContainer(String iid)
Get created container by its iid field
|
int |
GetCooldown(Creature pc,
String id)
Get skill cooldown
|
Creature |
GetCreatureAtPosition(Map map,
int x,
int y)
Get creature at position on map (nil if not found)
|
LuaTable |
GetCreatures(Map map)
Get all creatures on map
|
int |
GetDamageBonus(Creature c)
Get damage bonus for creature
|
int |
GetDEF(Creature c)
Get DEF skill value
|
int |
GetDEX(Creature c)
Get DEX of creature
|
int |
GetDisarmRating(Trap t)
Get disarm rating for trap
|
LuaTable |
GetEffects(Creature c)
Get active effects on creature
|
LuaTable |
GetEffectsAtPosition(Map map,
int x,
int y)
Get effects at position on map
|
String |
GetEffectType(Effect fx)
Get effect type
|
Item |
GetEquipped(Creature pc,
String slot)
Get equipped item in slot
|
int |
GetERT(Creature c)
Get ERT skill value
|
int |
GetFIR(Creature c)
Get FIR skill value
|
String |
GetGlobalVar(String var) |
int |
GetGold(Creature pc)
Get gold creature carries
|
boolean |
GetHasVisited(String mapId)
Check if players have visited a map
|
int |
GetHP(Creature c)
Get current HP
|
String |
GetIID(Entity e)
Get Instance ID of entity (unique id of entity)
|
int |
GetINT(Creature c)
Get INT of creature
|
boolean |
GetIsEnemy(Creature c)
Get IsEnemy value
|
int |
GetItemArmor(Item item)
Get item armor bonus
|
int |
GetItemArmorPenalty(Item item)
Get item armor penalty
|
String |
GetItemDamage(Item item)
Get item damage dice
|
int |
GetItemGold(Item item)
Get item value in gold
|
boolean |
GetItemIdentified(Item item)
Get if item is identified or not
|
Entity |
GetItemOwner(Item i)
Get item owner
|
LuaTable |
GetItems(Creature pc)
Get inventory of creature
|
LuaTable |
GetItemsInContainer(Container c)
Get items in container
|
String |
GetItemType(Item item)
Get item type
|
int |
GetItemUses(Item item)
Get item uses
|
String |
GetLocalVar(Entity e,
String var)
Get local variable
|
int |
GetLOR(Creature c)
Get LOR skill value
|
int |
GetLUK(Creature c)
Get LUK skill value
|
Map |
GetMap(String id)
Get map from id
|
Map |
GetMapFromCreature(Creature c)
Get map from creature
|
int |
GetMaxHP(Creature c)
Get maximum HP
|
int |
GetMaxMP(Creature c)
Get maximum MP
|
int |
GetMP(Creature c)
Get current MP
|
String |
GetName(Entity e)
Get name of creature/item
|
LuaTable |
GetParty()
Get party list
|
PointF |
GetPosition(Creature c)
Get creature position
|
LuaTable |
GetSkills(Creature c)
Get list of skills known to creature
|
int |
GetSpellCost(String id)
Get cost of spell
|
LuaTable |
GetSpells(Creature c)
Get list of spells known to creature
|
String |
GetSpellTargetType(String id)
Get target type of spell
|
int |
GetSTR(Creature c)
Get STR of creature with effects
|
int |
GetTHF(Creature c)
Get THF skill value
|
String |
GetTile(Map m,
int x,
int y)
Get tile from map
|
Trap |
GetTrap(Map map,
int x,
int y)
Get trap object from position
|
PointF |
GetTrapPosition(Trap t)
Get position of trap
|
int |
GetWOD(Creature c)
Get WOD skill value
|
int |
GetWTR(Creature c)
Get WTR skill value
|
void |
GiveItem(Item i,
Creature c)
Give item to creature
|
boolean |
HasQuestEntry(String questId,
String entryId)
Check for active quest entry
|
boolean |
HasRequirement(Creature pc,
String id)
Check if creature has requirements for Spell or Skill
|
boolean |
HasSkill(Creature c,
String id)
Check if creature has skill
|
boolean |
HasSpell(Creature c,
String id)
Check if creature has spell
|
boolean |
IsCreature(java.lang.Object o)
Check if object is creature
|
boolean |
IsInCombat()
Check if PCs are engaged in combat or not
|
boolean |
IsItem(java.lang.Object o)
Check if object is item
|
boolean |
IsOutdoor(Map m)
Get outdoor flag of map
|
void |
MoveTrap(Trap t,
Map map,
int x,
int y)
Move trap to a new position
|
void |
OpenContainer(Container c)
Open container screen
|
void |
OpenShop(Creature shop)
Opens shop ui
|
void |
OpenTravelMap(String mapId,
String locId)
Open travel map screen on supplied map
|
Trap |
PlaceTrap(String id,
Map map,
int x,
int y)
Place a newly created trap on the map
|
void |
RemoveEffect(Creature c,
Effect fx)
Remove effect from creature
|
void |
RemoveLoot(Map map,
int x,
int y)
Remove loot container from map
|
void |
RemoveQuestEntry(String questId,
String entryId)
Remove quest entry
|
void |
RemoveQuestLog(String id)
Remove quest log from finished or active
|
void |
RemoveTileEffect(TileEffect fx)
Remove effect from map
|
void |
RemoveTrap(Trap t)
Remove trap from map
|
void |
SaveGame(boolean partyOnly)
Opens the saved game UI allowing user to save the game
|
void |
SetContainerOnClose(Container c,
String onClose) |
void |
SetGlobalVar(String var,
String val) |
void |
SetGold(Creature pc,
int gold)
Set new gold amount for creature
|
void |
SetIsEnemy(Creature c,
boolean enemy)
Set enemy flag
|
void |
SetItemArmor(Item item,
int n)
Set item armor bonus
|
void |
SetItemArmorPenalty(Item item,
int n)
Set item armor penalty
|
void |
SetItemDamage(Item item,
String damage)
Set item damage dice
|
void |
SetItemGold(Item item,
int gold)
Set item gold value
|
void |
SetItemIdentified(Item item,
boolean identified)
Set item to identified or not
|
void |
SetItemUses(Item item,
int uses)
Set item uses
|
void |
SetLocalVar(Entity e,
String var,
String val)
Set local variable
|
void |
SetMP(Creature c,
int mp)
Set current MP
|
void |
SetTile(Map m,
int x,
int y,
String tile)
Set tile on map
|
void |
SetTravelLocationVisible(String mapId,
String locId,
boolean visible)
Set location on travel map visible or hidden
|
void |
ShowPopupText(String text)
Show popup text that disappears by itself
|
void |
StartConversation(String id)
Start conversation
|
void |
StartEncounter(String id,
Map map,
int x,
int y)
Start encounter, spawning everything defined
|
void AddClass(String id,
String name)
id - Blueprint used for creating classname - Name of classvoid AddSP(Creature pc,
int sp)
pc - Creature to get SPsp - Amount of SP to addEntity CreateEntity(String id)
id - Blueprintvoid DestroyEntity(Entity e)
String GetBlueprintId(Entity e)
e - Entity (Creature, Map...)Action ActionMove(int x,
int y)
x - Positiony - PositionDoAction(Creature, Action)Action ActionTeleport(int x,
int y,
Map m)
x - Positiony - Positionm - MapDoAction(Creature, Action)Action ActionForceMove(int x,
int y,
Map m)
x - Positiony - Positionm - MapDoAction(Creature, Action)Action ActionAttack(Creature target)
target - Target creatureDoAction(Creature, Action)Action ActionInteract(int x,
int y)
x - Positiony - PositionDoAction(Creature, Action)Action ActionUseSkillOn(String id,
Creature target)
id - Skilltarget - Target creatureDoAction(Creature, Action)Action ActionUseSkillAt(String id,
int x,
int y)
id - Skillx - Targety - TargetDoAction(Creature, Action)Action ActionCastSpellOn(String id,
Creature target)
id - Spelltarget - Target creatureDoAction(Creature, Action)Action ActionCastSpellAt(String id,
int x,
int y)
id - Spellx - Targety - TargetDoAction(Creature, Action)Action ActionUseItemOn(Item item,
Creature target)
item - Itemtarget - TargetDoAction(Creature, Action)Action ActionUseItemAt(Item item,
int x,
int y)
item - Itemx - Targety - TargetDoAction(Creature, Action)boolean DoAction(Creature pc,
Action a)
pc - Creature to perform actiona - Action to performLuaTable GetParty()
Map GetMap(String id)
id - ID of mapMap GetMapFromCreature(Creature c)
c - Creatureboolean IsOutdoor(Map m)
m - MapString GetTile(Map m,
int x,
int y)
m - Mapx - Positiony - Positionvoid SetTile(Map m,
int x,
int y,
String tile)
m - Mapx - Positiony - Positiontile - New tile (one character string)boolean GetHasVisited(String mapId)
mapId - ID of mapEffect EffectStrengthen(int dur,
int amount)
dur - Duration of effectamount - Bonus amountApplyEffect(Effect, Creature)Effect EffectWeaken(int dur,
int amount)
dur - Duration of effectamount - Weaken amountApplyEffect(Effect, Creature)Effect EffectBless(int dur,
int amount)
dur - Duration of effectamount - Bless amountApplyEffect(Effect, Creature)Effect EffectCurse(int dur,
int amount)
dur - Duration of effectamount - Curse amountApplyEffect(Effect, Creature)Effect EffectHaste(int dur,
int amount)
dur - Duration of effectamount - Haste amountApplyEffect(Effect, Creature)Effect EffectSlow(int dur,
int amount)
dur - Duration of effectamount - Slow amountApplyEffect(Effect, Creature)Effect EffectPoison(int dur,
int amount)
dur - Duration of effectamount - Poison amountApplyEffect(Effect, Creature)Effect EffectCure()
ApplyEffect(Effect, Creature)Effect EffectDamage(int amount)
amount - Damage amountApplyEffect(Effect, Creature)Effect EffectHeal(int amount)
amount - Heal amountApplyEffect(Effect, Creature)Effect EffectShield(int dur,
int amount)
dur - Duration of effectamount - Shield amountApplyEffect(Effect, Creature)Effect EffectPierce(int dur,
int amount)
dur - Duration of effectamount - Pierce amountApplyEffect(Effect, Creature)Effect EffectVisual(int dur,
int icon)
dur - Duration of effecticon - IconApplyEffectAtPosition(Effect, Map, int, int)Effect EffectBurn(int dur,
int amount)
dur - Durationamount - DamageApplyEffect(Effect, Creature)Effect EffectFreeze(int dur,
int amount)
dur - Durationamount - DamageApplyEffect(Effect, Creature)Effect EffectCustom(int dur,
String onApply,
String onRemove)
dur - Duration of effectonApply - Script to runonRemove - Script o run when effect is removedApplyEffectAtPosition(Effect, Map, int, int)void ApplyEffect(Effect fx,
Creature c)
fx - Effect objectc - Creature to receive effectTileEffect ApplyEffectAtPosition(Effect fx,
Map map,
int x,
int y)
fx - Effect to base tile effect on (copied)map - Mapx - Positiony - PositionLuaTable GetEffectsAtPosition(Map map,
int x,
int y)
map - Mapx - Positiony - PositionApplyEffectAtPosition(Effect, Map, int, int)void RemoveTileEffect(TileEffect fx)
fx - TileEffect objectGetEffectsAtPosition(Map, int, int)String GetItemType(Item item)
item - ItemString GetItemDamage(Item item)
item - Itemvoid SetItemDamage(Item item,
String damage)
item - Itemdamage - Damage dice as string, ex 2d4+2int GetItemArmor(Item item)
item - Itemvoid SetItemArmor(Item item,
int n)
item - Itemn - Armor bonusint GetItemArmorPenalty(Item item)
item - Itemvoid SetItemArmorPenalty(Item item,
int n)
item - Itemn - Armor penaltyint GetItemUses(Item item)
item - Itemvoid SetItemUses(Item item,
int uses)
item - Itemuses - Number of usesint GetItemGold(Item item)
item - Itemvoid SetItemGold(Item item,
int gold)
item - Itemgold - New gold amountvoid SetItemIdentified(Item item,
boolean identified)
item - Itemidentified - Identified item if trueboolean GetItemIdentified(Item item)
LuaTable GetEffects(Creature c)
c - Creaturevoid RemoveEffect(Creature c,
Effect fx)
c - Creaturefx - Effect objectGetEffects(Creature)String GetEffectType(Effect fx)
fx - Effect objectPointF GetPosition(Creature c)
c - CreatureLuaTable GetSpells(Creature c)
c - Creatureboolean HasSpell(Creature c,
String id)
c - Creatureid - Spell idint GetSpellCost(String id)
id - Spell idString GetSpellTargetType(String id)
id - Spell idLuaTable GetSkills(Creature c)
c - Creatureboolean HasSkill(Creature c,
String id)
c - Creatureid - Skill idint GetSTR(Creature c)
c - Creatureint GetDEX(Creature c)
c - Creatureint GetINT(Creature c)
c - Creatureint GetHP(Creature c)
c - Creatureint GetMaxHP(Creature c)
c - Creatureint GetMP(Creature c)
c - Creaturevoid SetMP(Creature c,
int mp)
c - Creaturemp - new MP amountint GetMaxMP(Creature c)
c - Creatureint GetAP(Creature c)
c - Creatureint GetATK(Creature c)
c - Creatureint GetDEF(Creature c)
c - Creatureint GetARC(Creature c)
c - Creatureint GetWTR(Creature c)
c - Creatureint GetFIR(Creature c)
c - Creatureint GetAIR(Creature c)
c - Creatureint GetERT(Creature c)
c - Creatureint GetTHF(Creature c)
c - Creatureint GetWOD(Creature c)
c - Creatureint GetLOR(Creature c)
c - Creatureint GetLUK(Creature c)
c - Creatureboolean GetIsEnemy(Creature c)
c - Creaturevoid SetIsEnemy(Creature c,
boolean enemy)
c - Creatureenemy - true for enemy, false for friendvoid GiveItem(Item i,
Creature c)
i - Item to givec - Creature to get itint GetDamageBonus(Creature c)
c - Creatureint GetArmor(Creature c)
c - Creatureint GetArmorPenalty(Creature c)
c - Armor penalty for creatureint CalculateToHit(Creature attacker,
Creature target)
attacker - Attacking creaturetarget - Target creatureLuaTable GetCreatures(Map map)
map - Map to get list of creatures fromCreature GetCreatureAtPosition(Map map,
int x,
int y)
map - Map to searchx - Positiony - Positionvoid AddQuestLog(String id,
boolean finished)
id - Quest log idfinished - true for finished, false for activevoid AddQuestEntry(String questId,
String entryId)
questId - Quest id, must be active or finishedentryId - Entry idvoid RemoveQuestEntry(String questId,
String entryId)
questId - Quest id, must be active or finishedentryId - Entry idboolean HasQuestEntry(String questId,
String entryId)
questId - Quets identryId - Entry idvoid RemoveQuestLog(String id)
id - Quest log idvoid StartConversation(String id)
id - Resource IDboolean IsCreature(java.lang.Object o)
o - Object to checkboolean IsItem(java.lang.Object o)
o - Object to checkvoid Animation(int x,
int y,
int icon,
int start,
int length,
String text)
x - Tile positiony - Tile positionicon - Iconstart - Start in game ticks (200ms)length - Length in game ticks (200ms)text - Text to show (nil = none)void Debug(String s)
s - String to printLuaTable FindPathThroughDoors(Map m,
int fx,
int fy,
int tx,
int ty)
m - Map to use for path findingfx - From positionfy - From positiontx - To positionty - To positionLuaTable FindPath(Map m,
int fx,
int fy,
int tx,
int ty)
m - Map to use for path findingfx - From positionfy - From positiontx - To positionty - To positionboolean CanSee(Creature c,
int x,
int y)
c - Creaturex - Positiony - Positionvoid SetLocalVar(Entity e,
String var,
String val)
e - Entity such as Creature/Item/Mapvar - Variable nameval - Variable value (string value only)String GetLocalVar(Entity e,
String var)
e - Entity such as Creature/Item/Mapvar - Variable namevoid SetGlobalVar(String var,
String val)
String GetGlobalVar(String var)
String GetIID(Entity e)
e - Entity such as Creature/Item/Mapvoid AddSpell(Creature pc,
String id)
pc - Creature to learn spellid - Spell resource IDvoid AddSkill(Creature pc,
String id)
pc - Creature to learn skillid - Skill resource IDboolean HasRequirement(Creature pc,
String id)
pc - Creature to checkid - Spell/Skill resource IDint GetGold(Creature pc)
pc - Creaturevoid SetGold(Creature pc,
int gold)
pc - Creaturegold - New gold amountvoid OpenShop(Creature shop)
shop - Creature to shop withvoid SaveGame(boolean partyOnly)
partyOnly - true if only party should be saved, false if also module data savedvoid AutoSave()
void ShowPopupText(String text)
text - Text ot showContainer CreateContainer()
Container GetContainer(String iid)
iid - Container idLuaTable GetItemsInContainer(Container c)
c - Containervoid AddItemToContainer(Container c,
Item item)
c - Containeritem - Item to addvoid SetContainerOnClose(Container c,
String onClose)
void OpenContainer(Container c)
c - Container to showvoid AddTextLog(String line)
line - Line to showString GetName(Entity e)
e - Entity to get name ofItem GetEquipped(Creature pc,
String slot)
pc - Creatureslot - SLOT_ constantint GetCooldown(Creature pc,
String id)
pc - id - Entity GetItemOwner(Item i)
i - ItemLuaTable GetItems(Creature pc)
pc - Creaturevoid SetTravelLocationVisible(String mapId,
String locId,
boolean visible)
mapId - Travel map idlocId - Location idvisible - true if visiblevoid OpenTravelMap(String mapId,
String locId)
mapId - Map idlocId - Player location, leave "" if emptyTrap PlaceTrap(String id,
Map map,
int x,
int y)
id - Blueprint id of trapmap - Mapx - Positiony - Positionvoid MoveTrap(Trap t,
Map map,
int x,
int y)
t - Trap objectmap - Mapx - Positiony - PositionTrap GetTrap(Map map,
int x,
int y)
map - Mapx - Positiony - PositionPointF GetTrapPosition(Trap t)
t - Trap objectvoid RemoveTrap(Trap t)
t - Trap objectint GetDisarmRating(Trap t)
t - Trapboolean IsInCombat()
int DiceRoll(String s)
s - Dice stringvoid StartEncounter(String id,
Map map,
int x,
int y)
id - Blueprint of encountermap - Map to place things inx - Center position of spawny - Center position of spawnContainer CreateLoot(Map map,
int x,
int y)
map - Map to place loot onx - Position of looty - Position of lootvoid RemoveLoot(Map map,
int x,
int y)
map - Map to remove fromx - Position of looty - Position of lootvoid EndGame()