[DiscordArchive] Anyone knows a way to call all players who attacked the creature in cpp ?
[DiscordArchive] Anyone knows a way to call all players who attacked the creature in cpp ?
Archived author: VaZ3D • Posted: 2024-01-31T07:39:50.357000+00:00
Original source
Anyone knows a way to call all players who attacked the creature in cpp ?
Archived author: robinsch • Posted: 2024-01-31T07:42:20.011000+00:00
Original source
iterate threat list
Archived author: VaZ3D • Posted: 2024-01-31T07:43:14.518000+00:00
Original source
```int32 creatureEntry = creature->GetEntry(); // Obtain the creature entry
ThreatContainer::StorageType threatList = creature->GetThreatMgr().GetThreatList(); // Obtain the threat list
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)```
like this ?
Archived author: robinsch • Posted: 2024-01-31T07:43:40.428000+00:00
Original source
Don't know, you should find a ton of examples that do this.
Archived author: VaZ3D • Posted: 2024-01-31T07:44:28.098000+00:00
Original source
already tried everything with threatlist.
if it comes to this part
```for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)```
i only get a empty threatlists
Archived author: robinsch • Posted: 2024-01-31T07:44:30.893000+00:00
Original source
There have been a ton of rewrites for threat management the past 15 years so I have no clue what the current TC syntax is.
Archived author: robinsch • Posted: 2024-01-31T07:46:08.064000+00:00
Original source
`.debug threat` should give you some info.
Archived author: robinsch • Posted: 2024-01-31T07:47:37.163000+00:00
Original source
I think this is the correct way in current TC to loop it:
```cpp
for (ThreatReference const* ref : create->GetThreatManager().GetUnsortedThreatList())
```
```
Unit* unit = ref->GetVictim()
```