Blitzkrieg is a real-time strategy game developed by Nival Interactive in 2003. It was followed by Blitzkrieg 2 in 2005, and Blitzkrieg 3 in 2015. The games are set in World War II. They features authentic units and challenging gameplay.
The map editor can be found in the main game folder.
Useful links: PDF explaining Lua stuff
Maps and their matching lua file can be placed in: ....\SteamLibrary\steamapps\common\Blitzkrieg Anthology\Blitzkrieg\data\maps
The following code will make it so every 2 seconds, there's a 50% chance that trucks will spawn on the map. The trucks have id 100, which is set in the editor (just double-click a unit to change its scriptID). They are trucks but they could be any other units. Every 2000 milliseconds, the "Reinforce1()" function will run, and will have a roughly 50% chance of spawning the trucks again.
READ CAREFULLY. For the LandReinforcement() function to work (should be called "Spawn()" really), the units that are going to be spawned must be set to be so in the map editor. Very easy. On the column on the left, click "Reinforcement Groups" tab. Then select the units (don't know if that's necessary actually), click "New group", add an ID, then in the "group property" field just below, click "Add group with scripID", enter the scriptID of the units. Done. These units now won't be present at mission start, but they can be spawned on the map using LandReinforcement(), even if they are not dead, which means they can be spawned over and over.
Finally, the ToWin() function makes the mission ends in success if all units with scriptID 200 are 0 (all destroyed).
function ToWin()
if (GetNUnitsInScriptGroup(200) <= 0) then
Win(0);
Suicide();
end;
end;
function Reinforce1()
local random_number = RandomInt(5); -- random int between 0 and 5, don't know if inclusive
if (random_number > 3) then
LandReinforcement(100);
end;
--Suicide(); -- kills the script
end;
function Init()
RunScript( "ToWin", 3000);
RunScript( "Reinforce1", 2000); -- script will run every 2000 milliseconds
end;
0 - move to location
1 - attack unit
2 - attack non-unit object
3 - swarm to point (x, y))
4 - load units / attach for towing
5 - unload units / detach from towing
6 - enter to building/trench
7 - leave building/trench
8 - rotate to point
9 - stop all actions
13 - stop and guard position
50 - stand ground
14 - switch to ambush
15 - range area (zeroing)
16 - supressive fire
19 - call bombers
20 - call fighters
21 - call scout planes
22 - call paradrop planes
36 - call ground attack planes
23 - resuply units
24 - repear units
29 - officer use spyglasses
31 - hitch artillery
32 - deploy artillery
34 - disband squad
35 - form formation
39 - follow
43 - resuply soldiers in squads
45 - entrench self
46 - change shell type
Custom Function Input Value Return Value
AddIronMan (iScriptID) -
ChangeFormation (iScriptID, iFormation) -
ChangePlayer (iScriptID, iParty) -
ChangeWarFog (iParty) -
Cmd|GiveCommand (iAction, iScriptID, xLoc, yLoc) -
DamageObject (iScriptID, fDamage) -
DeleteReinforcement (iScriptID) -
DisableAviation (iParty, iAviationType) -
DisplayTrace (strText, params, ...) Text on screen
Draw - -
EnableAviation (iParty, iAviationType) -
FlagReinforcement (nParty) -
GetActiveShellType (iScriptID) Shell Type
GetAviationState (iPlayer) Last aviation call by player
GetFGlobalVar (strGlobalVarName, 0) strGlobalVarName & value
GetFrontDir (iScriptID) Direction unit Is facing
GetIGlobalVar (strGlobalVarName,0) strGlobalVarName & value
GetMapSize - Size of map in script points
GetNAmmo (iScriptID) ammunition levels (pri, sec)
GetNAntitankInScriptArea (strScriptAreaName) Number of anti-tank obsticals in area
GetNAPFencesInScriptArea (strScriptAreaName) Number of barb wire pieces in area
GetNFencesInScriptArea (strScriptAreaName) Number of fence pieces in area
GetNMinesInScriptArea (strScriptAreaName) Number of mines in area (at & ap)
GetNScriptUnitsInArea (iScriptID, strScriptAreaName) Number of scriptid units in area
GetNTrenchesInScriptArea (strScriptAreaName) Number of trench pieces in area
GetNUnitsInArea (iPlayer, strScriptAreaName) Number of player units in area
GetNUnitsInCircle (iPlayer, X, Y, Radius) Number of player units in co-ords
GetNUnitsInParty (iPlayer) Number of player units on map
GetNUnitsInScriptGroup (iScriptID, iPlayer) Number of scriptid units
GetNUnitsOfType (strUnitType, iPlayer) Type of infantry
GetObjCoord (iScriptID) O bject’s location
GetObjectHPs (iScriptID_Static) O bject’s hit points
GetScriptAreaParams (strScriptAreaName) Parameters of area
GetSGlobalVar (strGlobalVarName, 0) strGlobalVarName & value
GetSquadInfo (iScriptID) Squad formation
GetUnitState (iScriptID) Unit state
God (iParty, iMode) -
IsEntrenched (iScriptID) Entrenchment value of unit
IsFollowing (iScriptID) Following value of unit
IsStandGround (iScriptID) Stand ground value of unit
IsWarehouseConnected (iScript_StorageID) Small depot connected to main
KillScript (strScriptFunctionName) -
LandReinforcement (iReinfID) -
Loose - -
ObjectiveChanged (iObjNum, iState) Objective state
Password (strName) -
QCmd|GiveQCommand : (iAction, iScriptID, params) -
RandomFloat - Decimal between 0 and 1
RandomInt (n) Random number from 0 to n
ReserveAviationForTimes (iParty, iTime) -
RunScript (strFunctionName, iTime, iTurns) -
SetCheatDifficultyLevel (n) -
SetDifficultyLevel (n) -
SetFGlobalVar (strGlobalVarName, fVar) -
SetGameSpeed (n) -
SetIGlobalVar (strGlobalVarName, iVar) -
SetSGlobalVar (strGlobalVarName, sVar) -
ShowActiveScripts - Current scripts show in console
Suicide - -
SwitchWeather (iState) -
SwitchWeatherAutomatic (iState)
Trace (strText, params) Text in console
ViewZone (strScriptAreaName, iParam) -
Win (iParty)