From 21510191b61f7ec7befcacb5724d7c86c682e7d7 Mon Sep 17 00:00:00 2001 From: FS-21 Date: Wed, 8 Oct 2025 11:31:05 +0200 Subject: [PATCH 1/3] Initial commit - Given a speech index, the game will play it. Just like action 24 from Tiberian Sun. In `aimd.ini`: ```ini [SOMESCRIPTTYPE] ; ScriptType x=19000,n ``` --- CREDITS.md | 1 + docs/AI-Scripting-and-Mapping.md | 10 +++++++++- docs/Whats-New.md | 1 + src/Ext/Script/Body.cpp | 11 +++++++++++ src/Ext/Script/Body.h | 4 +++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 6dbdbefa02..c3b76fd1ef 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -152,6 +152,7 @@ This page lists all the individual contributions to the project by their author. - Warhead activation target health thresholds enhancements - Event 606: AttachEffect is attaching to a Techno - Linked superweapons + - ScriptType action `Play speech` - **Starkku**: - Misc. minor bugfixes & improvements - AI script actions: diff --git a/docs/AI-Scripting-and-Mapping.md b/docs/AI-Scripting-and-Mapping.md index e7a6f81cc5..8995c296ce 100644 --- a/docs/AI-Scripting-and-Mapping.md +++ b/docs/AI-Scripting-and-Mapping.md @@ -492,7 +492,15 @@ x=i,n ; where 18048 <= i <= 18071, n is made up of two parts, the lo ### `19000-19999` Miscellanous/Uncategorized -This category is empty for now. +#### `19000` Play speech + +- Given a speech index, the game will play it. Just like action 24 from Tiberian Sun. + +In `aimd.ini`: +```ini +[SOMESCRIPTTYPE] ; ScriptType +x=19000,n +``` ## Trigger Actions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index a50d94ae17..ab50bf04dc 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -451,6 +451,7 @@ New: - Allow the aircraft to enter area guard mission and not crash immediately without any airport (by CrimRecya) - [Unlimbo Detonate warhead](New-or-Enhanced-Logics.md#unlimbo-detonate-warhead) (by FlyStar) - Attack and damage technos underground (by TaranDahl) +- ScriptType action `Play speech` (by FS-21) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/Script/Body.cpp b/src/Ext/Script/Body.cpp index 4b16caee8d..9a4db03a0e 100644 --- a/src/Ext/Script/Body.cpp +++ b/src/Ext/Script/Body.cpp @@ -215,6 +215,9 @@ void ScriptExt::ProcessAction(TeamClass* pTeam) // Chronoshift to enemy base, argument is additional distance modifier ScriptExt::ChronoshiftToEnemyBase(pTeam, argument); break; + case PhobosScripts::PlaySpeech: + ScriptExt::PlaySpeech(pTeam); + break; default: // Do nothing because or it is a wrong Action number or it is an Ares/YR action... if (action > 70 && !ScriptExt::IsExtVariableAction(action)) @@ -1247,3 +1250,11 @@ void ScriptExt::Log(const char* pFormat, ...) Debug::LogWithVArgs(pFormat, args); va_end(args); } + +// Works like the old Tiberian Sun ScriptType Action "24" +void ScriptExt::PlaySpeech(TeamClass* pTeam) +{ + int index = pTeam->CurrentScript->Type->ScriptActions[pTeam->CurrentScript->CurrentMission].Argument; + VoxClass::PlayIndex(index); + pTeam->StepCompleted = true; +} diff --git a/src/Ext/Script/Body.h b/src/Ext/Script/Body.h index 49e955c9db..3968f7728d 100644 --- a/src/Ext/Script/Body.h +++ b/src/Ext/Script/Body.h @@ -150,9 +150,10 @@ enum class PhobosScripts : unsigned int GlobalVariableReverseByGlobal = 18068, GlobalVariableXorByGlobal = 18069, GlobalVariableOrByGlobal = 18070, - GlobalVariableAndByGlobal = 18071 + GlobalVariableAndByGlobal = 18071, // Range 19000-19999 are miscellanous/uncategorized actions + PlaySpeech = 19000 }; class ScriptExt @@ -217,6 +218,7 @@ class ScriptExt static void VariableBinaryOperationHandler(TeamClass* pTeam, int nVariable, int nVarToOperate); static bool IsUnitAvailable(TechnoClass* pTechno, bool checkIfInTransportOrAbsorbed); static void Log(const char* pFormat, ...); + static void PlaySpeech(TeamClass* pTeam); // Mission.Attack.cpp static void Mission_Attack(TeamClass* pTeam, int calcThreatMode = 0, bool repeatAction = true, int attackAITargetType = -1, int idxAITargetTypeItem = -1); From abffef420e3402b34062838437a3f5b339410aa7 Mon Sep 17 00:00:00 2001 From: FS-21 Date: Thu, 9 Oct 2025 12:11:57 +0200 Subject: [PATCH 2/3] Updated docs --- docs/AI-Scripting-and-Mapping.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/AI-Scripting-and-Mapping.md b/docs/AI-Scripting-and-Mapping.md index 8995c296ce..9df4574ab2 100644 --- a/docs/AI-Scripting-and-Mapping.md +++ b/docs/AI-Scripting-and-Mapping.md @@ -134,6 +134,19 @@ ShowBriefing=true ; boolean ## Script Actions +### Below `10000` + +#### `24` Play speech + +- Restored functionality. +- Given a speech index, the game will play it. Just like action 24 from Tiberian Sun. + +In `aimd.ini`: +```ini +[SOMESCRIPTTYPE] ; ScriptType +x=24,n +``` + ### `10000-10999` Ingame Actions #### `10000-10049` Attack Actions @@ -492,15 +505,7 @@ x=i,n ; where 18048 <= i <= 18071, n is made up of two parts, the lo ### `19000-19999` Miscellanous/Uncategorized -#### `19000` Play speech - -- Given a speech index, the game will play it. Just like action 24 from Tiberian Sun. - -In `aimd.ini`: -```ini -[SOMESCRIPTTYPE] ; ScriptType -x=19000,n -``` +This category is empty for now. ## Trigger Actions From 23af8b1e1416ffb627dc95153666fda2b0888734 Mon Sep 17 00:00:00 2001 From: FS-21 Date: Thu, 9 Oct 2025 12:18:41 +0200 Subject: [PATCH 3/3] Fixed scripts actions order --- src/Ext/Script/Body.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Ext/Script/Body.h b/src/Ext/Script/Body.h index 0294515852..6f60b51aca 100644 --- a/src/Ext/Script/Body.h +++ b/src/Ext/Script/Body.h @@ -19,6 +19,8 @@ enum class PhobosScripts : unsigned int { + PlaySpeech = 24, + // Range 10000-10999 are team (aka ingame) actions // Sub-range 10000-10049 is for "attack" actions RepeatAttackCloser = 10000, @@ -150,10 +152,9 @@ enum class PhobosScripts : unsigned int GlobalVariableReverseByGlobal = 18068, GlobalVariableXorByGlobal = 18069, GlobalVariableOrByGlobal = 18070, - GlobalVariableAndByGlobal = 18071, + GlobalVariableAndByGlobal = 18071 // Range 19000-19999 are miscellanous/uncategorized actions - PlaySpeech = 24 }; class ScriptExt