AvernumScript/Appendix/General notes about scripting

which_char

 * Many calls expect to be given a value for which_char. This expects the number of a character, which will be from 0 to 119.

Note: You are not entering the character’s Character ID or their Personality. To find the number of a character; in the editor, select the character and look at the number in the first description line.


 * If you use such a call in a creature script, if you enter a value of -1 for which_char, the function will act on the creature whose script is running. In such a case, you can also enter ME for which_char. This does the same thing.

which_char_or_group

 * When a call expects a value for which_char_or_group, it wants the number of a character or group. This is exactly like which_char, except for one difference: the call can also act on every member of a group. If you want to have the call act on group x, give which_char_or_group a value of 1000 + x.

Note: Group 0 is always the party.

The Most Important Calls

 * You should pay special attention to these calls. They are the calls that are, in general, used the most frequently to write special encounters.

void begin_talk_mode(short start_node)

 * This call is the way to begin a conversation.

void block_entry(short do_blockage)

 * This call lets you block containers and spaces from the party.

===void change_coins(short coin_amount) and short reward_give(short which_item) ===
 * Using these two calls can let you easily reward the party.

===short char_ok(short which_char) and short spawn_creature(short which_char) ===
 * The first call lets you see if a character exists. The second call will instantly make a new one.

void end_scenario(short party_won)

 * Every scenario must use this call. Otherwise, the only way the party can leave the scenario is via the character editor.

void message_dialog(char text1,char text2)

 * This is the best call to display some simple text to the player.

void outdoor_enc_result(short which_result)

 * This call enables you to customize your outdoor encounters.

===void set_flag(short a,short b,short new_value) and short get_flag(short a,short b) ===
 * These are the two primary calls for setting and checking Stuff Done flags.

===void set_name(short which_char_or_group,char new_name) and void set_level(short which_char_or_group,short what_level) ===
 * These two calls enable you to instantly customize creatures in your towns:

void set_state_continue(short new_state)

 * This call lets you jump around states in scripts easily.