AvernumScript/Appendix/General notes about scripting
From Wikibooks, open books for an open world
- 1 General notes about scripting
- 2 The Most Important Calls
- 2.1 void begin_talk_mode(short start_node)
- 2.2 void block_entry(short do_blockage)
- 2.3 void change_coins(short coin_amount) and short reward_give(short which_item)
- 2.4 short char_ok(short which_char) and short spawn_creature(short which_char)
- 2.5 void end_scenario(short party_won)
- 2.6 void message_dialog(char text1,char text2)
- 2.7 void outdoor_enc_result(short which_result)
- 2.8 void set_flag(short a,short b,short new_value) and short get_flag(short a,short b)
- 2.9 void set_name(short which_char_or_group,char new_name) and void set_level(short which_char_or_group,short what_level)
- 2.10 void set_state_continue(short new_state)
General notes about scripting
- 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.
- 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.
- This call is the way to begin a conversation.
- This call lets you block containers and spaces from the party.
- Using these two calls can let you easily reward the party.
- The first call lets you see if a character exists. The second call will instantly make a new one.
- Every scenario must use this call. Otherwise, the only way the party can leave the scenario is via the character editor.
- This is the best call to display some simple text to the player.
- This call enables you to customize your outdoor encounters.
- 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:
- This call lets you jump around states in scripts easily.