--[[ | 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/hl1/archer.mdl"} -- The game will pick a random model from the table when the SNPC is spawned | Add as many as you want ENT.StartHealth = 50 ENT.HullType = HULL_TINY ENT.TurningUseAllAxis = true -- If set to true, angles will not be restricted to y-axis, it will change all axes (plural axis) ENT.MovementType = VJ_MOVETYPE_AQUATIC -- How does the SNPC move? ENT.Aquatic_SwimmingSpeed_Calm = 80 -- The speed it should swim with, when it's wandering, moving slowly, etc. | Basically walking compared to ground SNPCs ENT.Aquatic_SwimmingSpeed_Alerted = 350 -- The speed it should swim with, when it's chasing an enemy, moving away quickly, etc. | Basically running compared to ground SNPCs ENT.Aquatic_AnimTbl_Calm = {ACT_WALK} -- Animations it plays when it's wandering around while idle ENT.Aquatic_AnimTbl_Alerted = {ACT_RUN} -- Animations it plays when it's moving while alerted ENT.VJC_Data = { FirstP_Bone = "bip01 neck", -- If left empty, the base will attempt to calculate a position for first person FirstP_Offset = Vector(1, 0, 9), -- 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_XEN"} -- 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"} ENT.CustomBlood_Decal = {"VJ_HLR_Blood_Yellow"} -- Decals to spawn when it's damaged ENT.HasBloodPool = false -- Does it have a blood pool? ENT.HasMeleeAttack = true -- Should the SNPC have a melee attack? ENT.MeleeAttackDamage = 15 ENT.AnimTbl_MeleeAttack = {ACT_MELEE_ATTACK1} -- Melee Attack Animations ENT.TimeUntilMeleeAttackDamage = false -- This counted in seconds | This calculates the time until it hits something ENT.MeleeAttackDistance = 40 -- How close does it have to be until it attacks? ENT.MeleeAttackDamageDistance = 50 -- How far does the damage go? ENT.HasRangeAttack = true -- Should the SNPC have a range attack? ENT.RangeAttackEntityToSpawn = "obj_vj_hlr1_archerspit" -- The entity that is spawned when range attacking ENT.RangeDistance = 1500 -- 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 = 2.5 -- How much time until it can use a range attack? ENT.NextRangeAttackTime_DoRand = 3 -- False = Don't use random time | Number = Picks a random number between the regular timer and this timer ENT.NoChaseAfterCertainRange = true -- Should the SNPC not be able to chase when it's between number x and y? ENT.NoChaseAfterCertainRange_FarDistance = "UseRangeDistance" -- How far until it can chase again? | "UseRangeDistance" = Use the number provided by the range attack instead ENT.NoChaseAfterCertainRange_CloseDistance = "UseRangeDistance" -- How near until it can chase again? | "UseRangeDistance" = Use the number provided by the range attack instead ENT.NoChaseAfterCertainRange_Type = "OnlyRange" -- "Regular" = Default behavior | "OnlyRange" = Only does it if it's able to range attack ENT.ConstantlyFaceEnemy = true -- Should it face the enemy constantly? ENT.ConstantlyFaceEnemyDistance = 1500 -- How close does it have to be until it starts to face the enemy? ENT.HasDeathAnimation = true -- Does it play an animation when it dies? ENT.AnimTbl_Death = {ACT_DIESIMPLE} -- Death Animations -- ====== Flinching Code ====== -- ENT.CanFlinch = 1 -- 0 = Don't flinch | 1 = Flinch at any damage | 2 = Flinch only from certain damages ENT.AnimTbl_Flinch = {ACT_SMALL_FLINCH} -- If it uses normal based animation, use this -- ====== Sound File Paths ====== -- -- Leave blank if you don't want any sounds to play ENT.SoundTbl_Idle = {"vj_hlr/hl1_npc/archer/arch_idle1.wav","vj_hlr/hl1_npc/archer/arch_idle2.wav","vj_hlr/hl1_npc/archer/arch_idle3.wav"} ENT.SoundTbl_Alert = {"vj_hlr/hl1_npc/archer/arch_alert1.wav","vj_hlr/hl1_npc/archer/arch_alert2.wav"} ENT.SoundTbl_BeforeMeleeAttack = {"vj_hlr/hl1_npc/archer/arch_attack1.wav","vj_hlr/hl1_npc/archer/arch_attack2.wav"} ENT.SoundTbl_MeleeAttack = {"vj_hlr/hl1_npc/archer/arch_bite1.wav","vj_hlr/hl1_npc/archer/arch_bite2.wav"} ENT.SoundTbl_BeforeRangeAttack = {"vj_hlr/hl1_npc/archer/arch_attack1.wav","vj_hlr/hl1_npc/archer/arch_attack2.wav"} ENT.SoundTbl_Pain = {"vj_hlr/hl1_npc/archer/arch_pain1.wav","vj_hlr/hl1_npc/archer/arch_pain2.wav","vj_hlr/hl1_npc/archer/arch_pain3.wav","vj_hlr/hl1_npc/archer/arch_pain4.wav"} ENT.SoundTbl_Death = {"vj_hlr/hl1_npc/archer/arch_die1.wav","vj_hlr/hl1_npc/archer/arch_die2.wav","vj_hlr/hl1_npc/archer/arch_die3.wav"} -- Custom ENT.Archer_BlinkingT = 0 --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnInitialize() self:SetCollisionBounds(Vector(20, 20, 20), Vector(-20, -20, 0)) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnAcceptInput(key, activator, caller, data) //print(key) if key == "bite" then self:MeleeAttackCode() end if key == "shoot" then self:RangeAttackCode() end end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnThink() if !self.Dead && CurTime() > self.Archer_BlinkingT then timer.Simple(0.2, function() if IsValid(self) then self:SetSkin(1) end end) timer.Simple(0.3, function() if IsValid(self) then self:SetSkin(2) end end) timer.Simple(0.4, function() if IsValid(self) then self:SetSkin(1) end end) timer.Simple(0.5, function() if IsValid(self) then self:SetSkin(0) end end) self.Archer_BlinkingT = CurTime() + math.Rand(3, 4.5) end end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:RangeAttackCode_GetShootPos(projectile) return self:CalculateProjectile("Line", self:GetPos() + self:GetUp()*10, self:GetEnemy():GetPos() + self:GetEnemy():OBBCenter(), 2000) end --------------------------------------------------------------------------------------------------------------------------------------------- local gibPos = Vector(0, 0, 5) -- 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 local spawnPos = self:LocalToWorld(gibPos) self:CreateGibEntity("obj_vj_gib", "models/vj_hlr/gibs/agib1.mdl", {BloodType="Yellow", BloodDecal="VJ_HLR_Blood_Yellow", Pos=spawnPos}) self:CreateGibEntity("obj_vj_gib", "models/vj_hlr/gibs/agib2.mdl", {BloodType="Yellow", BloodDecal="VJ_HLR_Blood_Yellow", Pos=spawnPos}) self:CreateGibEntity("obj_vj_gib", "models/vj_hlr/gibs/agib3.mdl", {BloodType="Yellow", BloodDecal="VJ_HLR_Blood_Yellow", Pos=spawnPos}) 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) return false end --------------------------------------------------------------------------------------------------------------------------------------------- local gibs = {"models/vj_hlr/gibs/agib1.mdl", "models/vj_hlr/gibs/agib2.mdl", "models/vj_hlr/gibs/agib3.mdl"} -- function ENT:CustomOnDeath_AfterCorpseSpawned(dmginfo, hitgroup, corpseEnt) corpseEnt:SetSkin(2) VJ_HLR_ApplyCorpseEffects(self, corpseEnt, gibs) end