metropolice realistic relations script

i was wondering if it is possible to make a script that makes metropolice not attack citizens without weapons but then if they pick up a weapon they turn hostile and if its a rebel without a weapon it makes them do the arrested ground animation until the cop is x units away or is dead is that possible? and if so could someone please attempt it, thanks

i know that in hammer world editor you can use an ai function to cause npc’s to be on your side, but i’m not so sure about this. it could be possible to create the entity that’s used in hammer, just as you do when you create an env_fire or any other effect. maybe you could make a custom config that would allow the entity to be fired whenever you pickup “x” x being the weapon or any other entity. i’m not quite sure how to do this but i’m sure some of our more experienced lua scripters/gods could attempt this.

,Good Luck

,Ghilliedman

well i know there was something like it in hl2 because the cops didnt attack the citizens but they were probably a special npc not a script but if it is somone could probably edit it.

Well technically speaking, there ARE three classes of citizen NPC. Or maybe that’s just modelsets.

You would probably have to make Metrocop SNPCs for this to work properly. Making them not attack until they’re attacked should be simple tough, but they’d look dumb.

how do you do that?

SNPCS? Look it up in the wiki, as for not attacking players and getting angry use these :
http://wiki.garrysmod.com/?title=NPC.AddRelationship (Use this to make them love all players)
http://wiki.garrysmod.com/?title=NPC.AddEntityRelationship (Use this to make them hate a single entity.
http://wiki.garrysmod.com/?title=Gamemode.ScaleNPCDamage (Here you can make them angry at what damaged them)

thanks, but i have a question if he hates no one until hes attacked then do others hate him befor hes attacked?

if others are NPCs that would usually hate him then yes, you’ll have to set their relationships too.

It was the same NPC, but in Hammer you can set Metrocops to be normal city cops.

how?