Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

MissionScriptsDynamicActions

Rey edited this page Oct 11, 2017 · 9 revisions

Actions

All action parameters are numeric and get mapped to unit/house types according to default tables used in DAT scripts.

Actions are placed in a form Actions.ACT_NAME(ACT_PARAMETERS); like so:

    if States.GameTime = 300 then
      Actions.PlayerDefeat(0); //Defeat 1st player

"-" Means this will not be implemented.

Ver
sion
Action Description Parameters
and types
Returns
6251 AIAutoAttackRange
Sets AI auto attack range. AI groups will automatically attack if you are closer than this many tiles.
aPlayer: Byte;
aRange: Word; // Range (1 to 20)
5924 AIAutoBuild
Sets whether the AI should build and manage his own village
aPlayer: Byte;
aAuto: Boolean;
5924 AIAutoDefence
Sets whether the AI should position his soldiers automatically
aPlayer: Byte;
aAuto: Boolean;
5932 AIAutoRepair
Sets whether the AI should automatically repair damaged buildings
aPlayer: Byte;
aAuto: Boolean;
5932 AIDefencePositionAdd
Adds a defence position for the specified AI player
aPlayer: Byte;
X: Integer;
Y: Integer;
aDir: Byte;
aGroupType: Byte;
aRadius: Word;
aDefType: Byte;
6309 AIDefencePositionRemove
Removes defence position at X, Y
aPlayer: Byte;
X: Integer;
Y: Integer;
6323 AIDefencePositionRemoveAll
Removes all defence positions for specified AI player
aPlayer: Byte;
6251 AIDefendAllies
Sets whether AI should defend units and houses of allies as if they were its own
aPlayer: Byte;
aDefend: Boolean;
5778 AIEquipRate
Sets the warriors equip rate for AI.
aPlayer: Byte;
aType: Byte; // type: 0 - leather, 1 - iron
aRate: Word;
5778 AIGroupsFormationSet
Sets the formation the AI uses for defence positions
aPlayer: Byte;
aType: Byte;
aCount: Word;
aColumns: Word;
5924 AIRecruitDelay
Sets the number of ticks before the specified AI will start training recruits
aPlayer: Byte;
aDelay: Cardinal;
5345 AIRecruitLimit
Sets the number of recruits the AI will keep in each barracks
aPlayer: Byte;
aLimit: Byte;
5924 AISerfsPerHouse
Sets the number of serfs the AI will train per house. Can be a decimal (0.25 for 1 serf per 4 houses)
aPlayer: Byte;
aSerfs: Single;
5932 AISoldiersLimit
Sets the maximum number of soldiers the AI will train, or -1 for unlimited
aPlayer: Byte;
aLimit: Integer;
6251 AIStartPosition
Sets the AI start position which is used for targeting AI attacks
aPlayer: Byte;
X: Word;
Y: Word;
5924 AIWorkerLimit
Sets the maximum number of laborers the AI will train
aPlayer: Byte;
aLimit: Byte;
5938 CinematicEnd
Exits cinematic mode
aPlayer: Byte;
5938 CinematicPanTo
Pans the center of the player's screen to the given location over a set number of ticks. If Duration = 0 then the screen moves instantly.
aPlayer: Byte;
X: Word;
Y: Word;
Duration: Word;
5938 CinematicStart
Puts the player in cinematic mode, blocking user input and allowing the screen to be panned
aPlayer: Byte;
5097 FogCoverAll
Covers (un-reveals) the entire map in fog of war for player
aPlayer: Byte;
5097 FogCoverCircle
Reveals a circle in fog of war for player
aPlayer: Word;
X: Word;
Y: Word;
aRadius: Word;
5777 FogCoverRect
Covers a rectangular area in fog of war for player
aPlayer: Word;
X1: Word; // Left coordinate
Y1: Word; // Top coordinate
X2: Word; // Right coordinate
Y2: Word; // Bottom coordinate
5097 FogRevealAll
Reveals the entire map in fog of war for player
aPlayer: Byte;
5097 FogRevealCircle
Reveals a circle in fog of war for player
aPlayer: Word;
X: Word;
Y: Word;
aRadius: Word;
5777 FogRevealRect
Reveals a rectangular area in fog of war for player
aPlayer: Word;
X1: Word; // Left coordinate
Y1: Word; // Top coordinate
X2: Word; // Right coordinate
Y2: Word; // Bottom coordinate
5057 GiveAnimal
Adds an animal to the game and returns the unit ID or -1 if the animal was not able to be added
aType: Word;
X: Word;
Y: Word;
Integer
6311 GiveField
Adds finished field and returns true if field was successfully added
aPlayer: Word;
X: Word;
Y: Word;
Boolean
5057 GiveGroup
Give player group of warriors and return the group ID or -1 if the group was not able to be added
aPlayer: Word;
aType: Word;
X,Y: Word;
aDir: Word;
aCount: Word;
aColumns: Word; // Units per row
Integer
5097 GiveHouse
Give player a built house and returns the house ID or -1 if the house was not able to be added
aPlayer: Integer;
aHouseType: Integer;
X,Y: Integer;
Integer
6288 GiveHouseSite
Give player a digged house area and returns House ID or -1 if house site was not able to be added. If !AddMaterials = True, wood and stone will be added
aPlayer: Integer;
aHouseType: Integer;
X: Integer;
Y: Integer;
aAddMaterials: Boolean;
Integer
6311 GiveRoad
Adds finished road and returns true if road was successfully added
aPlayer: Word;
X: Word;
Y: Word;
Boolean
5057 GiveUnit
Give player a single citizen and returns the unit ID or -1 if the unit was not able to be added
aPlayer: Word;
aType: Word;
X: Word;
Y: Word;
aDir: Word;
Integer
5057 GiveWares
Adds amount of wares to players 1st Store
aPlayer: Word;
aType: Word;
aCount: Word;
5165 GiveWeapons
Adds amount of weapons to players 1st Barracks
aPlayer: Word;
aType: Word;
aCount: Word;
6277 GroupBlockOrders
Disables (Disable = True) or enables (Disable = False) control over specifed warriors group
aGroupID: Integer;
aBlock: Boolean;
5993 GroupDisableHungryMessage
Sets whether the specified group will alert the player when they become hungry (true to disable hunger messages, false to enable them)
aGroupID: Integer;
aDisable: Boolean;
5993 GroupHungerSet
Set hunger level for all group members
aGroupID: Integer;
aHungerLevel: Integer; // Hunger level (ticks until death)
5993 GroupKillAll
Kills all members of the specified group
aGroupID: Integer;
aSilent: Boolean;
5057 GroupOrderAttackHouse
Order the specified group to attack the specified house
aGroupID: Integer;
aHouseID: Integer;
5057 GroupOrderAttackUnit
Order the specified group to attack the specified unit
aGroupID: Integer;
aUnitID: Integer;
5057 GroupOrderFood
Order the specified group to request food
aGroupID: Integer;
5057 GroupOrderHalt
Order the specified group to halt
aGroupID: Integer;
5057 GroupOrderLink
Order the first specified group to link to the second specified group
aGroupID: Integer;
aDestGroupID: Integer;
5057 GroupOrderSplit
Order the specified group to split in half. Return the newly create group ID or -1 if splitting failed (e.g. only 1 member)
aGroupID: Integer; Integer
6338 GroupOrderSplitUnit
Splits specified unit from the group. Returns the newly create group ID or -1 if splitting failed (e.g. only 1 member)
aGroupID: Integer;
aUnitID: Integer;
Integer
5057 GroupOrderStorm
Order the specified group to storm attack
aGroupID: Integer;
5057 GroupOrderWalk
Order the specified group to walk somewhere
aGroupID: Integer;
X: Word;
Y: Word;
aDirection: Word;
5057 GroupSetFormation
Sets the number of columns (units per row) for the specified group
aGroupID: Integer;
aNumColumns: Byte;
6510 HouseAddBuildingMaterials
Add building materials to the specified WIP house area
aHouseID: Integer;
6297 HouseAddBuildingProgress
Add 5 points of building progress to the specified WIP house area
aHouseID: Integer;
5057 HouseAddDamage
Add damage to the specified house
aHouseID: Integer;
aDamage: Word;
5441 HouseAddRepair
Reduces damage to the specified house
aHouseID: Integer;
aRepair: Word;
5057 HouseAddWaresTo
Add wares to the specified house
aHouseID: Integer;
aType: Word;
aCount: Word;
5057 HouseAllow
Sets whether the player is allowed to build the specified house. Note: The house must still be unlocked normally (e.g. sawmill for farm), use !HouseUnlock to override that.
aPlayer: Word;
aHouseType: Word;
aAllowed: Boolean;
5174 HouseBarracksEquip
Equips the specified unit from the specified barracks. Returns the number of units successfully equipped.
aHouseID: Integer;
aUnitType: Integer;
aCount: Integer;
Integer
6125 HouseBarracksGiveRecruit
Adds a recruit inside the specified barracks
aHouseID: Integer;
5057 HouseDeliveryBlock
Sets delivery blocking for the specified house
aHouseID: Integer;
aDeliveryBlocked: Boolean;
5263 HouseDestroy
Destroys the specified house. Silent means the house will not leave rubble or play destroy sound
aHouseID: Integer;
aSilent: Boolean;
5345 HouseDisableUnoccupiedMessage
Sets whether the specified house displays unoccupied messages to the player
aHouseID: Integer;
aDisabled: Boolean;
- HouseOwnerSet
Take house from one player and give it to another
5057 HouseRepairEnable
Enables house repair for the specified house
aHouseID: Integer;
aRepairEnabled: Boolean;
5174 HouseSchoolQueueAdd
Adds the specified unit to the specified school's queue. Returns the number of units successfully added to the queue.
aHouseID: Integer;
aUnitType: Integer;
aCount: Integer;
Integer
5174 HouseSchoolQueueRemove
Removes the unit from the specified slot of the school queue. Slot 0 is the unit currently training, slots 1..5 are the queue.
aHouseID: Integer;
QueueIndex: Integer;
6015 HouseTakeWaresFrom
Remove wares from the specified house. If a serf was on the way to pick up the ware, the serf will abandon his task
aHouseID: Integer;
aType: Word;
aCount: Word;
5057 HouseUnlock
Allows player to build the specified house even if they don't have the house built that normally unlocks it (e.g. sawmill for farm). Note: Does not override blocked houses, use !HouseAllow for that.
aPlayer: Word;
aHouseType: Word;
5099 HouseWareBlock
Blocks a specific ware in a storehouse or barracks
aHouseID: Integer;
aWareType: Integer;
aBlocked: Boolean;
5165 HouseWeaponsOrderSet
Sets the amount of the specified weapon ordered to be produced in the specified house
aHouseID: Integer;
aWareType: Integer;
aAmount: Integer;
5099 HouseWoodcutterChopOnly
Sets whether a woodcutter's hut is on chop-only mode
aHouseID: Integer;
aChopOnly: Boolean;
6067 Log
Writes a line of text to the game log file. Useful for debugging. Note that many calls to this procedure will have a noticeable performance impact, as well as creating a large log file, so it is recommended you don't use it outside of debugging
aText: AnsiString;
6587 MapTileHeightSet
Sets the height of the terrain at the top left corner (vertex) of the tile at the specified XY coordinates. Returns true if the change succeeded or false if it failed. The change will fail if it would cause a unit to become stuck or a house to be damaged
X: Integer;
Y: Integer;
Height: Integer; // Height (0..100)
Boolean
6587 MapTileObjectSet
Sets the terrain object on the tile at the specified XY coordinates. Object IDs can be seen in the map editor on the objects tab. Object 61 is "block walking". To set no object, use object type 255. Returns true if the change succeeded or false if it failed. The change will fail if it would cause a unit to become stuck or a house/field to be damaged
X: Integer;
Y: Integer;
Obj: Integer; // Object type (0..255)
Boolean
6587 MapTileSet
Sets the tile type and rotation at the specified XY coordinates. Tile IDs can be seen by hovering over the tiles on the terrain tiles tab in the map editor. Returns true if the change succeeded or false if it failed. The change will fail if it would cause a unit to become stuck or a house/field to be damaged
X: Integer;
Y: Integer;
aType: Integer; // Tile type (0..255)
aRotation: Integer; // Tile rotation (0..3)
Boolean
6216 MarketSetTrade
Sets the trade in the specified market
aMarketID: Integer;
aFrom: Integer;
aTo: Integer;
aAmount: Integer;
5333 OverlayTextAppend
Appends to text overlaid on top left of screen. If the player index is -1 it will be appended for all players.
aPlayer: Shortint;
aText: AnsiString;
5333 OverlayTextAppendFormatted
Appends to text overlaid on top left of screen with formatted arguments (same as Format function). If the player index is -1 it will be appended for all players.
aPlayer: Shortint;
aText: AnsiString;
Params: array of const; // Array of arguments
5333 OverlayTextSet
Sets text overlaid on top left of screen. If the player index is -1 it will be set for all players.
aPlayer: Shortint;
aText: AnsiString;
5333 OverlayTextSetFormatted
Sets text overlaid on top left of screen with formatted arguments (same as Format function). If the player index is -1 it will be set for all players.
aPlayer: Shortint;
aText: AnsiString;
Params: array of const; // Array of arguments
5057 PlanAddField
Adds a corn field plan. Returns true if the plan was successfully added or false if it failed (e.g. tile blocked)
aPlayer: Word;
X: Word;
Y: Word;
Boolean
5057 PlanAddHouse
Adds a road plan. Returns true if the plan was successfully added or false if it failed (e.g. tile blocked)
aPlayer: Word;
aHouseType: Word;
X: Word;
Y: Word;
Boolean
5057 PlanAddRoad
Adds a road plan. Returns true if the plan was successfully added or false if it failed (e.g. tile blocked)
aPlayer: Word;
X: Word;
Y: Word;
Boolean
5057 PlanAddWinefield
Adds a wine field plan. Returns true if the plan was successfully added or false if it failed (e.g. tile blocked)
aPlayer: Word;
X: Word;
Y: Word;
Boolean
6303 PlanConnectRoad
Connects road plans between two points like AI builder and returns True if road plan was successfully added. If CompletedRoad = True, road will be added instead of plans
aPlayer: Integer;
X1: Integer; // Left coordinate
Y1: Integer; // Top coordinate
X2: Integer; // Right coordinate
Y2: Integer; // Bottom coordinate
aCompleted: Boolean; // Completed road
Boolean
5345 PlanRemove
Removes house, road or field plans from the specified tile for the specified player Returns true if the plan was successfully removed or false if it failed (e.g. tile blocked)
aPlayer: Word;
X: Word;
Y: Word;
Boolean
5165 PlayerAddDefaultGoals
Add default goals/lost goals for the specified player. If the parameter buildings is true the goals will be important buildings. Otherwise it will be troops.
aPlayer: Byte;
aBuildings: Boolean;
5097 PlayerAllianceChange
Change whether player1 is allied to player2. If Compliment is true, then it is set both ways (so also whether player2 is allied to player1)
aPlayer1: Byte;
aPlayer2: Byte;
aCompliment: Boolean; // Both ways
aAllied: Boolean;
5057 PlayerDefeat
Proclaims player defeated
aPlayer: Word;
5345 PlayerShareFog
Sets whether player A shares his vision with player B. Sharing can still only happen between allied players, but this command lets you disable allies from sharing.
aPlayer1: Word;
aPlayer2: Word;
aShare: Boolean;
5345 PlayerWareDistribution
Sets ware distribution for the specified resource, house and player.
aPlayer: Byte;
aWareType: Byte;
aHouseType: Byte;
aAmount: Byte; // Distribution amount (0..5)
5057 PlayerWin
Set specified player(s) victorious, and all team members of those player(s) if the 2nd parameter !TeamVictory is set to true. All players who were not set to victorious are set to defeated.
aVictors: array of Integer; // Array of player IDs
aTeamVictory: Boolean;
5309 PlayWAV
Plays audio file. If the player index is -1 the sound will be played to all players. Mono and stereo WAV files are supported. WAV file goes in mission folder named: Mission Name.filename.wav
aPlayer: Shortint;
aFileName: AnsiString;
aVolume: Single; // Audio level (0.0 to 1.0)
5309 PlayWAVAtLocation
Plays audio file at a location on the map. If the player index is -1 the sound will be played to all players. Radius specifies approximately the distance at which the sound can no longer be heard (normal game sounds use radius 32). Only mono WAV files are supported. WAV file goes in mission folder named: Mission Name.filename.wav. Will not play if the location is not revealed to the player. Higher volume range is allowed than PlayWAV as positional sounds are quieter
aPlayer: Shortint;
aFileName: AnsiString;
aVolume: Single; // Audio level (0.0 to 1.0)
aRadius: Single; // Radius (minimum 28)
aX: Word;
aY: Word;
6222 PlayWAVAtLocationLooped
Plays looped audio file at a location on the map. If the player index is -1 the sound will be played to all players. aRadius specifies approximately the distance at which the sound can no longer be heard (normal game sounds use aRadius 32). Only mono WAV files are supported. WAV file goes in mission folder named: Mission Name.filename.wav. Will not play if the location is not revealed to the player (will start playing automatically when it is revealed). Higher aVolume range is allowed than PlayWAV as positional sounds are quieter. The sound will continue to loop if the game is paused and will restart automatically when the game is loaded.
aPlayer: Shortint;
aFileName: AnsiString;
aVolume: Single; // Audio level (0.0 to 1.0)
aRadius: Single; // aRadius (minimum 28)
aX: Word;
aY: Word;
Integer // LoopIndex of the sound
6220 PlayWAVFadeMusic
Same as PlayWAV except music will fade then mute while the WAV is playing, then fade back in afterwards. You should leave a small gap at the start of your WAV file to give the music time to fade
aPlayer: Shortint;
aFileName: AnsiString;
aVolume: Single; // Audio level (0.0 to 1.0)
6222 PlayWAVLooped
Plays looped audio file. If the player index is -1 the sound will be played to all players. Mono or stereo WAV files are supported. WAV file goes in mission folder named: Mission Name.filename.wav. The sound will continue to loop if the game is paused and will restart automatically when the game is loaded.
aPlayer: Shortint;
aFileName: AnsiString;
aVolume: Single; // Audio level (0.0 to 1.0)
Integer // LoopIndex of the sound
5927 RemoveRoad
Removes road
X: Word;
Y: Word;
5057 SetTradeAllowed
Sets whether the player is allowed to trade the specified resource.
aPlayer: Word;
aResType: Word;
aAllowed: Boolean;
5057 ShowMsg
Displays a message to a player. If the player index is -1 the message will be shown to all players.
aPlayer: Shortint;
aText: AnsiString;
5333 ShowMsgFormatted
Displays a message to a player with formatted arguments (same as Format function). If the player index is -1 the message will be shown to all players.
aPlayer: Shortint;
aText: AnsiString;
Params: array of const; // Array of arguments
5345 ShowMsgGoto
Displays a message to a player with a goto button that takes the player to the specified location. If the player index is -1 the message will be shown to all players.
aPlayer: Shortint;
aX: Word;
aY: Word;
aText: AnsiString;
5345 ShowMsgGotoFormatted
Displays a message to a player with formatted arguments (same as Format function) and a goto button that takes the player to the specified location. If the player index is -1 the message will be shown to all players.
aPlayer: Shortint;
aX: Word;
aY: Word;
aText: AnsiString;
Params: array of const; // Array of arguments
6222 StopLoopedWAV
Stops playing a looped sound that was previously started with either Actions.PlayWAVLooped or Actions.PlayWAVAtLocationLooped.
aLoopIndex: Integer; // LoopIndex is the value that was returned by either of those functions when the looped sound was started.
5993 UnitBlock
Sets whether the specified player can train/equip the specified unit type
aPlayer: Byte;
aType: Word;
aBlock: Boolean;
5057 UnitDirectionSet
Makes the specified unit face a certain direction. Note: Only works on idle units so as not to interfere with game logic and cause crashes. Returns true on success or false on failure.
aUnitID: Integer;
aDirection: Integer;
Boolean
5057 UnitHungerSet
Sets the hunger level of the specified unit in ticks until death
aUnitID: Integer;
aHungerLevel: Integer; // Hunger level (ticks until death)
5099 UnitKill
Kills the specified unit. Silent means the death animation (ghost) and sound won't play
aUnitID: Integer;
aSilent: Boolean;
5057 UnitOrderWalk
Order the specified unit to walk somewhere. Note: Only works on idle units so as not to interfere with game logic and cause crashes. Returns true on success or false on failure.
aUnitID: Integer;
X: Word;
Y: Word;
Boolean
- UnitLock
Lock out the unit from game updates and make it manually scriptable (?)
- UnitOwnerSet
Take unit from one player and give it to another
- UnitPositionSet
Magically move unit from one place to another (?)