Skip to content

Action scripts - AngerNodes manipulation#442

Open
FS-21 wants to merge 89 commits intoPhobos-developers:developfrom
FS-21:feature/script-action-houses-anger
Open

Action scripts - AngerNodes manipulation#442
FS-21 wants to merge 89 commits intoPhobos-developers:developfrom
FS-21:feature/script-action-houses-anger

Conversation

@FS-21
Copy link
Copy Markdown
Contributor

@FS-21 FS-21 commented Nov 18, 2021

This pack of actions manipulates the hate of the houses towards other houses. This don't replace the game function "make_enemies()" but helps the AI to pick the one with highest value for being the most hated (the main enemy of the house used in the AI trigger tag called "OnlyTargetHouseEnemy").

The hate table values of all Houses increase quickly depending of how much time another house is attacking by another house & decreases very slow in moments of peace.

Curiosity note: this can be used for overriding the known MP bug of allied AI with the human player at the beginning of the games that they start as pacifists until they get attacked by others (because their only hated player is the 1º human player and that one is "ally" so they can't attack him).
The same reason explains why initially in the MP battle all AI houses attacks the player.


No official documentation yet but I'll copy here all the details & possible values of each action:

Action 114 - Set House anger value modifier
Affects how much hate applies to a selected house (depends of the script action). This anger value is applied only inside the scriptType of the Team.
Format: 114,n
Possible values: Positive for increase hate and negative values for decreasing hate. Default to 0
Affects actions: 116, 117, 118, 119, 120 & 121


Action 115 - Override OnlyTargetHouseEnemy value
The value of the tag OnlyTargetHouseEnemy in AI Triggers can be modified for the new Attack & Move actions. Only affects the next new attack or move action script. These anger values are applied only in the House owner of the team.
Format: 115,n
Possible values: 
-1 ; Use default value specified in OnlyTargetHouseEnemy tag
0  ; force the tag value to FALSE
1  ; force the tag value to TRUE
2  ; force the tag value to TRUE or FALSE randomly.


Action 116 - Modify House hate with index
Modifies a specific House hate using its index value as House array selector. Is applied to the House owner of the team.
Format: 116,n
Possible values:
n >= 0 (keep in mind that a Multiplayer map only has 8 players plus "Neutral & Special" houses) so doesn't have any sense to pick a higer value than the index of the last House. Pobably isn't recommended for all modders if you don't know what index have each player. These anger values are applied only in the House owner of the team.

Action 117 - Modify Hate values from a list of Houses
Picks a list of Houses from the rulesmd.ini section called [AIHousesList] and if any House appear in the scenario then the hate value against those Houses will be modified. These anger values are applied only in the House owner of the team.
Format of the new section:
[AIHousesList]
0=Here_Your_House_ID_1,Here_Your_House_ID_2, ...
1=...
Format: 117,n
Possible values:
>= 0 integer values that is the index of the list in [AIHousesList]


Action 118 - Modify randomly the Hate value of a house specified in a list of Houses
Like action 117 but only picks 1 house randomly from the specified list and then search that selected House in the scenario for midifying the hate value. These anger values are applied only in the House owner of the team.
Format of the new section:
[AIHousesList]
0=Here_Your_House_ID_1,Here_Your_House_ID_2, ...
1=...
Format: 118,n
Possible values:
>= 0 integer values that is the index of the list in [AIHousesList]


Action 119 - Set the most hated House ("<" comparison)
Basicly it increases the owner's anger against an Enemy House converting the selected House as the main enemy of the Team's owner. Depends on the specified argument.
Format: 119,n
Possible values:
-7 ; The House with less house kills is selected
-6 ; The House with less free power (free = production - consumption) is selected
-5 ; The House with less power production is selected
-4 ; The House with less power consumption is selected
-3 ; The nearest enemy Human base is selected
-2 ; The poorest House is selected
-1 ; The enemy House with nearest unit to the Team Leader is selected
>0 ; (using the parameters from the new attack/move script actions) The House with less threat of the checked type (sum of all the units of the same checked type * threat value)


Action 120 - Set the most hated House (">" comparison)
Basicly it increases the owner's anger against an Enemy House converting the selected House as the main enemy of the Team's owner. Depends on the specified argument.
Format: 120,n
Possible values:
-7 ; The House with more house kills is selected
-6 ; The House with more free power (free = production - consumption) is selected
-5 ; The House with more power production is selected
-4 ; The House with more power consumption is selected
-3 ; The farthest enemy Human base is selected
-2 ; The richest House is selected
-1 ; The enemy House with farthest unit to the Team Leader is selected
>0 ; (using the parameters from the new attack/move script actions) The House with more threat of the checked type (sum of all the units of the same checked type * threat value)


Action 121 - Set the most hated House randomly
Basicly it increases the owner's anger against an Enemy House picked randomly.
Format: 121,0


Action 122 - Reset anger against other Houses
Sets to 0 every House hate level. Is applied to the House owner of the team.
Format: 122,0


Action 123 - 
The selected house will become the most hated House of the map (the effects are only visible if the other houses are enemy of the selected house)
Format: 123,n
Possible values:
-3   ; All Human players will be hated by everyone.
-2   ; The Team's owner will be the most hated by everyone.
-1   ; Selects a random House. The own House is excluded in the selection of the most hated by everyone.
>= 0 ; Index of the House that will be hated by everyone.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 18, 2021

Nightly build for this pull request:

YRIDZE
YRIDZE previously requested changes Nov 21, 2021
Copy link
Copy Markdown
Collaborator

@YRIDZE YRIDZE left a comment

Choose a reason for hiding this comment

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

Please, review your code for properly formatted "if" long statement separation (most of them I highlighted) and "switch" statements (availability of the required blank lines). And also break up long log lines.

Comment thread src/Ext/Script/Body.cpp Outdated
Comment thread src/Ext/Script/Body.cpp Outdated
Comment thread src/Ext/Script/Body.cpp Outdated
Comment thread src/Ext/Script/Body.cpp Outdated
Comment thread src/Ext/Script/Body.cpp Outdated
Comment thread src/Ext/Script/Body.cpp Outdated
FS-21 and others added 9 commits November 21, 2021 22:11
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
When using ObjectInfo or the AngerNode Action is executed successfuly some debug lines will be written in debug.log with the current AngerNode values of each house.
@FS-21
Copy link
Copy Markdown
Contributor Author

FS-21 commented Nov 29, 2021

For the testing of the PR I added some new debug lines that will appear in debug.log each time the action is executed successfuly or ObjectInfo is used.

Data will look like this:

Player 0 [Observer]
Player 1 [GDICountry2]: 0:0, 2:1, 3:0, 4:0 -> Main Enemy House: 2
Player 2 [AlliesCountry]: 0:1, 1:1, 3:0, 4:0 -> Main Enemy House: 1
Player 3 [Neutral]: 0:0, 1:0, 2:0, 4:0 -> Main Enemy House: -1
Player 4 [Special]: 0:0, 1:0, 2:0, 3:0 -> Main Enemy House: -1

How interpret each House's line?:
[]: <enemy index #1:Anger value>, <enemy index #2:Anger value>, ... -> <Index of the House's enemy>

@secsome secsome force-pushed the develop branch 2 times, most recently from c3d0a52 to 1abda28 Compare December 8, 2021 14:10
@FS-21
Copy link
Copy Markdown
Contributor Author

FS-21 commented Jul 12, 2024

Something I forgot to point out in the other scripting PR that got recently merged, the changelog page (What's New) contains a section called For Map Editor (Final Alert 2). You should add entries for any new map trigger events & actions and AI script actions there.

Then I'll add the FA2 references from the previous map events PR here if you agree.

FS-21 added 4 commits July 13, 2024 12:27
ScriptExt::GetTheMostHatedHouse(...) was refactored due the multiple duplicated portions of code and other feedback changes-
Comment thread src/Ext/Script/Body.AngerNodes.cpp Outdated
@FS-21
Copy link
Copy Markdown
Contributor Author

FS-21 commented Aug 29, 2024

Added FA2 documentation of these script actions as requested.

Isn't nothing more left right?

@Starkku Starkku force-pushed the develop branch 2 times, most recently from b429215 to 280b1c8 Compare June 29, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants