The script engine provides a set of twenty one functions for the game and handling character conversations. The table below summarises these:
Method | # Params | Description |
can_carry | 1 | Returns the amount of weight the specified NPC can still carry |
dex | 2 | Increments 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 |
exp | 2 | Increments 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 |
flag | 2 | Returns 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 |
horsed | 1 | Returns true if the specified NPC is on a horse |
in_party | 1 | Returns true if the specified NPC is in the player's party |
indexof | 2 | Returns 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 |
int | 2 | Increments 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_party | 1 | Makes 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_party | 1 | Makes 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 |
lvl | 2 | Increments 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 |
npc | 2 | Returns 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_nearby | 1 | Returns true if the specified NPC is nearby |
obj_count | 2 | Returns 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_actor | 3 | Returns 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_party | 2 | Returns the NPC number if a specified object/quality is in any party member's inventory. If no match is found, then 32769 is returned |
poisoned | 1 | Returns true if the specified NPC is poisoned |
rand | 2 | Returns a random number between the specified minimum and maximum values |
str | 2 | Increments 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 |
weight | 2 | Returns the total weight of the specified object number in a given quantity |
wounded | 1 | Returns true if the specified NPC is wounded |