User:ArthurAutomaton/sandbox: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= Sandbox = Some notes to myself about modding DotA 2. == Creating a unit that's controllable by a specific player == This code creates a mud golem at (0, 0, 0) on the Radiant...") |
mNo edit summary |
||
Line 19: | Line 19: | ||
* [[Dota 2 Workshop Tools/Scripting/API/Global.CreateUnitByName|CreateUnitByName]] | * [[Dota 2 Workshop Tools/Scripting/API/Global.CreateUnitByName|CreateUnitByName]] | ||
* [[Dota 2 Workshop Tools/Scripting/Built-In Unit Names|Built-In Unit Names]] | * [[Dota 2 Workshop Tools/Scripting/Built-In Unit Names|Built-In Unit Names]] | ||
== CDOTA_BaseNPC_Hero.SetGold == | |||
''' void SetGold(int ''amount'', bool ''addToCurrentGold'') ''' | |||
''Sets the gold amount for the player owning this hero'' | |||
=== Parameters === | |||
{| class="standard-table" style="width: 50%;" | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| int | |||
| amount | |||
| An amount of gold | |||
|- | |||
| bool | |||
| addToCurrentGold | |||
| If true, <code>amount</code> will be added to the player's current gold; if false, the player's current gold will be set to <code>amount</code>. | |||
|} |
Revision as of 02:45, 13 August 2014
Sandbox
Some notes to myself about modding DotA 2.
Creating a unit that's controllable by a specific player
This code creates a mud golem at (0, 0, 0) on the Radiant team and makes it controllable by player 0:
unit_team = DOTA_TEAM_GOODGUYS unit_name = "npc_dota_neutral_mud_golem" player = PlayerResource:GetPlayer(0) point = Vector(0, 0, 0) unit = CreateUnitByName(unit_name, point, true, nil, nil, unit_team) unit:SetControllableByPlayer(player:GetPlayerID(), true)
Relevant links:
CDOTA_BaseNPC_Hero.SetGold
void SetGold(int amount, bool addToCurrentGold)
Sets the gold amount for the player owning this hero
Parameters
Type | Name | Description |
---|---|---|
int | amount | An amount of gold |
bool | addToCurrentGold | If true, amount will be added to the player's current gold; if false, the player's current gold will be set to amount .
|