Vj base - modifier un snpc pour qu'il ne détecte pas les gens accroupis

  • Initiateur de la discussion Deadman69330
  • Date de début
  • Initiateur de la discussion
Deadman69330

Deadman69330

Psychopathe
Messages
2 289
Score réaction
309
Points
290
Salut,

J'utilise actuellement cet addon:

Et il ajoute des monstres, des "Watchers" qui viennent du jeu Metro 2033, et ils sont censé nous voir que si on est en face d'eux, sauf que bon je voudrais modifier leurs système de base.

De base dans l'addon, ils nous repèrent de partout autour d'eux.
Je voudrais faire en sorte qu'ils ne nous repèrent pas si on est accroupis, voila le code de base du SNPC:
Code:
AddCSLuaFile("shared.lua")
include('shared.lua')
ENT.Model = {"models/muffinvibe/2033/symbol/watcher.mdl"} -- The game will pick a random model from the table when the SNPC is spawned | Add as many as you want
ENT.StartHealth = 500
ENT.HullType = HULL_HUMAN
---------------------------------------------------------------------------------------------------------------------------------------------
ENT.VJ_NPC_Class = {"CLASS_ZOMBIE"} -- NPCs with the same class with be allied to each other
ENT.BloodColor = "Red" -- The blood type, this will determine what it should use (decal, particle, etc.)
ENT.SightDistance = 20000
ENT.HasMeleeAttack = true -- Should the SNPC have a melee attack?
ENT.AnimTbl_MeleeAttack = {ACT_MELEE_ATTACK1} -- Melee Attack Animations
ENT.MeleeAttackDistance = 32 -- How close does it have to be until it attacks?
ENT.MeleeAttackDamageDistance = 85 -- How far does the damage go?
ENT.TimeUntilMeleeAttackDamage = 0.4 -- This counted in seconds | This calculates the time until it hits something
ENT.NextAnyAttackTime_Melee = 0.2 -- How much time until it can use any attack again? | Counted in Seconds
ENT.MeleeAttackDamage = 7
ENT.CallForHelp = true
ENT.HasCallForHelpAnimation = false
ENT.MeleeAttack_NoProps = true
ENT.PushProps = false -- Should it push props when trying to move?
ENT.AttackProps = false
ENT.MeleeAttackBleedEnemy = false -- Should the player bleed when attacked by melee
ENT.MeleeAttackBleedEnemyChance = 3 -- How chance there is that the play will bleed? | 1 = always
ENT.MeleeAttackBleedEnemyDamage = 1 -- How much damage will the enemy get on every rep?
ENT.MeleeAttackBleedEnemyTime = 1 -- How much time until the next rep?
ENT.MeleeAttackBleedEnemyReps = 4 -- How many reps?
ENT.HasLeapAttack = false -- Should the SNPC have a leap attack?
ENT.AnimTbl_LeapAttack = {"leapstrike"} -- Melee Attack Animations
ENT.LeapDistance = 150 -- The distance of the leap, for example if it is set to 500, when the SNPC is 500 Unit away, it will jump
ENT.LeapToMeleeDistance = 150 -- How close does it have to be until it uses melee?
ENT.TimeUntilLeapAttackDamage = 0.2 -- How much time until it runs the leap damage code?
ENT.NextLeapAttackTime = 3 -- How much time until it can use a leap attack?
ENT.NextAnyAttackTime_Leap = 0.4 -- How much time until it can use any attack again? | Counted in Seconds
ENT.LeapAttackExtraTimers = {0.4,0.6,0.8,1} -- Extra leap attack timers | it will run the damage code after the given amount of seconds
ENT.TimeUntilLeapAttackVelocity = 0.2 -- How much time until it runs the velocity code?
ENT.LeapAttackVelocityForward = 200 -- How much forward force should it apply?
ENT.LeapAttackVelocityUp = 150 -- How much upward force should it apply?
ENT.LeapAttackDamage = 3
ENT.LeapAttackDamageDistance = 100 -- How far does the damage go?
ENT.FootStepTimeRun = 0.4 -- Next foot step sound when it is running
ENT.FootStepTimeWalk = 0.6 -- Next foot step sound when it is walking -- ====== Sound File Paths ====== --
-- Leave blank if you don't want any sounds to play
ENT.SoundTbl_FootStep = {"npc/fast_zombie/foot1.wav","npc/fast_zombie/foot2.wav","npc/fast_zombie/foot3.wav","npc/fast_zombie/foot4.wav"}
ENT.SoundTbl_Breath = {}
ENT.SoundTbl_CallForHelp = {"monsters/watcher/watchman_howl_1.mp3","monsters/watcher/watchman_howl_2.mp3","monsters/watcher/watchman_howl_distant_2.mp3"}
ENT.SoundTbl_Alert = {"monsters/watcher/watchman_aggressive_1.mp3"}
ENT.SoundTbl_MeleeAttack = {"monsters/watcher/watchman_attack_1.mp3","monsters/watcher/watchman_attack_2.mp3","monsters/watcher/watchman_attack_3.mp3"}
ENT.SoundTbl_MeleeAttackMiss = {"zsszombie/miss1.wav","zsszombie/miss2.wav","zsszombie/miss3.wav","zsszombie/miss4.wav"}
ENT.SoundTbl_LeapAttackJump = {"monsters/nosaach/nosaach_voice_1.wav","monsters/nosaach/nosaach_voice_2.wav"}
ENT.SoundTbl_LeapAttackDamage = {"npc/fast_zombie/claw_strike1.wav","npc/fast_zombie/claw_strike2.wav","npc/fast_zombie/claw_strike3.wav"}
ENT.SoundTbl_Pain = {"monsters/watcher/watchman_hit_1.mp3","monsters/watcher/watchman_hit_2.mp3","monsters/watcher/watchman_hit_3.mp3"}
ENT.SoundTbl_Death = {"monsters/watcher/watchman_death_2.mp3","monsters/watcher/watchman_death_1.mp3"}
ENT.GeneralSoundPitch1 = 125
ENT.GeneralSoundPitch2 = 125
---------------------------------------------------------------------------------------------------------------------------------------------
function ENT:CustomOnInitialize() self:SetCollisionBounds(Vector(13, 13, 50), Vector(-13, -13, 0))
end

Et j'ai donc rajouter ceci à la fin du code:
Code:
function ENT:FindEnemy() -- Search around us for entities -- This can be done any way you want eg. ents.FindInCone() to replicate eyesight -- local _ents = ents.FindInSphere( self:GetPos(), ) local _ents = ents.FindInCone( self:GetPos(), self:EyeAngles(), 500, 0.707 ) -- Here we loop through every entity the above search finds and see if it's the one we want for k, v in pairs( _ents ) do if ( v:IsPlayer() and v:Alive() ) then -- We found one so lets set it as our enemy and return true if not _ents:Crouching() then self:SetEnemy( v ) return true else return false end end end -- We found nothing so we will set our enemy as nil ( nothing ) and return false self:SetEnemy( nil ) return false
end
(j'ai laissé les commentaires de l'exemple du wiki pour que vous puissiez mieux comprendre)



Sauf que ça ne marche pas :/
Je pense que VJBase bypass la détection par défaut pour ces SNPC mais je sais pas comment réussir à faire ce que je veux :/


Si vous avez la soluce, je suis prenneur :)

Merci
 
Discord d'entraide
Rejoignz-nous sur Discord