AvernumScript/Appendix/General notes about scripting

From Wikibooks, open books for an open world
< AvernumScript | Appendix
Jump to: navigation, search

Contents

[edit] General notes about scripting

[edit] 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.

[edit] 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.

[edit] 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.

[edit] void begin_talk_mode(short start_node)

This call is the way to begin a conversation.

[edit] void block_entry(short do_blockage)

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

[edit] void change_coins(short coin_amount) and short reward_give(short which_item)

Using these two calls can let you easily reward the party.

[edit] 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.

[edit] 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.

[edit] void message_dialog(char text1,char text2)

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

[edit] void outdoor_enc_result(short which_result)

This call enables you to customize your outdoor encounters.

[edit] 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.

[edit] 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:

[edit] void set_state_continue(short new_state)

This call lets you jump around states in scripts easily.
Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox
Sister projects
Print/export