diff --git a/CREDITS.md b/CREDITS.md index a89619a151..eded9b9352 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..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 diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 104bb1ede6..db4f0ca55a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -452,6 +452,7 @@ New: - [Unlimbo Detonate warhead](New-or-Enhanced-Logics.md#unlimbo-detonate-warhead) (by FlyStar) - Attack and damage technos underground (by TaranDahl) - Fast access structure (by FlyStar) +- 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..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, @@ -217,6 +219,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);