Skip to content

Commit

Permalink
Added new XS functions from Chronicles DLC
Browse files Browse the repository at this point in the history
  • Loading branch information
mardaravicius authored Nov 17, 2024
1 parent e4c76da commit f334913
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 4 deletions.
81 changes: 81 additions & 0 deletions docs/general/xs/functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,87 @@
}
],
"desc": "Returns the number of currently alive/standing + queued/foundation objects with the given ID of the specified player"
},
{
"name": "xsTaskAmount",
"return_type": "void",
"params": [
{
"name": "taskFieldId",
"type": "int",
"required": true,
"desc": "Specifies which property of the task to change\n - 0: Work Value 1\n - 1: Work Value 2\n - 2: Work Range\n - 3: Work Flag \n - 4: Search Wait Time\n - 5: Unused Flag (it is not actually unused, just what it's called in A.G.E.)\n - 6: Target Diplomacy"
},
{
"name": "value",
"type": "float",
"required": true,
"desc": "The value to set the task field to"
}
],
"desc": "Sets the value of the given field of the global XS task struct to the provided value. See also [`#!cpp xsTask`](./#530-xstask)"
},
{
"name": "xsTask",
"return_type": "void",
"params": [
{
"name": "unitId",
"type": "int",
"required": true,
"desc": "The unit to add the task to"
},
{
"name": "actionType",
"type": "int",
"required": true,
"desc": "Task type. Eg.: 105 for heal, 155 for aura and etc. Look in the A.G.E."
},
{
"name": "targetUnitId",
"type": "int",
"required": false,
"desc": "Target unitId for the task if exists. Values 9xx refer to classes."
},
{
"name": "playerId",
"type": "int",
"required": false,
"desc": "The player to whose units the task will be inserted. If unspecified or -1, applies to all players except Gaia."
}
],
"desc": "Adds a new (or edits an existing) task with the fields previously defined by calls to [`#!cpp xsTaskAmount`](./#531-xstaskamount) for the specified unit at the end of the task list (see A.G.E.). If a task with the specified `actionType`, `unitId`, and `Search Wait Time` (set by `xsTaskAmount`) already exists, it is edited instead of a new one being added.\n\nNote that `xsTaskAmount` modifies a global task struct which is re-used every time `#!cpp xsTask` is called (For non programmers, this is similar to filling out a form once (the calls to [`#!cpp xsTaskAmount`](./#531-xstaskamount)) and then submitting multiple copies of it for different people)"
},
{
"name": "xsRemoveTask",
"return_type": "void",
"params": [
{
"name": "unitId",
"type": "int",
"required": true,
"desc": "Unit to remove the task from."
},
{
"name": "actionType",
"type": "int",
"required": true,
"desc": "Task type. Eg.: 105 for heal, 155 for aura and etc. Look in the A.G.E."
},
{
"name": "targetUnitId",
"type": "int",
"required": false,
"desc": "Target unitId for the task if exists. Values 9xx refer to classes."
},
{
"name": "playerId",
"type": "int",
"required": false,
"desc": "The player from whose units the task will be removed. If unspecified or -1, applies to all players except Gaia."
}
],
"desc": "Removes a task from a unit if the specified `actionType`, `unitId`, and `Search Wait Time` (set by `xsTaskAmount`) match an existing task in a unit. No other fields are used for filtering (same as when `xsTask` edits instead of adding a new task)"
}
],
"Read/Write": [
Expand Down
60 changes: 56 additions & 4 deletions docs/general/xs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,22 @@ Parameters:

Returns the amount the specified resource of the given player.

### 5.27. xsResearchTechnology
### 5.27. xsRemoveTask

Returning Type: `#!cpp void`

Prototype: `#!cpp void xsRemoveTask(int unitId, int actionType, int targetUnitId, int playerId)`

Parameters:

1. `#!cpp int unitId`: Unit to remove the task from.
2. `#!cpp int actionType`: Task type. Eg.: 105 for heal, 155 for aura and etc. Look in the A.G.E.
3. (Optional) `#!cpp int targetUnitId`: Target unitId for the task if exists. Values 9xx refer to classes.
4. (Optional) `#!cpp int playerId`: The player from whose units the task will be removed. If unspecified or -1, applies to all players except Gaia.

Removes a task from a unit if the specified `actionType`, `unitId`, and `Search Wait Time` (set by `xsTaskAmount`) match an existing task in a unit. No other fields are used for filtering (same as when `xsTask` edits instead of adding a new task)

### 5.28. xsResearchTechnology

Returning Type: `#!cpp bool`

Expand All @@ -995,7 +1010,7 @@ Parameters:

Returns a boolean based on whether the technology was researched or not.

### 5.28. xsSetPlayerAttribute
### 5.29. xsSetPlayerAttribute

Returning Type: `#!cpp void`

Expand All @@ -1009,7 +1024,7 @@ Parameters:

Sets the amount of the specified resource of the given player to the provided value.

### 5.29. xsSetTriggerVariable
### 5.30. xsSetTriggerVariable

Returning Type: `#!cpp void`

Expand All @@ -1022,7 +1037,44 @@ Parameters:

Sets the value of the variable of the given variable ID to the provided value.

### 5.30. xsTriggerVariable
### 5.31. xsTask

Returning Type: `#!cpp void`

Prototype: `#!cpp void xsTask(int unitId, int actionType, int targetUnitId, int playerId)`

Parameters:

1. `#!cpp int unitId`: The unit to add the task to
2. `#!cpp int actionType`: Task type. Eg.: 105 for heal, 155 for aura and etc. Look in the A.G.E.
3. (Optional) `#!cpp int targetUnitId`: Target unitId for the task if exists. Values 9xx refer to classes.
4. (Optional) `#!cpp int playerId`: The player to whose units the task will be inserted. If unspecified or -1, applies to all players except Gaia.

Adds a new (or edits an existing) task with the fields previously defined by calls to [`#!cpp xsTaskAmount`](./#531-xstaskamount) for the specified unit at the end of the task list (see A.G.E.). If a task with the specified `actionType`, `unitId`, and `Search Wait Time` (set by `xsTaskAmount`) already exists, it is edited instead of a new one being added.

Note that `xsTaskAmount` modifies a global task struct which is re-used every time `#!cpp xsTask` is called (For non programmers, this is similar to filling out a form once (the calls to [`#!cpp xsTaskAmount`](./#531-xstaskamount)) and then submitting multiple copies of it for different people)

### 5.32. xsTaskAmount

Returning Type: `#!cpp void`

Prototype: `#!cpp void xsTaskAmount(int taskFieldId, float value)`

Parameters:

1. `#!cpp int taskFieldId`: Specifies which property of the task to change
- 0: Work Value 1
- 1: Work Value 2
- 2: Work Range
- 3: Work Flag
- 4: Search Wait Time
- 5: Unused Flag (it is not actually unused, just what it's called in A.G.E.)
- 6: Target Diplomacy
2. `#!cpp float value`: The value to set the task field to

Sets the value of the given field of the global XS task struct to the provided value. See also [`#!cpp xsTask`](./#530-xstask)

### 5.33. xsTriggerVariable

Returning Type: `#!cpp int`

Expand Down

0 comments on commit f334913

Please sign in to comment.