-
-
Notifications
You must be signed in to change notification settings - Fork 122
New 190xx ScriptType actions that are masks of existing actions that used indexes as arguments #1901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
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.
…_string-support_plus_id2index-masks
|
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. |
|
Some use-case examples: Example of Index of the building with "least threat": Example of Index of the building with "highest threat": Example of Index of the building with is "nearest": Example of Index of the building with is "farthest": Example playing an animation: x=51,11 The basic idea is that now you can move any element in those lists and always will point to the desired object. |
|
19020 cause a FE |
|
As far as I know, although it’s called “change house”, action 20 uses the [Countries] index. |
|
Fixed (I forgot testing this 19020 so sorry!). Now it finds the right House index. |
|
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]. |
Instead of mentioning Houses now it should mention Countries
regarding the 19020 action
|
Changed the 19020 behavior and now should read country names instead of house names. |
|
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), |
secsome
left a comment
There was a problem hiding this 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.
src/Ext/Script/Hooks.cpp
Outdated
| 196608 (Hex 0x30000) + Building Index -> Index of the instance of the building which is farthest | ||
| */ | ||
|
|
||
| //strcpy_s(id, strtok_s(textArgument, ",", &context)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
|
LGTM |


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).
19017Change Script[ScriptTypes]list instead of an index.In
aimd.ini:19018Change TeamType[TeamTypes]list instead of an index.In
aimd.ini:19020Change House[Countries]list instead of an index.In
aimd.ini:19024Play Speech[DialogList]list instead of an index.In
aimd.ini:19025Play Sound[SoundList]list instead of an index.In
aimd.ini:19027Play Theme[Themes]list instead of an index.In
aimd.ini:19051Play Animation[Animations]list instead of an index.In
aimd.ini:19046Attack Enemy Structure[BuildingTypes]list instead of an index.In
aimd.ini:19047Move To Enemy Structure[BuildingTypes]list instead of an index.19046.In
aimd.ini:19056Chronoshift TaskForce To Structure[BuildingTypes]list instead of an index.19046.In
aimd.ini:19058Move To Friendly Structure[BuildingTypes]list instead of an index.19046.In
aimd.ini: