From 3d6d440d0cb2b92fa5a667ea9cb7d5e3325a2b98 Mon Sep 17 00:00:00 2001 From: OnlyRealNubs <91900600+OnlyRealNubs@users.noreply.github.com> Date: Wed, 22 Feb 2023 10:00:42 -0500 Subject: [PATCH 1/2] Added effect "Drama Queen" --- ChaosMod/ChaosMod.vcxproj | 1 + ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp | 60 +++++++++++++++++++ ConfigApp/Effects.cs | 1 + 3 files changed, 62 insertions(+) create mode 100644 ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp diff --git a/ChaosMod/ChaosMod.vcxproj b/ChaosMod/ChaosMod.vcxproj index ac362d5b0..55ce9dae6 100644 --- a/ChaosMod/ChaosMod.vcxproj +++ b/ChaosMod/ChaosMod.vcxproj @@ -143,6 +143,7 @@ + diff --git a/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp b/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp new file mode 100644 index 000000000..85953bc06 --- /dev/null +++ b/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp @@ -0,0 +1,60 @@ +#include + +#include "Memory/WeaponPool.h" + +static std::map 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, 1151); + 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" }, + } +); \ No newline at end of file diff --git a/ConfigApp/Effects.cs b/ConfigApp/Effects.cs index 24a16d084..37ccef2f6 100644 --- a/ConfigApp/Effects.cs +++ b/ConfigApp/Effects.cs @@ -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) }, }; } } From f947a6e66640653ada07f33c75b56bce9248e3e6 Mon Sep 17 00:00:00 2001 From: OnlyRealNubs <91900600+OnlyRealNubs@users.noreply.github.com> Date: Sun, 12 Mar 2023 18:55:13 -0400 Subject: [PATCH 2/2] Change ragdoll --- ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp b/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp index 85953bc06..426ea169d 100644 --- a/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp +++ b/ChaosMod/Effects/db/Peds/PedsScreamOnShot.cpp @@ -29,7 +29,7 @@ static void OnTick() 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, 1151); + CREATE_NM_MESSAGE(true, 526); GIVE_PED_NM_MESSAGE(ped); pedPainMap.emplace(ped, GET_GAME_TIMER()); @@ -57,4 +57,4 @@ REGISTER_EFFECT(OnStart, nullptr, OnTick, EffectInfo .IsTimed = true, .IncompatibleWith = { "player_noragdoll", "player_ragdollondmg" }, } -); \ No newline at end of file +);