--[[ | This file was obtained through the combined efforts | of Madbluntz & Plymouth Antiquarian Society. | | Credits: lifestorm, Gregory Wayne Rossel JR., | Maloy, DrPepper10 @ RIP, Atle! | | Visit for more: https://plymouth.thetwilightzone.ru/ --]] AddCSLuaFile("shared.lua") include('shared.lua') /*----------------------------------------------- *** Copyright (c) 2012-2023 by DrVrej, All rights reserved. *** No parts of this code or any of its contents may be reproduced, copied, modified or adapted, without the prior written consent of the author, unless otherwise indicated for stand-alone materials. -----------------------------------------------*/ ENT.Model = {"models/vj_hlr/opfor/voltigore.mdl"} -- The game will pick a random model from the table when the SNPC is spawned | Add as many as you want ENT.StartHealth = 320 ENT.HullType = HULL_LARGE ENT.VJC_Data = { ThirdP_Offset = Vector(0, 0, -15), -- The offset for the controller when the camera is in third person FirstP_Bone = "Bone41", -- If left empty, the base will attempt to calculate a position for first person FirstP_Offset = Vector(10, 0, 0), -- The offset for the controller when the camera is in first person FirstP_ShrinkBone = false, -- Should the bone shrink? Useful if the bone is obscuring the player's view } --------------------------------------------------------------------------------------------------------------------------------------------- ENT.VJ_NPC_Class = {"CLASS_RACE_X"} -- NPCs with the same class with be allied to each other ENT.BloodColor = "Yellow" -- The blood type, this will determine what it should use (decal, particle, etc.) ENT.CustomBlood_Particle = {"vj_hlr_blood_yellow_large"} ENT.CustomBlood_Decal = {"VJ_HLR_Blood_Yellow"} -- Decals to spawn when it's damaged ENT.HasBloodPool = false -- Does it have a blood pool? ENT.MeleeAttackDamage = 30 ENT.AnimTbl_MeleeAttack = {"vjseq_mattack2","vjseq_mattack3"} -- Melee Attack Animations ENT.TimeUntilMeleeAttackDamage = false -- This counted in seconds | This calculates the time until it hits something ENT.MeleeAttackDistance = 35 -- How close does it have to be until it attacks? ENT.MeleeAttackDamageDistance = 125 -- How far does the damage go? ENT.HasRangeAttack = true -- Should the SNPC have a range attack? ENT.RangeAttackEntityToSpawn = "obj_vj_hlrof_voltigore_energy" -- The entity that is spawned when range attacking ENT.AnimTbl_RangeAttack = {ACT_RANGE_ATTACK1} -- Range Attack Animations ENT.RangeDistance = 2000 -- This is how far away it can shoot ENT.RangeToMeleeDistance = 100 -- How close does it have to be until it uses melee? ENT.TimeUntilRangeAttackProjectileRelease = false -- How much time until the projectile code is ran? ENT.NextRangeAttackTime = 3 -- How much time until it can use a range attack? ENT.NextRangeAttackTime_DoRand = 4 -- False = Don't use random time | Number = Picks a random number between the regular timer and this timer ENT.RangeUseAttachmentForPos = true -- Should the projectile spawn on a attachment? ENT.RangeUseAttachmentForPosID = "3" -- The attachment used on the range attack if RangeUseAttachmentForPos is set to true //ENT.DisableDefaultRangeAttackCode = true -- When true, it won't spawn the range attack entity, allowing you to make your own ENT.HasDeathAnimation = true -- Does it play an animation when it dies? ENT.AnimTbl_Death = {ACT_DIEBACKWARD,ACT_DIEFORWARD,ACT_DIESIMPLE} -- Death Animations ENT.DeathAnimationTime = false -- Time until the SNPC spawns its corpse and gets removed ENT.DisableFootStepSoundTimer = true -- If set to true, it will disable the time system for the footstep sound code, allowing you to use other ways like model events ENT.HasWorldShakeOnMove = true -- Should the world shake when it's moving? ENT.WorldShakeOnMoveRadius = 300 -- How far the screen shake goes, in world units ENT.HasExtraMeleeAttackSounds = true -- Set to true to use the extra melee attack sounds -- ====== Sound File Paths ====== -- -- Leave blank if you don't want any sounds to play ENT.SoundTbl_FootStep = {"vj_hlr/hl1_npc/voltigore/voltigore_footstep1.wav","vj_hlr/hl1_npc/voltigore/voltigore_footstep2.wav","vj_hlr/hl1_npc/voltigore/voltigore_footstep3.wav"} ENT.SoundTbl_Idle = {"vj_hlr/hl1_npc/voltigore/voltigore_idle1.wav","vj_hlr/hl1_npc/voltigore/voltigore_idle2.wav","vj_hlr/hl1_npc/voltigore/voltigore_idle3.wav"} ENT.SoundTbl_IdleDialogue = {"vj_hlr/hl1_npc/voltigore/voltigore_communicate1.wav","vj_hlr/hl1_npc/voltigore/voltigore_communicate2.wav","vj_hlr/hl1_npc/voltigore/voltigore_communicate3.wav"} ENT.SoundTbl_IdleDialogueAnswer = {"vj_hlr/hl1_npc/voltigore/voltigore_communicate1.wav","vj_hlr/hl1_npc/voltigore/voltigore_communicate2.wav","vj_hlr/hl1_npc/voltigore/voltigore_communicate3.wav"} ENT.SoundTbl_Alert = {"vj_hlr/hl1_npc/voltigore/voltigore_alert1.wav","vj_hlr/hl1_npc/voltigore/voltigore_alert2.wav","vj_hlr/hl1_npc/voltigore/voltigore_alert3.wav"} ENT.SoundTbl_BeforeMeleeAttack = {"vj_hlr/hl1_npc/voltigore/voltigore_attack_melee1.wav","vj_hlr/hl1_npc/voltigore/voltigore_attack_melee2.wav"} ENT.SoundTbl_MeleeAttackExtra = {"vj_hlr/hl1_npc/zombie/claw_strike1.wav","vj_hlr/hl1_npc/zombie/claw_strike2.wav","vj_hlr/hl1_npc/zombie/claw_strike3.wav"} ENT.SoundTbl_MeleeAttackMiss = {"vj_hlr/hl1_npc/zombie/claw_miss1.wav","vj_hlr/hl1_npc/zombie/claw_miss2.wav"} ENT.SoundTbl_BeforeRangeAttack = {"vj_hlr/hl1_npc/voltigore/voltigore_attack_shock.wav"} ENT.SoundTbl_Pain = {"vj_hlr/hl1_npc/voltigore/voltigore_pain1.wav","vj_hlr/hl1_npc/voltigore/voltigore_pain2.wav","vj_hlr/hl1_npc/voltigore/voltigore_pain3.wav","vj_hlr/hl1_npc/voltigore/voltigore_pain4.wav"} ENT.SoundTbl_Death = {"vj_hlr/hl1_npc/voltigore/voltigore_die1.wav","vj_hlr/hl1_npc/voltigore/voltigore_die2.wav","vj_hlr/hl1_npc/voltigore/voltigore_die3.wav"} local extraMoveSd = {"vj_hlr/hl1_npc/voltigore/voltigore_run_grunt1.wav","vj_hlr/hl1_npc/voltigore/voltigore_run_grunt2.wav"} --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnInitialize() self:SetCollisionBounds(Vector(60, 60, 95), Vector(-60, -60, 0)) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnAcceptInput(key, activator, caller, data) //print(key) if key == "step" then self:FootStepSoundCode() end if key == "grunting_sounds" then self:FootStepSoundCode(extraMoveSd) end if key == "single" or key == "both" then self:MeleeAttackCode() end if key == "purple_energy_ball" then self:RangeAttackCode() end end --------------------------------------------------------------------------------------------------------------------------------------------- local elecTime = 0.989990234375 -- function ENT:CustomOnRangeAttack_AfterStartTimer() local endPos = self:GetAttachment(self:LookupAttachment("3")).Pos for att = 1, 3 do local tr = util.TraceLine({ start = self:GetAttachment(att).Pos, endpos = endPos, filter = self }) local elec = EffectData() elec:SetStart(tr.StartPos) elec:SetOrigin(tr.HitPos) elec:SetEntity(self) elec:SetAttachment(att) elec:SetScale(elecTime) util.Effect("VJ_HLR_Electric_Charge_Purple", elec) end local spr = ents.Create("env_sprite") spr:SetKeyValue("model","vj_hl/sprites/flare3.vmt") spr:SetKeyValue("GlowProxySize","2.0") -- Size of the glow to be rendered for visibility testing. spr:SetKeyValue("renderfx","14") spr:SetKeyValue("rendermode","3") -- Set the render mode to "3" (Glow) spr:SetKeyValue("renderamt","255") -- Transparency spr:SetKeyValue("disablereceiveshadows","0") -- Disable receiving shadows spr:SetKeyValue("framerate","10.0") -- Rate at which the sprite should animate, if at all. spr:SetKeyValue("spawnflags","0") spr:SetParent(self) spr:Fire("SetParentAttachment","3") spr:Spawn() spr:Activate() self:DeleteOnRemove(spr) timer.Simple(elecTime, function() if IsValid(self) && IsValid(spr) then spr:Remove() end end) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:RangeAttackCode_GetShootPos(projectile) local ene = self:GetEnemy() return self:CalculateProjectile("Line", projectile:GetPos(), ene:GetPos() + ene:OBBCenter(), 1500) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnInitialKilled(dmginfo, hitgroup) if self.AttackType == VJ_ATTACK_RANGE then self.GibOnDeathDamagesTable = {"All"} end end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:SetUpGibesOnDeath(dmginfo, hitgroup) self.HasDeathSounds = false if self.HasGibDeathParticles == true then local effectBlood = EffectData() effectBlood:SetOrigin(self:GetPos() + self:OBBCenter()) effectBlood:SetColor(VJ_Color2Byte(Color(255,221,35))) effectBlood:SetScale(120) util.Effect("VJ_Blood1",effectBlood) local bloodspray = EffectData() bloodspray:SetOrigin(self:GetPos() + self:OBBCenter()) bloodspray:SetScale(8) bloodspray:SetFlags(3) bloodspray:SetColor(1) util.Effect("bloodspray",bloodspray) util.Effect("bloodspray",bloodspray) local effectdata = EffectData() effectdata:SetOrigin(self:GetPos() + self:OBBCenter()) effectdata:SetScale(1) util.Effect("StriderBlood",effectdata) util.Effect("StriderBlood",effectdata) end util.VJ_SphereDamage(self, self, self:GetPos(), 120, 50, DMG_SONIC, false, true) util.ScreenShake(self:GetPos(), 5, 5, 1, 1000) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib1.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib2.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib3.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib4.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib5.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib6.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib7.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib8.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,20))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/voltigore_gib9.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,20))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib1.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib2.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,20))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib3.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib4.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,35))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib5.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib6.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib7.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib8.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,30))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib9.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,25))}) self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib10.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,15))}) return true -- Return to true if it gibbed! end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomGibOnDeathSounds(dmginfo, hitgroup) VJ_EmitSound(self, "vj_gib/default_gib_splat.wav", 90, 100) VJ_EmitSound(self, "vj_hlr/hl1_weapon/explosion/debris"..math.random(1,3)..".wav", 90, 100) -- No far away sound for this! return false end --------------------------------------------------------------------------------------------------------------------------------------------- local gibs = {"models/vj_hlr/gibs/voltigore_gib1.mdl", "models/vj_hlr/gibs/voltigore_gib2.mdl", "models/vj_hlr/gibs/voltigore_gib3.mdl", "models/vj_hlr/gibs/voltigore_gib4.mdl", "models/vj_hlr/gibs/voltigore_gib5.mdl", "models/vj_hlr/gibs/voltigore_gib6.mdl", "models/vj_hlr/gibs/voltigore_gib7.mdl", "models/vj_hlr/gibs/voltigore_gib8.mdl", "models/vj_hlr/gibs/voltigore_gib9.mdl", "models/vj_hlr/gibs/agib1.mdl", "models/vj_hlr/gibs/agib2.mdl", "models/vj_hlr/gibs/agib3.mdl", "models/vj_hlr/gibs/agib4.mdl", "models/vj_hlr/gibs/agib5.mdl", "models/vj_hlr/gibs/agib6.mdl", "models/vj_hlr/gibs/agib7.mdl", "models/vj_hlr/gibs/agib8.mdl", "models/vj_hlr/gibs/agib9.mdl", "models/vj_hlr/gibs/agib10.mdl"} -- function ENT:CustomOnDeath_AfterCorpseSpawned(dmginfo, hitgroup, corpseEnt) VJ_HLR_ApplyCorpseEffects(self, corpseEnt, nil, {ExtraGibs = gibs}) end