Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ This page lists all the individual contributions to the project by their author.
- Event 606: AttachEffect is attaching to a Techno
- Linked superweapons
- Unit & infantry auto-conversion on ammo change
- ScriptType action `Play speech`
- **Starkku**:
- Misc. minor bugfixes & improvements
- AI script actions:
Expand Down
13 changes: 13 additions & 0 deletions docs/AI-Scripting-and-Mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,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
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ HideShakeEffects=false ; boolean
- [Automatic conversion based on health](New-or-Enhanced-Logics.md#automatic-conversion-based-on-health) (by obsidianus)
- Add `ammo`, `health`, `mission`, `landtype` and `sequence` conditions to `DiscardOn` (by Noble_Fish)
- [Berzerk / `Psychedelic` duration stacking customization](Fixed-or-Improved-Logics.md#berzerk-psychedelic-duration-stacking-customization) (by Starkku)
- 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)
Expand Down
10 changes: 10 additions & 0 deletions src/Ext/Script/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void ScriptExt::ProcessAction(TeamClass* pTeam)

switch (static_cast<PhobosScripts>(action))
{
case PhobosScripts::PlaySpeech:
ScriptExt::PlaySpeech(pTeam);
break;
case PhobosScripts::TimedAreaGuard:
ScriptExt::ExecuteTimedAreaGuardAction(pTeam);
break;
Expand Down Expand Up @@ -1252,6 +1255,13 @@ bool ScriptExt::IsUnitAvailable(TechnoClass* pTechno, bool checkIfInTransportOrA
return isAvailable;
}

void ScriptExt::PlaySpeech(TeamClass* pTeam)
{
const int index = pTeam->CurrentScript->Type->ScriptActions[pTeam->CurrentScript->CurrentMission].Argument;
VoxClass::PlayIndex(index);
pTeam->StepCompleted = true;
}

void ScriptExt::Log(const char* pFormat, ...)
{
va_list args;
Expand Down
3 changes: 3 additions & 0 deletions src/Ext/Script/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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,
Expand Down Expand Up @@ -228,6 +230,7 @@ class ScriptExt final : public AbstractExt
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);
Expand Down