Skip to content

Commit 4c83221

Browse files
fix: enemies not targeting party members
1 parent 061dae1 commit 4c83221

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Code/client/Games/Skyrim/Actor.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,18 @@ void Actor::SetFactions(const Factions& acFactions) noexcept
410410
SetFactionRank(pFaction, entry.Rank);
411411
}
412412
}
413+
414+
if (GetExtension()->IsPlayer())
415+
{
416+
auto pPotentialFollower = Cast<TESFaction>(TESForm::GetById(0x5C84D));
417+
SetFactionRank(pPotentialFollower, 1);
418+
419+
auto pCurrentFollower = Cast<TESFaction>(TESForm::GetById(0x5C84E));
420+
SetFactionRank(pCurrentFollower, 1);
421+
422+
auto pPlayerFaction = Cast<TESFaction>(TESForm::GetById(0xDB1));
423+
SetFactionRank(pPlayerFaction, 1);
424+
}
413425
}
414426

415427
void Actor::SetFactionRank(const TESFaction* apFaction, int8_t aRank) noexcept
@@ -433,6 +445,14 @@ void Actor::SetPlayerRespawnMode() noexcept
433445
SetEssentialEx(true);
434446
// Makes the player go in an unrecoverable bleedout state
435447
SetNoBleedoutRecovery(true);
448+
SetPlayerTeammate(true);
449+
}
450+
451+
void Actor::SetPlayerTeammate(bool aSet) noexcept
452+
{
453+
TP_THIS_FUNCTION(TSetPlayerTeammate, void, Actor, bool aSet, bool abCanDoFavor);
454+
POINTER_SKYRIMSE(TSetPlayerTeammate, setPlayerTeammate, 37717);
455+
return ThisCall(setPlayerTeammate, this, aSet, true);
436456
}
437457

438458
void Actor::UnEquipAll() noexcept

Code/client/Games/Skyrim/Actor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ struct Actor : TESObjectREFR
215215
void SetEssentialEx(bool aSet) noexcept;
216216
void SetNoBleedoutRecovery(bool aSet) noexcept;
217217
void SetPlayerRespawnMode() noexcept;
218+
void SetPlayerTeammate(bool aSet) noexcept;
218219

219220
// Actions
220221
void UnEquipAll() noexcept;

0 commit comments

Comments
 (0)