Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Transfer some power to another player... |
Note |
---|
Hopefully this function will be renamed transferPower() and be given an associated event. |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var success = donatePower(amount, to); |
Parameters
Parameter | Type | Mandatory | Notes | Game Version |
---|---|---|---|---|
amount | Number | The amount of oil to transfer. You must ensure you have enough power available first! | 3.2 | |
to | Number | The ID of the player who you want to transfer the object to. | 3.2 |
Return value
Value | Type | Notes | Game Version |
---|---|---|---|
true | Boolean | The power was successfully transferred. | 3.2 |
false | Boolean | You do not have enough power to transfer the desired amount. | 3.2 |
<error> | Error | Invalid parameters or player not found. | 3.2 |
Notes
You can determine the amount of power a player has using playerPower().
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
var myPower = playerPower(me); donatePower( Math.floor(myPower/4), 3 ); |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|