AvernumScript/Appendix/Item, Special Item and Gold Calls

From Wikibooks, open books for an open world
Jump to navigation Jump to search

void change_coins(short coin_amount)[edit | edit source]

Changes the number of coins the party has by coin_amount (which can be negative). If the number is negative, then coins are taken away. If the party doesn't have enough coins, no coins are taken.

void change_spec_item(short which_item,short how_many)[edit | edit source]

Changes the amount of special item which_item the party has by how_many. If how_many is negative, the number of special item which_item will be reduced by how_many. If you try to take away more of the item than the party has, the party is left with 0 of the item.

void char_give_item(short which_char_or_group,short which_item)[edit | edit source]

Tries to give to which_char_or_group an item of type which_item. If you call char_give_item() for a group, gives one of the item to each group member. The item will not automatically be identified. If the character doesn’t have enough space to take the item, nothing happens and the game gives a “can’t take the item” message.


Note: This call was added for Scenario Format Version 2, only use it with Mac version 1.1 or later or Windows version 1.0 or later.

short char_has_item(short which_char,short which_item)[edit | edit source]

Returns:

0 – Character which_char does not have an item of type which_item.
1 – Character which_char does have an item of type which_item.

short char_has_item_of_class_equip(char char_num,short which_class,short take_item)[edit | edit source]

Returns:

0 – No party member does not have an item of with special class which_class.
1 – At least one party member does have an item of with special class which_class.

Values for take item are:

0 No items with the special class which_class is taken.
1 One item with the special class which_class is taken.


Note: This call was added for Scenario Format Version 2, only use it with Mac version 1.1 or later or Windows version 1.0 or later.

void char_take_item(short which_char_or_group,short which_item)[edit | edit source]

Tries to take from which_char_or_group one item of type which_item. (If the item has charges, it will take 1 charge instead).

short coins_amount()[edit | edit source]

Returns the number of coins the party has.

short has_item(short which_item)[edit | edit source]

Returns:

0 – Character which_char does not have an item of type which_item.
1 – Character which_char does have an item of type which_item.

short has_item_of_class(short which_class,short take_item)[edit | edit source]

Returns:

0 – The party does not have an item with special class which_class.
1 – The party does have an item with special class which_class.

Values for take item are:

0 No items with the special class which_class is taken.
1 One item with the special class which_class is taken.

short has_num_of_item(short which_item)[edit | edit source]

Returns how many of item which_item the party has. If the party doesn't have any items of type which_item, returns 0. If the items in question have charges, this call returns the total number of charges.

short has_special_item(short which_item)[edit | edit source]

Returns the number of the special item which_item the party has, 0 if they don’t have any.

short item_of_class_on_spot(short loc_x,short loc_y,short what_class)[edit | edit source]

Returns:

0 – There not an item of special class what_class on town space {loc_x,loc_y}.
1 – there is an item of special class what_class on town space {loc_x,loc_y}.


Note: If what_class is -1, returns 1 if any item is on the space, 0 otherwise.

void move_item_on_spot(short loc_x,short loc_y,short dest_x,short dest_y)[edit | edit source]

Takes all items sitting on town spot {loc_x,loc_y} and moves them to {dest_x,'dest_y}.


Note: If dest_x is a negative value, the items on the space are simply destroyed.

short pay_coins(short coin_amount)[edit | edit source]

Tries to take coin_amount coins from the party.

Returns:

0 – The party does not have enough coins.
1 – The party does have enough coins.

void put_item_on_spot(short loc_x,short loc_y,short what_item)[edit | edit source]

Places an item of type what_item on town space {loc_x,loc_y}. If that spot is a container, the item won’t be contained inside it.

short reward_give(short which_item)[edit | edit source]

Tries to give item of number which_item to party. If the party can’t hold it, tries to place the item at their feet. (Placing the item at their feet will only work indoors.)

Returns:

0 failed to give reward to the party.
1 successfully gave reward to the party.

short take_all_of_item(short which_item)[edit | edit source]

Takes all of item which_item from party, and returns the number of items taken. If the item given has charges, returns the total number of charges taken.

short take_all_of_item_class(short which_class,short gold_to_pay)[edit | edit source]

Takes from the party all items of special class which_class and, for each item taken, gives the party gold_to_pay gold.

Returns:

0 – the party had no items of that type.
1 – the party had some items of that type.


Note: If the item taken has charges, gives the amount of gold for each charge taken.

void take_item(short which_item)[edit | edit source]

Searches through the party’s inventory until it finds an item of type which_item and takes it. (If the item has charges, it will take one charge instead.)

short take_item_of_class_on_spot(short loc_x,short loc_y,short what_class)[edit | edit source]

Returns 1 if there is an item of special class what_class on town space {loc_x,loc_y}, 0 otherwise.
  • If there was an item of that type on the spot, destroys one of it. (If the item has charges, it will take one charge instead.)
  • If what_class is -1, destroys all items on town space {loc_x,loc_y} and returns TRUE if an is item destroyed.

void take_num_of_item(short which_item,short num_to_take)[edit | edit source]

Takes num_to_take items of type which_type from the party.


Note: If the party has less than num_to_take items of that type, all are taken.
If the item has charges, it will take that many charges instead.

void take_special_item(short which_item)[edit | edit source]

Takes 1 of special item which_item from party. If the party has none of that special item, the call does nothing.