_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "player.h"
#include "actions.h"
#include "ai.h"
#include "commands.h"
#include "map.h"
#include "script.h"
#include "unittype.h"
#include "unit.h"
#include "unit_find.h"
#include "upgrade.h"
#include "video.h"
Functions | |
script_player.cpp - The player ccl functions. | |
CUnit * | CclGetUnitFromRef (lua_State *l) |
For saving lua state. More... | |
static CPlayer * | CclGetPlayer (lua_State *l) |
static int | CclPlayer (lua_State *l) |
static int | CclChangeUnitsOwner (lua_State *l) |
static int | CclGiveUnitsToPlayer (lua_State *l) |
static int | CclGetThisPlayer (lua_State *l) |
static int | CclSetThisPlayer (lua_State *l) |
static int | CclSetMaxSelectable (lua_State *l) |
static int | CclSetAllPlayersUnitLimit (lua_State *l) |
static int | CclSetAllPlayersBuildingLimit (lua_State *l) |
static int | CclSetAllPlayersTotalUnitLimit (lua_State *l) |
static int | CclSetDiplomacy (lua_State *l) |
static int | CclDiplomacy (lua_State *l) |
static int | CclGetDiplomacy (lua_State *l) |
static int | CclSetSharedVision (lua_State *l) |
static int | CclSharedVision (lua_State *l) |
static int | CclSetRevelationType (lua_State *l) |
static int | CclDefineNewRaceNames (lua_State *l) |
static int | CclDefineRaceNames (lua_State *l) |
static int | CclDefinePlayerColors (lua_State *l) |
static int | CclNewPlayerColors (lua_State *l) |
static int | CclDefinePlayerColorIndex (lua_State *l) |
static int | CclGetPlayerData (lua_State *l) |
static int | CclSetPlayerData (lua_State *l) |
static int | CclSetAiType (lua_State *l) |
void | PlayerCclRegister () |
register ccl features More... | |
|
static |
Description
Change all units owned by one player or change only specific units owned by one player
l | Lua state. |
Example:
– Changes all units owned by player 0 and give to player 1 ChangeUnitsOwner({16, 17}, {30, 32}, 0, 1) – Changes all farms owned by player 0 and give to player 1 ChangeUnitsOwner({16, 17}, {30, 32}, 0, 1, "unit-farm")
|
static |
Description
Define race names in addition to those already there.
l | Lua state. |
|
static |
Define player color indexes
l | Lua state. |
|
static |
Description
Define player colors. Pass "false" as an optional second argument to add the colors to the existing ones.
l | Lua state. |
Example:
DefinePlayerColors({ "red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}}, "blue", {{12, 72, 204}, {4, 40, 160}, {0, 20, 116}, {0, 4, 76}}, "green", {{44, 180, 148}, {20, 132, 92}, {4, 84, 44}, {0, 40, 12}}, "violet", {{152, 72, 176}, {116, 44, 132}, {80, 24, 88}, {44, 8, 44}}, "orange", {{248, 140, 20}, {200, 96, 16}, {152, 60, 16}, {108, 32, 12}}, "black", {{40, 40, 60}, {28, 28, 44}, {20, 20, 32}, {12, 12, 20}}, "white", {{224, 224, 224}, {152, 152, 180}, {84, 84, 128}, {36, 40, 76}}, "yellow", {{252, 252, 72}, {228, 204, 40}, {204, 160, 16}, {180, 116, 0}}, "red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}}, "blue", {{12, 72, 204}, {4, 40, 160}, {0, 20, 116}, {0, 4, 76}}, "green", {{44, 180, 148}, {20, 132, 92}, {4, 84, 44}, {0, 40, 12}}, "violet", {{152, 72, 176}, {116, 44, 132}, {80, 24, 88}, {44, 8, 44}}, "orange", {{248, 140, 20}, {200, 96, 16}, {152, 60, 16}, {108, 32, 12}}, "black", {{40, 40, 60}, {28, 28, 44}, {20, 20, 32}, {12, 12, 20}}, "white", {{224, 224, 224}, {152, 152, 180}, {84, 84, 128}, {36, 40, 76}}, "yellow", {{252, 252, 72}, {228, 204, 40}, {204, 160, 16}, {180, 116, 0}}, })
|
static |
Define race names
l | Lua state. |
|
static |
Change the diplomacy from ThisPlayer to another player.
l | Lua state. |
|
static |
Get diplomacy from one player to another. Returns the strings "allied", "enemy", "neutral", or "crazy".
|
static |
Get a player pointer
l | Lua state. |
|
static |
Description
Get player data.
l | Lua state. |
Example:
GetPlayerData(0,"TotalNumUnits")
|
static |
Description
Get ThisPlayer.
l | Lua state. |
Example:
GetThisPlayer()
CUnit* CclGetUnitFromRef | ( | lua_State * | l | ) |
For saving lua state.
Get a unit pointer from ref string
l | Lua state. |
|
static |
Description
GiveUnitsToPlayer(amount, type, fromPlayer, toPlayer) GiveUnitsToPlayer(amount, type, topLeft, bottomRight, fromPlayer, toPlayer) Give some units of a specific type from a player to another player. Optionally only inside a rectangle. Returns number of units actually assigned. This can be smaller than the requested amount if the fromPlayer
did not have enough units.
Instead of a number you can pass "all" as the first argument, to hand over all units.
Instead of a unit type name, you can pass "any", "unit", "building" as the second argument, to hand over anything, and unit, or any building.
l | Lua state. |
Example:
– Give 2 peasants from player 4 to player 2 GiveUnitsToPlayer(2, "unit-peasant", 4, 2) – Give 4 knights from player 5 to player 1 inside the rectangle 2,2 - 14,14 GiveUnitsToPlayer(2, "unit-peasant", {2,2}, {14,14}, 4, 2) – Give any 4 units from player 5 to player 1 inside the rectangle 2,2 - 14,14 GiveUnitsToPlayer(2, "any", 4, 2)
|
static |
Make new player colors
l | Lua state. |
|
static |
Parse the player configuration.
l | Lua state. |
|
static |
Description
Set ai player algo.
l | Lua state. |
Example:
– Player 1 has a passive A.I SetAiType(1, "Passive")
|
static |
Description
Set players buildings limit.
l | Lua state. |
Example:
SetAllPlayersBuildingLimit(200)
|
static |
Description
Set players total units limit.
l | Lua state. |
Example:
SetAllPlayersTotalUnitLimit(400)
|
static |
Description
Set players units limit.
l | Lua state. |
Example:
SetAllPlayersUnitLimit(200)
|
static |
Description
Change the diplomacy from player to another player.
l | Lua state. |
Example:
SetDiplomacy(0,"allied",1) SetDiplomacy(1,"allied",0)
SetDiplomacy(0,"enemy",2) SetDiplomacy(1,"enemy",2)
|
static |
Description
Set the maximum amount of units that can be selected.
l | Lua state. |
Example:
– 9 units can be selected together. SetMaxSelectable(9) – 18 units can be selected together. SetMaxSelectable(18) – 50 units can be selected together. SetMaxSelectable(50)
|
static |
Description
Set player data.
l | Lua state. |
Example:
SetPlayerData(0,"Name","Nation of Stromgarde") – set the name of this player SetPlayerData(0,"RaceName","human") – the the race to human SetPlayerData(0,"Resources","gold",1700) – set the player to have 1700 gold SetPlayerData(0, "Allow", "upgrade-paladin", "R") – give the player the Paladin upgrade
|
static |
Description
Change the players revelation type - reveal all units, only buidings or don't reveal anything
l | Lua state. |
Example:
SetRevelationType("no-revelation") SetRevelationType("buildings-only") SetRevelationType("all-units")
|
static |
Description
Change the shared vision from player to another player.
l | Lua state. |
Example:
SetSharedVision(0,true,1) SetSharedVision(1,true,0)
SetSharedVision(0,false,2) SetSharedVision(1,false,2)
|
static |
Description
Set ThisPlayer.
l | Lua state. |
|
static |
Change the shared vision from ThisPlayer to another player.
l | Lua state. |
void PlayerCclRegister | ( | ) |
register ccl features
Register CCL features for players.