Garry's Mod

Garry's Mod

NPCs Hate Each Other Script
147 Comments
SSOS 23 Jun @ 1:47am 
I can finally host an NPC hunger games
pablo.gonzalez.2017 2 Dec, 2024 @ 7:49pm 
the combine went mad
DudeBroDad45 12 Oct, 2024 @ 3:15pm 
the population in gm_construct when there was a slight disagreement:
HeyItsJaydon 10 Apr, 2024 @ 2:42am 
i do completely agree that NPCs should target the player first, then themselves (or smthn like that)
ŽīPÝ Dragon ASS 12 Jan, 2024 @ 9:08pm 
Could you make a version of this mod that make any npc start to kill each other?
Oabobaro 27 Dec, 2023 @ 7:57am 
The npcs should prioritize the player to attack, even me being on side of a npc, it doesn't attack me and attack the closest npc, if you have a way how to do this, would be a nice addition
tijelagomerss 24 Dec, 2023 @ 4:06pm 
its working now!! thx pal
Miguel Myers 24 Dec, 2023 @ 7:03am 
Holy shit, Survivor in Gmod.
Froze  [author] 23 Dec, 2023 @ 7:13pm 
still works on my end
are there any lua errors?
what is your console command setup? is hate_each_other_npcs_enable set to 1 ?
Froze  [author] 23 Dec, 2023 @ 7:06pm 
thanks for the report, i will do some checks.
tijelagomerss 23 Dec, 2023 @ 6:04pm 
erm, dude, why this script is not working anymore?
MeryMeryl 10 Dec, 2023 @ 2:46am 
when will there be a mod that makes all npcs hate you?
Critas 3 Nov, 2023 @ 11:03am 
racism update
DexocrafterRa 19 Oct, 2023 @ 4:21am 
how did i lose this mod i needed it yesterday
76561198983371061 30 Jul, 2023 @ 7:51am 
then no one will give it a chance :))))))))))))))))))))
Froze  [author] 30 Jul, 2023 @ 4:31am 
no
чухонь (кирилл) 30 Jul, 2023 @ 3:40am 
does it work with drgbase npcs?
Big raga the opp stoppa 27 May, 2023 @ 11:47pm 
i agree
uncommon saucers 20 May, 2023 @ 4:10pm 
add an option to make them hate player
Froze  [author] 20 May, 2023 @ 2:07am 
jsut tested and it's working on my end
Froze  [author] 14 May, 2023 @ 6:47pm 
any errors?
Yruror 14 May, 2023 @ 8:51am 
ye he is right is not working
anuarwow6689 27 Apr, 2023 @ 10:51am 
mod not working
Skullbattle78 26 Apr, 2023 @ 3:47pm 
What Are Your Specs..? Gahh Dayum that's smooth even with the fucking ArcCW Urban Coalition Pack
greenman_0075 19 Apr, 2023 @ 3:31pm 
nice sorry
greenman_0075 19 Apr, 2023 @ 3:31pm 
is there a mod like this but can make them trendy to u?
fox mom 17 Apr, 2023 @ 2:31pm 
i am stealing the gullible dildo word combination
Gavitron 17 Apr, 2023 @ 11:45am 
aww you gullible dildo
Jamiroquai 17 Apr, 2023 @ 7:50am 
Look For the Lower Case 'L' And You
Will Be Kissed Tomorrow:
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLlLLLLLLLLLLLLLLLLLLLLL LLLLL
*Now Look For The Q And Your Wish
Will Come True:
... ... ... ... ... OOOOOOOOOOOOOOOOOOOQOOOOOOOOOOOOOOOOOOOOOOOOO O.. .OOOOOOOO
*This Is Really Hard, Now Find The 'N':
MMMMMMMMMMMMMMMMMMMMMMMMMNMM
*Now Find The Mistake:
ABCDEFGHIJKLNMOPQRSTUVWQYZ
*Something You Really Want, After the
countdown!!!!!
10 9 8 7 6 5 4 3 2 1 Now Close Your
Eyes And Make A Wish! ;*;*;*;*;*;* Now
Paste This On 9 pages And Your Wish
Will Come True! Hurry, You Have 20
minutes! Or What You Wished For Will
Be The Opposite"
Apocalypse Tank 17 Apr, 2023 @ 6:32am 
Just like Doom
Unknown Developer 17 Apr, 2023 @ 3:30am 
If you don't want the script to run on the client, you can make it easier by just moving it to `lua/autorun/server`
Unknown Developer 16 Apr, 2023 @ 11:33am 
The main performance problem of your code is the meaningless use of pairs instead of iparis in lists, this is a very unproductive solution. Also a lot of meaningless tables which are used very strangely. The script I threw has the same idea but it is implemented in 50 lines. I will not upload the "improved" version or similar, but try to make your script better, it is used by a lot of people now.
Froze  [author] 16 Apr, 2023 @ 11:11am 
i think i improved performance on the chasing now + added your nearest npc chase logic as an option
Froze  [author] 16 Apr, 2023 @ 10:21am 
is it the addentityrelationship not being executed every time an npc spawns?
Froze  [author] 16 Apr, 2023 @ 10:20am 
i see you're doing return end, initializing a concommand into a variable and for the chase script you go for the nearest npc? but yes I'll tidy up the if depth a little. the rebels and combines is there because before this was just a combine v combine (or rebel) script. Where is the performance improvement? is it this? [gist.github.com]

the 2nd link is very useful ty.
Unknown Developer 16 Apr, 2023 @ 9:47am 
I hate stupid Steam, it's deleting my links again, remove the spaces around / and .
1. gist . github . com / PrikolMen / a106cccf8908310c663f9dde1684b379
2. gitspartv.github.io / LuaJIT-Benchmarks
Unknown Developer 16 Apr, 2023 @ 9:42am 
The whole code is written strangely and incorrectly, I wrote code with identical functionality, you can look and compare with mine. If I write all the mistakes and bad solutions of your code, my post will be overly huge.

The same implementation in terms of functionality, but which works 10 times faster and better: https://gist.github.com/PrikolMen/a106cccf8908310c663f9dde1684b379

Yes, without the console commands, but I do not see the point in them if we want ALL npc participated in the battle, not just the combines and resistance.

I also highly recommend checking this link: https://gitspartv.github.io/LuaJIT-Benchmarks/
TheArtemMaps 16 Apr, 2023 @ 8:45am 
well it works, right? so it's good
Froze  [author] 16 Apr, 2023 @ 7:02am 
any pointers/tips?
i'm all about optimizing the code if you tell me what i need to do.
Unknown Developer 16 Apr, 2023 @ 6:39am 
very bad code.
ʞritzo 16 Apr, 2023 @ 3:43am 
Map from 1st video please.
Looks sick.
TheArtemMaps 15 Apr, 2023 @ 12:14pm 
free for all (ffa) Script
null_local 15 Apr, 2023 @ 11:45am 
now i kinda want to see NPC infighting, like in DOOM
Sleep Deprived Gaming 15 Apr, 2023 @ 10:13am 
They had one of those days when you don't want to wake up and everybody sucks.
vllad1255 15 Apr, 2023 @ 2:21am 
Класс
galunga 15 Apr, 2023 @ 1:13am 
Finally, civil war
Momo el virgo 14 Apr, 2023 @ 11:00pm 
a
supergamerpugs 14 Apr, 2023 @ 10:36pm 
hate_each_other_npcs_enable 0/1
14 Apr, 2023 @ 10:29pm 
headcrab battle royale
lol
Pain Paint 14 Apr, 2023 @ 9:34pm 
time to make a random battle royal :/