AvernumScript/Appendix/Scenario Initialization Calls

These calls are all meant to be made in the scenario script, either in the state LOAD_SCEN_STATE or START_SCEN_STATE. They can, however, be made anywhere.

void add_item_to_shop(short which_shop,short which_item,short how_many)

edit
This call should be made in the state START_SCEN_STATE. This places 1 or more "items" in store which_shop. which_shop ranges from 0–129. Normally, the "item" placed is an item of type which_item. The argument how_many defines the quantity of the item added to the store.
However, if you pick certain high values of which_item, you can put into the store things besides items — you can also have spells, alchemy recipes, and skills.

Values for which_item are:

0–499 Quantity how_many items of type which_item.
2000 + x Mage spell x. (x ranges 0–19, how_many is the highest level of the spell that can be bought in the store.)
3000 + x Priest spell x. (x ranges 0–19, how_many is the highest level of the spell that can be bought in the store.)
4000 + x Alchemy recipe x. (x ranges from 0–19, how_many should be 1.)
5000 + x Skill x. (Each purchase gives the character 1 level of the skill. how_many is the maximum number of levels of the skill that can be bought.)


Note:

  • Items
    • Any given shop can only have 25 types of items in stock.
    • If how_many is greater than 500, the store will have an infinite quantity of the item which_item.
  • In all cases, you will want to put a number above 0 for how_many. If you don't, the item will disappear from the store.

void create_boat(short which_boat,short which_town,short loc_x,short loc_y,short others_property)

edit
This call should be made in the state START_SCEN_STATE. Initializes the boat which_boat, which ranges from 0–29. The boat is placed in town which_town in space [loc_x, loc_y].

Values for others_property are:

0 – the party can enter the boat.
1 – the party can't enter the boat, until it is set as party property by a script.

void create_horse(short which_horse,short which_town,short loc_x,short loc_y,short others_property)

edit
This call should be made in the state START_SCEN_STATE. Initializes the horse which_horse, which ranges from 0–29. The horse is placed in town which_town in space [loc_x, loc_y].

Values for others_property are:

0 – the party can mount the horse.
1 – the party can't mount the horse until it is set as party property by a script.

void init_quest(short which_quest,string quest_name,string quest_desc)

edit
This call should be made in the state LOAD_SCEN_STATE. It sets the name of quest which_quest to quest_name and the description text to quest_desc.


Note:

  • The name can be at most 29 characters long
  • The description can be at most 199 characters long.
  • The acceptable range for which_quest is 0–99.

void init_special_item(short which_item,string item_name,string item_desc)

edit
This call should be made in the state LOAD_SCEN_STATE. It sets the name of special item which_item to item_name and the description text to item_desc.


Note:

  • The name can be at most 29 characters long.
  • The description can be at most 199 characters long.
  • The acceptable range for which_item is 0–59.

void set_creature_type_level(short which_type,short what_level)

edit
Sets the level of creature type which_type to level what_level. This is the only call that changes creature types, normally these changes are the scennamedata script.). It is provided because, in order to balance a scenario, you will probably need to adjust the levels of at least some creature types.