• Combine Camera NPC Angry
    5 replies, posted
I'm curious as to if there is a function to make an NPC angry, also is there a function to make the camera be angry at a particular player? I want to make a script where if a player is tagged then the camera goes off and flashes at them. The context menu option I used was "Make angry" [IMG]https://i.gyazo.com/c53bacd063e53c1a3713ddbc3be86af2.png[/IMG]
You can use [code]entity:Fire("SetAngry")[/code] which will make the camera angry. Unfortunately, there isn't a way to change the camera's current target, so you'll have to add an output to the camera NPC itself and maybe make another entity which handles the output.
[QUOTE=Z0mb1n3;52243580]You can use [code]entity:Fire("SetAngry")[/code] which will make the camera angry. Unfortunately, there isn't a way to change the camera's current target, so you'll have to add an output to the camera NPC itself and maybe make another entity which handles the output.[/QUOTE] [CODE]entity:SetTarget (target) [/CODE]
[QUOTE=Potatofactory;52245926][CODE]entity:SetTarget (target) [/CODE][/QUOTE] I suppose the combine camera does obey that function, but that would make it one of very few. Most other NPCs seem to override any manual targeting.
Yeah, and I was looking to hook on to one of the NPC's outputs so I can actually figure out when to fire the SetAngry, and also it is important to figure out the player that caused it to fire. So I did a little research and either I'm going to use the functions provided [URL="https://facepunch.com/showthread.php?t=990289&p=24290299&viewfull=1#post24290299"]here[/URL], which the _R.entity seems to be nil so I'm not sure what it is or I'm going to make a hammer entity and input things to it from each camera to hook onto with [URL="http://wiki.garrysmod.com/page/ENTITY/AcceptInput"]this[/URL].
If you make your own entity and spawn the combine camera through that, you could do [code] self:SetName("camera" .. self:UniqueID()) self.npc:SetKeyValue("OnFoundPlayer", self:GetName() .. ",Scan") [/code] and then later in your custom entity [code] function ENT:AcceptInput(name, act, caller, data) if (name == "Scan") then if (IsValid(act)) then -- do something with the activator here end; end; end;[/code] That's what I do in my CCTV plugin for HL2RP.
Sorry, you need to Log In to post a reply to this thread.