Category: Objects / Creation
Since engine version: 1.0 OC
Buys an object for for_plr, deducting the wealth of pay_player. The function will fail if the paying player does not have enough money or the object is currently not available in the home base material.
object Buy(id buy_object, int for_player, int pay_player, object to_base, bool show_errors);
- Type of object to be bought.
- Owner (player number) of the new object.
- Number of the player who pays for the object.
- [opt] Target object in which the new object is placed. This parameter can be left out if the calling object is the base.
- [opt] If specified and not
false, failure messages such as "Buying not possible" are displayed, e.g. if there is not enough money.
Buy(Rock, 0, 0, FindBase(0), true);
Buys a rock at the base of the first player.