Function List

The script engine provides a set of twenty one functions for the game and handling character conversations. The table below summarises these:
Method# ParamsDescription
can_carry1Returns the amount of weight the specified NPC can still carry
dex2Increments the dexterity of the specified NPC by the specified amount, and returns the new value. The first parameter is an NPC, and the second is the amount to increment by
exp2Increments the experience of the specified NPC by the specified amount, and returns the new value. The first parameter is an NPC, and the second is the amount to increment by
flag2Returns the value of the specified NPC's flag at the specified index. The first parameter is an NPC, and the second is the flag index
horsed1Returns true if the specified NPC is on a horse
in_party1Returns true if the specified NPC is in the player's party
indexof2Returns the index of a specified string variable's value in the specified database. The first parameter should be a database reference, whilst the second should be the string variable index number. Make sure that the database is flagged with the indexed suffix, or usage of the indexof function will have unpredictable results
int2Increments the intelligence of the specified NPC by the specified amount, and returns the new value. The first parameter is an NPC, and the second is the amount to increment by
join_party1Makes the specified NPC join the party. The function returns 0 if the join was successfull, 1 if the party is currently on a boat, and 2 if the party is already full
leave_party1Makes the specified NPC leave the party. The function returns 0 if the leaving was successfull, and 1 if the party is currently on a boat
lvl2Increments the level of the specified NPC by the specified amount, and returns the new value. The first parameter is an NPC, and the second is the amount to increment by
npc2Returns the NPC number of the person at the specified index within the player's party. The first parameter is the index within the party, and the second parameter is always 0
npc_nearby1Returns true if the specified NPC is nearby
obj_count2Returns the total quantity of the specified object in a given NPC's inventory. The first parameter is the NPC, and the sceond is the object number
obj_in_actor3Returns true if a specified object with a given quality is in an NPC's inventory. The first parameter specifies the NPC, the sceond specifies the object number, and the third specifies the quality.
obj_in_party2Returns the NPC number if a specified object/quality is in any party member's inventory. If no match is found, then 32769 is returned
poisoned1Returns true if the specified NPC is poisoned
rand2Returns a random number between the specified minimum and maximum values
str2Increments the strength of the specified NPC by the specified amount, and returns the new value. The first parameter is an NPC, and the second is the amount to increment by
weight2Returns the total weight of the specified object number in a given quantity
wounded1Returns true if the specified NPC is wounded