DrVrej / VJ-Base

An addon for Garry's mod that contains bunch of bases to make many different types of addons.

Home Page:http://steamcommunity.com/sharedfiles/filedetails/?id=131759821

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grenade attack code doesn't work.

nopeparty opened this issue · comments

AddCSLuaFile("shared.lua")
include('shared.lua')
/-----------------------------------------------
*** Copyright (c) 2012-2015 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/combine_guard.mdl" -- Leave empty if using more than one model
ENT.StartHealth = GetConVarNumber("vj_combine_guard_h")
--ENT.MoveType = MOVETYPE_STEP
ENT.MovementType = VJ_MOVETYPE_GROUND
--ENT.HullType = HULL_MEDIUM_TALL
ENT.HullType = HULL_HUMAN

ENT.VJ_NPC_Class = {"CLASS_COMBINE"}
ENT.Bleeds = true -- Does the SNPC bleed? (Blood decal, particle and etc.)
ENT.BloodParticle = "blood_impact_yellow_01" -- Particle that the SNPC spawns when it's damaged
ENT.BloodDecal = "YellowBlood" -- (Red = Blood) (Yellow Blood = YellowBlood) | Leave blank for none
ENT.RunAwayOnUnknownDamage = false
ENT.BloodDecalRate = 1000 -- The more the nuumber is the more chance is has to spawn | 1000 is a good number for yellow blood, for red blood 500 is good | Make the number smaller if you are using big decal like Antlion Splat, Which 5 or 10 is a really good number for this stuff

ENT.HasRangeAttack = true -- Should the SNPC have a range attack?
ENT.HasMeleeAttack = true -- Should the SNPC have a melee attack?

ENT.AnimTbl_MeleeAttack = {ACT_MELEE_ATTACK1} -- Melee Attack Animations
ENT.MeleeAttackAnimationDelay = 0 -- It will wait certain amount of time before playing the animation
ENT.MeleeAttackDistance = 45 -- How close does it have to be until it attacks?
ENT.MeleeAttackDamageDistance = 85 -- How far the damage goes
ENT.MeleeDistanceB = 45 -- Sometimes 45 is a good number but Sometimes needs a change
ENT.MeleeAttackHitTime = 0.6 -- This counted in seconds | This calculates the time until it hits something
ENT.UntilNextAttack_Melee = 0.5 -- How much time until it can use a attack again? | Counted in Seconds
ENT.MeleeAttackDamage = GetConVarNumber("vj_combine_guard_d")
ENT.MeleeAttackDamageType = DMG_CRUSH -- Type of Damage

ENT.RangeAttackEntityToSpawn = "obj_guard_shot" -- The entity that's released by the SNPC
ENT.RangeDistance = 300 -- This is how far away it can shoot
ENT.RangeToMeleeDistance = 30 -- How close does it have to be until it uses melee?
ENT.RangeUseAttachmentForPos = false -- Should the projectile spawn on a attachment?
ENT.UntilNextAttack_Range = 1 -- How much time until it can use a attack again? | Counted in Seconds
ENT.AfterShoot = 1.2 -- This is in seconds | How much time until the spit gets thrown | Example: After it does its animation, it waits 1 second until it actually shoot
ENT.AllowIgnition = false -- Can this SNPC be set on fire?
ENT.HasFootStepSound = true -- Should the SNPC make a footstep sound when it's moving?
ENT.CombineFriendly = true
ENT.HasDeathRagdoll = true
ENT.FootStepSoundLevel = 85
ENT.CallForHelpDistance = 1000 -- -- How far away the SNPC's call for help goes | Counted in World Units
ENT.NextCallForHelpTime = 2
ENT.VJ_IsHugeMonster = true
--ENT.ImunneCombineBall = true
ENT.Immune_AcidPoisonRadiation = true -- Immune to Acid, Poison and Radiation
--ENT.Immune_Dissolve = true -- Immune to Dissolving | Example: Combine Ball
--ENT.Immune_Physics = true -- Immune to Physics
ENT.KnockBackV = true -- If true, it will cause a knockback to its enemy
ENT.KnockBackVForward = 700 -- Knockback Forward number
ENT.KnockBackVUP = 50 -- Knockback Up Number
ENT.HasMeleeAttackKnockBack = true -- If true, it will cause a knockback to its self.enemy
ENT.MeleeAttackKnockBack_Forward1 = 150 -- How far it will push you forward | First in math.random
ENT.MeleeAttackKnockBack_Forward2 = 160 -- How far it will push you forward | Second in math.random
ENT.MeleeAttackKnockBack_Up1 = 300 -- How far it will push you up | First in math.random
ENT.MeleeAttackKnockBack_Up2 = 50 -- How far it will push you up | Second in math.random
ENT.MeleeAttackKnockBack_Right1 = 0 -- How far it will push you right | First in math.random
ENT.MeleeAttackKnockBack_Right2 = 0 -- How far it will push you right | Second in math.random

ENT.HasGrenadeAttack = true -- Should the SNPC have a grenade attack?
ENT.GrenadeAttackEntity = "npc_grenade_frag" -- The entity that the SNPC throws | Half Life 2 Grenade: "npc_grenade_frag"
ENT.AnimTbl_GrenadeAttack = {ACT_RANGE_ATTACK2} -- Grenade Attack Animations
ENT.GrenadeAttackAttachment = "secondary" -- The attachment that the grenade will spawn at
ENT.TimeUntilGrenadeIsReleased = 0.3 -- Time until the grenade is released
ENT.NextThrowGrenadeTime = VJ_Set(2, 2) -- Time until it can throw a grenade again
ENT.ThrowGrenadeChance = 2 -- Chance that it will throw the grenade | Set to 1 to throw all the time

ENT.HasFootStepSound = true -- Should the SNPC make a footstep sound when it's moving?
ENT.FootStepTimeRun = 0.3 -- Next foot step sound when it is running
ENT.FootStepTimeWalk = 0.6 -- Next foot step sound when it is walking
ENT.ConstantlyFaceEnemy = true -- Should it face the enemy constantly?
ENT.ConstantlyFaceEnemy_IfAttacking = true -- Should it face the enemy when attacking?
ENT.ConstantlyFaceEnemy_Postures = "Standing" -- "Both" = Moving or standing | "Moving" = Only when moving | "Standing" = Only when standing
ENT.ConstantlyFaceEnemyDistance = 1500 -- How close does it have to be until it starts to face the enemy?
ENT.NoChaseAfterCertainRange = false
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 = "Regular" -- "Regular" = Default behavior | "OnlyRange" = Only does it if it's able to range attack
ENT.SquadName = "overwatch" -- Squad name, console error will happen if two groups that are enemy and try to squad!
-- ====== Sound File Paths ====== --
-- Leave blank if you don't want any sounds to play
ENT.SoundTbl_FootStep = {"combine_guard/step1.wav","combine_guard/step2.wav","combine_guard/step3.wav","combine_guard/step4.wav"}
ENT.SoundTbl_Idle = {"combine_guard/refind_enemy1.wav","combine_guard/refind_enemy2.wav","combine_guard/refind_enemy3.wav","combine_guard/refind_enemy4.wav"}
ENT.SoundTbl_Alert = {"combine_guard/go_alert1.wav","combine_guard/go_alert2.wav","combine_guard/go_alert3.wav"}
ENT.SoundTbl_MeleeAttack = {"combine_guard/melee"}
ENT.SoundTbl_MeleeAttackMiss = {"combine_guard/stunstick_swing1.wav","combine_guard/stunstick_swing2.wav"}
ENT.SoundTbl_RangeAttack = {"combine_guard/cguard_fire.wav"}
ENT.SoundTbl_Pain = {"combine_guard/pain1","combine_guard/pain2","combine_guard/pain3"}
ENT.SoundTbl_Death = {"combine_guard/die4.wav","combine_guard/die5.wav","combine_guard/die6.wav"}
ENT.RangeGetUp = 150 -- This makes the Object get up and it helps the Object reach farther
ENT.RangeGetForward = 1000 -- the width of the object spawning. Try to see what I mean.

ENT.RangeAttackSoundLevel = 150
ENT.AlertSoundLevel = 90
ENT.IdleSoundLevel = 90
ENT.DeathSoundLevel = 90
ENT.PainSoundLevel = 90
ENT.MeleeAttackSoundLevel = 90
ENT.MeleeAttackMissSoundLevel = 90
-----custom
ENT.AnimTbl_Walk = {ACT_WALK} -- Set the walking animations | Put multiple to let the base pick a random animation when it moves
ENT.AnimTbl_Run = {ACT_WALK}

function ENT:RangeAttackCode_GetShootPos(TheProjectile)
return self:GetUp()*150 +self:GetForward()*5500
end

/-----------------------------------------------
*** Copyright (c) 2012-2015 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.
-----------------------------------------------
/

I modified to add grenade attack code but grenade attack doesn't work.( I did control this snpc but only this snpc's grenade attack doesn't work.This snpc is just standing and nothing happened. Other snpc's grenade attack works fine.)
What's wrong with this code and how do i fix it?

Nevermind. It's just "npc_vj_creature_base" problem. I was do edit to "npc_vj_human_base" and problem is solved.