Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added effect "Drama Queen" #3373

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 ChaosMod/ChaosMod.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<ClCompile Include="Effects\db\Peds\PedsNailguns.cpp" />
<ClCompile Include="Effects\db\Peds\PedsPropHunt.cpp" />
<ClCompile Include="Effects\db\Peds\PedsQuarrelingCouple.cpp" />
<ClCompile Include="Effects\db\Peds\PedsScreamOnShot.cpp" />
<ClCompile Include="Effects\db\Peds\PedsSmokeTrails.cpp" />
<ClCompile Include="Effects\db\Peds\PedsSpawnAngryChimp.cpp" />
<ClCompile Include="Effects\db\Peds\PedsSpawnBallaSquad.cpp" />
Expand Down
60 changes: 60 additions & 0 deletions ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include <stdafx.h>

#include "Memory/WeaponPool.h"

static std::map<Ped, DWORD64> pedPainMap;

static void OnStart()
{
for (Ped ped : GetAllPeds())
{
CLEAR_ENTITY_LAST_DAMAGE_ENTITY(ped);
}
pedPainMap.clear();
}

static void OnTick()
{
Ped playerPed = PLAYER_PED_ID();

for (Ped ped : GetAllPeds())
{
if (ped == playerPed) continue;

SET_RAGDOLL_BLOCKING_FLAGS(ped, 1);
_SET_PED_SCREAM(ped); // Gives the ped a voice. Some peds don't have this for some reason.

if (HAS_ENTITY_BEEN_DAMAGED_BY_ANY_PED(ped) && !pedPainMap.contains(ped) && !IS_PED_DEAD_OR_DYING(ped, true))
{
SET_PED_TO_RAGDOLL(ped, 4000, 5000, 1, 1, 1, 0);
CREATE_NM_MESSAGE(true, 0);
GIVE_PED_NM_MESSAGE(ped);
CREATE_NM_MESSAGE(true, 526);
GIVE_PED_NM_MESSAGE(ped);

pedPainMap.emplace(ped, GET_GAME_TIMER());
CLEAR_ENTITY_LAST_DAMAGE_ENTITY(ped);
}
}
for (auto it = pedPainMap.cbegin(); it != pedPainMap.cend();)
{
if ((!DOES_ENTITY_EXIST(it->first) || IS_ENTITY_DEAD(it->first, false))
|| GET_GAME_TIMER() - it->second >= 3800)
{
it = pedPainMap.erase(it);
continue;
}
PLAY_PAIN(it->first, 8, 0, 0);
it++;
}
}

// clang-format off
REGISTER_EFFECT(OnStart, nullptr, OnTick, EffectInfo
{
.Name = "Drama Queen",
.Id = "peds_screamonshot",
.IsTimed = true,
.IncompatibleWith = { "player_noragdoll", "player_ragdollondmg" },
}
);
1 change: 1 addition & 0 deletions ConfigApp/Effects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ public enum EffectTimedType
{ "peds_not_menendez", new EffectInfo("Not Menendez!", EffectCategory.Peds, true) },
{ "misc_go_to_jail", new EffectInfo("Bad Boys", EffectCategory.Misc) },
{ "misc_muffled_audio", new EffectInfo("Muffled Audio", EffectCategory.Misc, true) },
{ "peds_screamonshot", new EffectInfo("Drama Queen", EffectCategory.Peds, true) },
};
}
}