1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<!DOCTYPE funcs
3  SYSTEM '../../../clonk.dtd'>
4<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
5<funcs>
6  <func>
7    <title>Buy</title>
8    <category>Objects</category>
9    <subcat>Creation</subcat>
10    <version>5.1 OC</version>
11    <syntax>
12      <rtype>object</rtype>
13      <params>
14        <param>
15          <type>id</type>
16          <name>buy_object</name>
17          <desc>Type of object to be bought.</desc>
18        </param>
19        <param>
20          <type>int</type>
21          <name>for_player</name>
22          <desc>Owner (player number) of the new object.</desc>
23        </param>
24        <param>
25          <type>int</type>
26          <name>pay_player</name>
27          <desc>Number of the player who pays for the object.</desc>
28        </param>
29        <param>
30          <type>object</type>
31          <name>to_base</name>
32          <desc>Target object in which the new object is placed. This parameter can be left out if the calling object is the base.</desc>
33          <optional />
34        </param>
35        <param>
36          <type>bool</type>
37          <name>show_errors</name>
38          <desc>If specified and not <code>false</code>, failure messages such as "Buying not possible" are displayed, e.g. if there is not enough money.</desc>
39          <optional />
40        </param>
41      </params>
42    </syntax>
43    <desc>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.</desc>
44    <examples>
45      <example>
46        <code>Buy(Rock, 0, 0, <funclink>FindBase</funclink>(0), true);</code>
47        <text>Buys a rock at the base of the first player.</text>
48      </example>
49    </examples>
50    <related>
51      <funclink>Sell</funclink>
52      <funclink>GetWealth</funclink>
53      <funclink>FindBase</funclink>
54    </related>
55  </func>
56  <author>Sven2</author><date>2001-11</date>
57</funcs>
58