Skip to content

Conversation

@FS-21
Copy link
Contributor

@FS-21 FS-21 commented Oct 8, 2025

  • These actions are "masks" of existing actions:
    These actions translate IDs into indices while preserving the original action values. The reason for using these masks is that some ScriptType actions rely on fixed indices rather than ID labels (basically because all arguments are readed as integers). When these lists change, there's a high probability of breaking the original index of the pointed element.
    So for example if is readed:
    x=19046,GAPOWR,LeastThreat
    It will be translated into:
    x=46,0
    The modder won't have to calculate the index every time because is calculated the first time the scenario is readed.

  • Yes, arguments now support reading strings (if the action supports it that currently are these cases).

19017 Change Script

  • Similar to action 17, but uses a string ID from the [ScriptTypes] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19017,ID        ; text

19018 Change TeamType

  • Similar to action 18, but uses a string ID from the [TeamTypes] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19018,ID        ; text

19020 Change House

  • Similar to action 20, but uses a string ID from the [Countries] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19020,ID        ; text

19024 Play Speech

  • Similar to action 24 (when the respective PR gets merged), but uses a string ID from the [DialogList] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19024,ID        ; text

19025 Play Sound

  • Similar to action 25, but uses a string ID from the [SoundList] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19025,ID        ; text

19027 Play Theme

  • Similar to action 27, but uses a string ID from the [Themes] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19027,ID        ; text

19051 Play Animation

  • Similar to action 51, but uses a string ID from the [Animations] list instead of an index.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19051,ID        ; text

19046 Attack Enemy Structure

  • Similar to action 46, but uses a string ID from the [BuildingTypes] list instead of an index.
  • The last parameter is the BwP. Check below the possible strings.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19046,ID,BwP    ; text
BwP values Description
LeastThreat Index of the instance of the building with least threat
HighestThreat Index of the instance of the building with highest threat
Nearest Index of the instance of the building which is nearest
Farthest Index of the instance of the building which is farthest
More BwP information in https://modenc.renegadeprojects.com/ScriptTypes/ScriptActions
For this action to work in multiplayer - you need to use a version of [Script Actions information at Modenc](https://modenc.renegadeprojects.com/ScriptTypes/ScriptActions).

19047 Move To Enemy Structure

  • Similar to action 47, but uses a string ID from the [BuildingTypes] list instead of an index.
  • The last parameter is the BwP. Check the table of the action 19046.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19047,ID,BwP    ; text

19056 Chronoshift TaskForce To Structure

  • Similar to action 56, but uses a string ID from the [BuildingTypes] list instead of an index.
  • The last parameter is the BwP. Check the table of the action 19046.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19056,ID,BwP    ; text

19058 Move To Friendly Structure

  • Similar to action 58, but uses a string ID from the [BuildingTypes] list instead of an index.
  • The last parameter is the BwP. Check the table of the action 19046.

In aimd.ini:

[SOMESCRIPTTYPE]  ; ScriptType
x=19058,ID,BwP    ; text

FS-21 added 2 commits October 8, 2025 14:02
Some vanilla script actions now have a Phobos equivalent that you have to write the object's ID instead of index.

String reading support in ScriptType action arguments. The script must support this.
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@FS-21
Copy link
Contributor Author

FS-21 commented Oct 10, 2025

Some use-case examples:
[BuildingTypes]
...
1=GAREFN ; Allied Refinery
...

Example of Index of the building with "least threat":
x=46,1
Now can be translated as:
x=19046,GAREFN,LeastThreat

Example of Index of the building with "highest threat":
x=46,65537
Now can be translated as:
x=19046,GAREFN,HighestThreat

Example of Index of the building with is "nearest":
x=46,131073
Now can be translated as:
x=19046,GAREFN,Nearest

Example of Index of the building with is "farthest":
x=46,196609
Now can be translated as:
x=19046,GAREFN,Farthest

Example playing an animation:
[Animations]
...
11=GUNFIRE
...

x=51,11
Now can be translated as:
x=19051,GUNFIRE

The basic idea is that now you can move any element in those lists and always will point to the desired object.

@fagonghaiwo
Copy link

19020 cause a FE
EIP: 6A0B167B
Module Phobos.dll base address : 0x6A070000.

@handama
Copy link
Contributor

handama commented Oct 12, 2025

As far as I know, although it’s called “change house”, action 20 uses the [Countries] index.

@FS-21
Copy link
Contributor Author

FS-21 commented Oct 12, 2025

Fixed (I forgot testing this 19020 so sorry!). Now it finds the right House index.
The problem was that the argument was readed until a space was found, now reads the line until the end. so for excample if you have a house called "Nod APCs" now reads "Nod APCs" instead of only "Nod".

handama, not very sure about your comment about Countries:
image

@handama
Copy link
Contributor

handama commented Oct 12, 2025

test_map_19020.zip

For a SP map like this, which uses new houses instead of default ones auto-created by map editor (e.g. vanilla RA2 campaigns), the house index and country index does not match. In this test map, the correct param to change to BadGuy1 House is [15], while the result of HouseClass::FindIndexByName is [1].

@FS-21
Copy link
Contributor Author

FS-21 commented Oct 12, 2025

Right! Now I see the problem (I found a similar case but in my mod):
image

I'll submit a fix soon.

FS-21 added 2 commits October 12, 2025 23:08
Instead of mentioning Houses now it should mention Countries
regarding the 19020 action
@FS-21
Copy link
Contributor Author

FS-21 commented Oct 12, 2025

Changed the 19020 behavior and now should read country names instead of house names.

@FS-21
Copy link
Contributor Author

FS-21 commented Oct 14, 2025

Ah yes, for the tests don't use WAE (even if you edit the ScriptActions.ini file) because this editor doesn't support writing text in the parameters TextBox and will ruin these scripts when you save it with a "-1" value (think parameters were always integers so why would they think about strings),
Only handwritten tests are recommended.

Copy link
Member

@secsome secsome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged after testing and doing those cleanups.

196608 (Hex 0x30000) + Building Index -> Index of the instance of the building which is farthest
*/

//strcpy_s(id, strtok_s(textArgument, ",", &context));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those useless comments can be removed imo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including the explanation or only the old code?

@secsome
Copy link
Member

secsome commented Nov 4, 2025

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants