_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
AddKeystrokeHelp("+", "- increase game speed")
AddKeystrokeHelp("Ctrl-T", "- track unit")
AddKeystrokeHelp("F5", "- game options")
AddKeystrokeHelp("F10", "- game menu")
-- Adds the message.
AddMessage("This is a message")
-- Adds the objective text "-Build a barracks" to the end of the objectives
-- list and adds the objective "-Destroy all enemies" to the first position.
AddObjective("-Build a barracks")
AddObjective("-Destroy all enemies", 0)
AddTip("You can demolish trees and rocks.")
Briefing("type", "wazoogame",
"title", "sc",
"objective", "Kill all aliens on the map.",
"background", "campaigns/human/interface/introscreen3.png",
"text", "campaigns/human/level07h.txt",
"voice", "campaigns/human/level07h-intro1.wav",
"voice", "campaigns/human/level07h-intro2.wav"
)
-- Centers the current viewport at tile 17x40.
CenterMap(17, 40)
-- Changes the owner to player 2 for all units owned by player 3,
-- that are located in the area (0,0)-(10,10).
ChangeUnitsOwner({0, 0}, {10, 10}, 3, 2)
-- Creates a footman for player 2 at location 31x34.
CreateUnit("unit-footman", 2, {31, 34})
DebugPrint("Loading config file...")
DefineBurningBuilding(
{"percent", 0, "missile", "missile-big-fire"},
{"percent", 50, "missile", "missile-small-fire"},
{"percent", 75}) -- no missile
DefineCampaign()
DefineConstruction( ident
Files = {
File = filename,
Size = {x, y}},
ShadowFile = {{
Tileset = tileset,
File = filename,
Size = {x, y}}},
Constructions = {{
percent = percent,
file = construction-file,
frame = frame-number}}
})
-- Defines construction-land with different graphics for summer and winter
-- tilesets. Buildings 0-24 percent complete use frame 0 of the construction
-- image, 25-49 percent complete use frame 1 of the construction image, and 50-99
-- percent complete use the frame 1 of the main building graphic.
DefineConstruction("construction-land", {
Files= {{
Tileset = "desert",
File = "neutral/buildings/land_construction_site.png",
Size = {64, 64}},{
Tileset = "winter",
File = "tilesets/winter/neutral/buildings/land_construction_site.png",
Size = {64, 64}}},
Constructions = {{
Percent = 0,
File = "construction",
Frame = 0},{
Percent = 25,
File = "construction",
Frame = 1},{
Percent = 50,
File = "main",
Frame = 1}}
})
DefineEditorUnitTypes({
"unit-vault",
"unit-apcs",
"unit-medic",
"unit-bazoo",
"unit-assault",
"unit-grenadier",
"unit-camp",
"unit-hosp"
})
DefinePlayerColorIndex(10, 5) -- for indexes 10-14
DefinePlayerColors({
"red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}},
"blue", {...},
...
)
DefineRaceNames(
"race", {
"name", "race-name",
"display", "race-display-name"
["visible"])
["race", {...}] ...)
-- Defines the elites and neutral races. The neutral race is
-- not visible in the race menus.
DefineRaceNames(
"race", {
"race", 0,
"name", "elites",
"display", "Elites",
"visible"},
"race", {
"race", 1,
"name", "neutral",
"display", "Neutral"}
)
-- Defines the ranks for the alliance race.
DefineRanks("alliance", {
0, "Pathetic",
3000, "Not Bad",
10000, Great
})
See SetDiplomacy for more details.
StratagusMap(
"version", "2.1.0",
"description", "big brazilian forest",
"the-map", {
"terrain", {"tileset-desert", "desert"},
"size", {128, 128},
"fog-of-war",
"filename", "maps/braza.pud",
"map-fields", {
-- 0
{125, 125, "land", "block", "wood",}, {125, 125, "land", "block", "wood",},
{125, 125, "land", "block", "wood",}, {125, 125, "land", "block", "wood",},
{125, 125, "land", "block", "wood",}, {125, 125, "land", "block", "wood",},
{125, 125, "land", "block", "wood",}, {125, 125, "explored", 1, "land", "block", "wood",},
{125, 125, "explored", 1, "land", "block", "wood",}
.....
}})
cycle = GameCycle()
print(GetCurrentLuaPath())
Load(GetCurrentLuaPath().."unit.lua")
Possible values for property:
playername = GetPlayerData(player, "Name")
player = GetThisPlayer()
Besides variable names, the VariableName field takes the following alternate values:
-- Get mana of the unit (slot #11). GetUnitVariable(11, "Mana");
"unit-name" Unit type of this name "any" Matches any unit type "all" All units (sum of units and buildings) "units" All non building units "building" All building units
0 .. 16 Player number "any" Matches any player "all" All players (Not used) "this" Player on the local computer, Human player in the campaign.
-- Kills a peasant of the player on the local computer.
KillUnit("unit-peasant", "this");
"unit-name" Unit type of this name "any" Matches any unit type "all" All units (sum of units and buildings) "units" All non building units "building" All building units
0 .. 16 Player number "any" Matches any player "all" All players (Not used) "this" Player on the local computer, Human player in the campaign.
0 ... oo Number for the quantity
{x1, y1} Upper left corner
{x2, y2} Lower right corner
-- Kills any units in the rectangle (5,12) to (9,15).
KillUnitAt("any", "any", 9, {5, 12}, {9, 15});
path = LibraryPath()
list = ListDirectory("music/")
list = ListFilesInDirectory("music/")
list = ListDirsInDirectory("music/")
-- Loads the map.
LoadMap("campaigns/human/level01h.pud")
Log({ GameCycle = 10420, UnitNumber = 252, UnitIdent = "unit-assault",
Action = "move", Flush = 1, PosX = 113, PosY = 104, SyncRandSeed = 614148735 })
unit = MakeUnit("unit-assault", 0)
NewColors()
MoveUnit(0, {10, 12})
Player(0,
"name", "feb",
"type", "person", "race", "elites", "ai", 0,
"team", 2, "enemy", "_X______________", "allied", "________________",
"shared-vision", "________________",
"start", {0, 0},
"resources", {"time", 0, "titanium", 2100, "crystal", 1000,
"gas", 1000, "ore", 1000, "stone", 1000, "coal", 1000,},
"last-resources", {"time", 0, "titanium", 2100, "crystal", 1000,
"gas", 1000, "ore", 1000, "stone", 1000, "coal", 1000,},
"incomes", {"time", 0, "titanium", 100, "crystal", 100,
"gas", 100, "ore", 100, "stone", 100, "coal", 100,},
"revenue", {"time", 0, "titanium", 0, "crystal", 0,
"gas", 0, "ore", 0, "stone", 0, "coal", 0,},
"ai-disabled",
"supply", 1575, "unit-limit", 200, "building-limit", 200, "total-unit-limit", 400,
"score", 0,
"total-units", 16,
"total-buildings", 16,
"total-resources", {0, 100, 0, 0, 0, 0, 0,},
"total-razings", 0,
"total-kills", 0,
"color", { 160, 0, 0 },
"timers", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
)
-- Remove the first objective from the objectives list.
RemoveObjective(0)
ReplayLog( {
Comment1 = "Generated by Stratagus Version 2.2",
Comment2 = "Visit https://launchpad.net/stratagus for more information",
Date = "Wed Jul 21 16:22:17 2004",
Map = "big",
MapPath = "maps/braza.pud",
MapId = 4047425872,
Type = 1,
Race = -1,
LocalPlayer = 0,
Players = {
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 },
{ Race = 0, Team = 0, Type = 0 }
},
Resource = -1,
NumUnits = -1,
TileSet = -1,
NoFow = 0,
RevealMap = 0,
GameType = -1,
Opponents = -1,
Engine = { 2, 1, 0 },
Network = { 0, 9, 2 }
} )
ResetKeystrokeHelp()
Selection(1, 0)
-- Sets the default map to "puds/default.pud".
SetDefaultMap("puds/default.pud")
-- Sets player 1 to be an enemy of player 0.
SetDiplomacy(0, "enemy", 1)
-- Set the game cycle number to 100.
SetGameCycle(100)
-- Set Name to bos, ~/.stratagus/bos is location of files
SetGameName("bos")
-- Pauses the game.
SetGamePaused(true)
SetGroupId(0)
-- Set Player Name to mr-russ
SetLocalPlayerName("mr-russ")
-- Sets the mission objectives.
SetObjectives("Build 4 farms", "Mine 500 gold")
-- Sets shared vision for player 0 to on with player 2.
SetSharedVision(0, true, 2)
Possible values for property:
SetPlayerData(player, "Name", "playername")
unit = CreateUnit("unit-crystal", {10,45})
SetResourcesHeld(unit, 2500)
SetThisPlayer(0)
Besides variable names, the VariableName field takes the following alternate string values:
-- Set mana of the unit (slot 11) SetUnitVariable(11, "Mana", 255)
-- Sets shared vision on with player number 3.
SharedVision(true, 3)
-- Show an area of 6 tiles around location (10,10) for 500 cycles using 'unit-revealer.
ShowMapLocation(10, 10, 6, 500, "unit-revealer")
if(SyncRand(10) < 5) then
-- Do this
else
-- Do that
end
Unit(0, "type", "unit-vault", "player", 0,
"tile", {116, 120}, "refs", 6, "stats", 0,
"pixel", {0, 0}, "seen-pixel", {0, 0}, "frame", 1, "not-seen", "direction", 0,
"attacked", 0,
"current-sight-range", 4, "seen-by-player", "X_______________",
"seen-destroyed", "________________",
"seen-state", 0, "active", "mana", 0, "hp", 1800, "xp", 0, "kills", 0,
"ttl", 0, "bloodlust", 0, "haste", 0, "slow", 0,
"invisible", 0, "flame-shield", 0, "unholy-armor", 0,
"HitPoints", {Value = 1800, Max = 1800, Increase = 0, Enable = true},
"Mana", {Value = 0, Max = 0, Increase = 0, Enable = false},
"Transport", {Value = 0, Max = 0, Increase = 0, Enable = true},
"Research", {Value = 0, Max = 0, Increase = 0, Enable = true},
"Training", {Value = 0, Max = 0, Increase = 0, Enable = true},
"UpgradeTo", {Value = 0, Max = 0, Increase = 0, Enable = true},
"Resource", {Value = 0, Max = 0, Increase = 0, Enable = true},
"group-id", 0,
"last-group", 0,
"value", 0,
"sub-action", 0, "wait", 2, "state", 2,
"blink", 0, "rs", 35, "units-boarded-count", 0,"order-count", 1,
"order-flush", 0,
"order-total", 4,
"orders", {
{"action-still", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {-1, -1},},
{"action-none", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {0, 0},},
{"action-none", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {0, 0},},
{"action-none", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {0, 0},},},
"saved-order",
{"action-still", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {-1, -1},},
"new-order",
{"action-still", "flags", 0, "range", 0, "width", 0, "height", 0, "min-range", 0, "tile", {-1, -1},}
)