Skip to content

Commit

Permalink
AR/Spas12 Scientist IDLE Anim Fix and more...
Browse files Browse the repository at this point in the history
AR/Spas12 Scientist IDLE Anim Fix.
Remove Death Sound Event in Headcrab Player Models.
Added Death Sound for Headcrabs in Script.
  • Loading branch information
GHmods committed Jul 17, 2023
1 parent 833d515 commit 2e4d99c
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 31 deletions.
Binary file modified models/hlze/scientist_m16.mdl
Binary file not shown.
Binary file modified models/hlze/scientist_shotgun.mdl
Binary file not shown.
Binary file modified models/player/hlze_crasher_crab/hlze_crasher_crab.mdl
Binary file not shown.
Binary file modified models/player/hlze_headcrab/hlze_headcrab.mdl
Binary file not shown.
Binary file modified models/player/hlze_rushcrab/hlze_rushcrab.mdl
Binary file not shown.
3 changes: 3 additions & 0 deletions scripts/maps/hlze/events.as
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void Events_MapInit()
g_Hooks.RegisterHook(Hooks::Player::PlayerPreThink, ZClass_Think);
g_Hooks.RegisterHook(Hooks::Player::PlayerTakeDamage, ZC_TakeDamage);

//Death Think
g_Hooks.RegisterHook(Hooks::Player::PlayerPreThink, SaveLoad::Death_Think);

//Gene Points
Gene_Points::Precache();
g_Hooks.RegisterHook(Hooks::Player::ClientPutInServer, Gene_Points::PlayerJoin);
Expand Down
74 changes: 44 additions & 30 deletions scripts/maps/hlze/monsters/npcs/monster_hlze_scientist.as
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity
if(weapon == SCIENTIST_WEAPON_SPAS12) self.m_flAutomaticAttackTime = g_Engine.time + 1.0;
else self.m_flAutomaticAttackTime = g_Engine.time + Math.RandomFloat(0.2, 0.5);
}
--self.m_cAmmoLoaded;// take away a bullet!
--self.m_cAmmoLoaded;// take away a bullet/shell!
}

void CheckAmmo()
Expand Down Expand Up @@ -284,20 +284,20 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity

g_EntityFuncs.SetSize(self.pev,VEC_HUMAN_HULL_MIN,VEC_HUMAN_HULL_MAX);

pev.solid = SOLID_SLIDEBOX;
pev.solid = SOLID_SLIDEBOX;
pev.movetype = MOVETYPE_STEP;
self.m_bloodColor = BLOOD_COLOR_RED;
if( self.pev.health == 0.0f )
self.pev.health = 100.0f;
self.pev.view_ofs = Vector( 0, 0, 60 );// position of the eyes relative to monster's origin.
self.pev.view_ofs = Vector(0,0,50);// position of the eyes relative to monster's origin.
self.m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
self.m_MonsterState = MONSTERSTATE_IDLE;
self.m_MonsterState = MONSTERSTATE_NONE;
//self.pev.body = 0; // gun in holster
m_fGunDrawn = true;
self.m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP | bits_CAP_USE_TANK;
self.m_fCanFearCreatures = true; // Can attempt to run away from things like zombies
self.m_fCanFearCreatures = true; // Can attempt to run away from things like zombies
m_flNextFearScream = g_Engine.time;
//self.m_afMoveShootCap() = bits_MOVESHOOT_RANGE_ATTACK1;
//self.m_afMoveShootCap() = bits_MOVESHOOT_RANGE_ATTACK1;

if( string( self.m_FormattedName ).IsEmpty() )
{
Expand Down Expand Up @@ -441,9 +441,9 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity
{
switch (Math.RandomLong(0,2))
{
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream06.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream02.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream05.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream06.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream02.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream05.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
}

m_flNextFearScream = g_Engine.time + Math.RandomLong(2,5);
Expand All @@ -458,27 +458,27 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity
m_painTime = g_Engine.time + Math.RandomFloat(0.5, 0.75);
switch (Math.RandomLong(0,9))
{
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 4: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 5: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain6.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 6: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain7.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 7: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain8.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 8: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain9.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 9: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain10.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 4: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 5: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain6.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 6: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain7.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 7: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain8.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 8: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain9.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 9: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_pain10.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
}
}

void DeathSound()
{
switch (Math.RandomLong(0,3))
{
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die1.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die2.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die3.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die4.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die1.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die2.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die3.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/sci_die4.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
}
}

Expand Down Expand Up @@ -576,11 +576,11 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity
if( self.HasConditions( bits_COND_ENEMY_DEAD ) ) {
switch (Math.RandomLong(0,4))
{
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/dontwantdie.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/ipredictedthis.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/getoutalive.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream17.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 4: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/nooo.wav", 1, ATTN_NORM, 0, PITCH_NORM); break;
case 0: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/dontwantdie.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 1: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/ipredictedthis.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 2: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/getoutalive.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 3: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/scream17.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
case 4: g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_VOICE, "scientist/nooo.wav", 1, ATTN_NORM, 0, VoicePitch()); break;
}
}

Expand Down Expand Up @@ -662,12 +662,26 @@ class CHLZE_Scientist : ScriptBaseMonsterEntity

if( pTarget is pActivator )
{
g_SoundSystem.PlaySentenceGroup( self.edict(), "SC_OK", 1.0, ATTN_NORM, 0, PITCH_NORM );
g_SoundSystem.PlaySentenceGroup(self.edict(), "SC_OK", 1.0, ATTN_NORM, 0, VoicePitch());
}
else {
g_SoundSystem.PlaySentenceGroup( self.edict(), "SC_WAIT", 1.0, ATTN_NORM, 0, PITCH_NORM );
g_SoundSystem.PlaySentenceGroup(self.edict(), "SC_WAIT", 1.0, ATTN_NORM, 0, VoicePitch());
}
}

//Voice Pith based on Head ID
int VoicePitch() {
// get voice for head
int m_voicePitch = 100;
switch (self.GetBodygroup(1))
{
case 0: m_voicePitch = 105; break; //glasses
case 1: m_voicePitch = 100; break; //einstein
case 2: m_voicePitch = 95; break; //luther
case 3: m_voicePitch = 100; break; //slick
}
return m_voicePitch;
}
}

array<ScriptSchedule@>@ monster_scientist_schedules;
Expand Down
55 changes: 54 additions & 1 deletion scripts/maps/hlze/save-load/base.as
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace SaveLoad {

//Data
array<bool>isSpawned(33,false);
array<int>lastDeadflag(33,0);

bool EverythingIsReady() {
return (
Expand Down Expand Up @@ -87,7 +88,7 @@ namespace SaveLoad {
//Load KeyValues?
if(cvar_load_keyvalues==1) SaveLoad_KeyValues::LoadData(index);
else SaveLoad_KeyValues::loaddata[index]=true;

return HOOK_CONTINUE;
}

Expand All @@ -96,6 +97,7 @@ namespace SaveLoad {
int index = pPlayer.entindex();

isSpawned[index]=false;
lastDeadflag[index]=0;

SaveLoad_GenePoints::LoadEmpty(index);
SaveLoad_ZClasses::LoadEmpty(index);
Expand Down Expand Up @@ -234,6 +236,57 @@ namespace SaveLoad {
}
}

//Death
HookReturnCode Death_Think(CBasePlayer@ pPlayer, uint& out dummy )
{
int index = pPlayer.entindex();
int deadflag = pPlayer.pev.deadflag;

CustomKeyvalues@ KeyValues = pPlayer.GetCustomKeyvalues();
int isZombie = atoui(KeyValues.GetKeyvalue("$i_isZombie").GetString());
int isHeadcrab = atoui(KeyValues.GetKeyvalue("$i_isHeadcrab").GetString());

//Get Zombie/Headcrab Claws
CBasePlayerWeapon@ pWpn1 = Get_Weapon_FromPlayer(pPlayer,"weapon_hclaws");
weapon_hclaws@ hclaws = cast<weapon_hclaws@>(CastToScriptClass(pWpn1));
CBasePlayerWeapon@ pWpn2 = Get_Weapon_FromPlayer(pPlayer,"weapon_zclaws");
weapon_zclaws@ zclaws = cast<weapon_zclaws@>(CastToScriptClass(pWpn2));
//Get Zombie/Headcrab Classes
Headcrab_Class@ HClass;
Zombie_Class@ ZClass;
if(hclaws !is null) @HClass = hclaws.HClass;
if(zclaws !is null) @ZClass = zclaws.ZClass;

//if(deadflag == 1 && lastDeadflag[index] < 1 && (isZombie == 1 || isHeadcrab == 1))
if(deadflag == 1 && lastDeadflag[index] < 1)
{
//g_PlayerFuncs.ClientPrint(pPlayer,HUD_PRINTTALK,"Death!\n");
//Zombie Death
if(zclaws !is null && hclaws is null) {
if(ZClass is null)
return HOOK_CONTINUE;

switch(Math.RandomLong(0,2)) {
case 0: g_SoundSystem.EmitSoundDyn(pPlayer.edict(),CHAN_VOICE,"zombie/zombie_voice_idle13.wav",1,ATTN_NORM,0,ZClass.VoicePitch);break;
case 1: g_SoundSystem.EmitSoundDyn(pPlayer.edict(),CHAN_VOICE,"zombie/zombie_voice_idle12.wav",1,ATTN_NORM,0,ZClass.VoicePitch);break;
case 2: g_SoundSystem.EmitSoundDyn(pPlayer.edict(),CHAN_VOICE,"zombie/zombie_voice_idle10.wav",1,ATTN_NORM,0,ZClass.VoicePitch);break;
}
} else if(zclaws is null && hclaws !is null) { //Headcrab Death
if(HClass is null)
return HOOK_CONTINUE;

switch(Math.RandomLong(0,1)) {
case 0: g_SoundSystem.EmitSoundDyn(pPlayer.edict(),CHAN_VOICE,"headcrab/hc_die2.wav",1,ATTN_NORM,0,HClass.VoicePitch);break;
case 1: g_SoundSystem.EmitSoundDyn(pPlayer.edict(),CHAN_VOICE,"headcrab/hc_die1.wav",1,ATTN_NORM,0,HClass.VoicePitch);break;
}
}
}

lastDeadflag[index] = deadflag;

return HOOK_CONTINUE;
}

void Initialize_Plugin() {
SYSTEM_PATH = "scripts/plugins/store/hlze/";
SaveLoad_Cfg::CONFIG_PATH = "scripts/plugins/";
Expand Down

0 comments on commit 2e4d99c

Please sign in to comment.