Garry's Mod
Auto Remove Stuck NPCs
107 comentarios
Peluceus Donmian 19 MAR a las 21:55 
Yeah it's a great mod for use with ZINW but it does conflict with Zippy's Active Ragdoll mod. It's a shame because with ZINW this is an incredibly important mod but I also like to be incentivized to double tap
Hatshepherd 13 DIC 2024 a las 5:44 
I agree
Gorigo 14 NOV 2024 a las 6:28 
theres should be option to check if entity cant move
小卡齐娜3095 9 AGO 2024 a las 3:31 
How this will works on a custom npc ???
Clefable_Recon ʕ º ᴥ ºʔ 17 JUL 2024 a las 13:05 
Would be nice alternative option to teleport any friendly ally warp next to you, and add Resistance to the option pool
ZachNohKap 30 MAR 2024 a las 22:15 
@Winn thank you king!
Winn 30 MAR 2024 a las 10:26 
Conflicts with Zippy's Active Ragdoll mod, they are detected as stuck when they ragdoll and are instantly deleted.
MrGermandeutsch 21 MAR 2024 a las 15:56 
Oh if only. But alas, it seems to just be a distant dream.
Coffee Man  [autor] 21 MAR 2024 a las 15:54 
If only you'd have been specifically warned about that specific side effect in the description or something, am I right?
tactical dude 21 MAR 2024 a las 12:24 
Sadly it takes away some or even most of the npcs on the hl2 maps.
MrGermandeutsch 7 MAR 2024 a las 0:39 
This is a blessing.
ZachNohKap 6 MAR 2024 a las 16:02 
Dude. You literally have a catgirl as your pfp.
Ben_19M 6 MAR 2024 a las 10:06 
youre rather drab, mr mud
My Name is Mud 6 MAR 2024 a las 10:05 
and i dress in blue yes navy blue
Ben_19M 6 MAR 2024 a las 9:38 
is this the most boring sonsabitch ive ever seen?
Tixerx 6 MAR 2024 a las 6:36 
Hello mud
My Name is Mud 6 MAR 2024 a las 6:26 
my name is mud
[FR] Lea 6 MAR 2024 a las 0:01 
Sorry for the formatting, the [code] tag is not supported in comments, I didn't know that, we lost the indentation. I sent you an invitation if you would like to discuss more, it will be with pleasure, I have a lot to learn ^^ Thank you
[FR] Lea 5 MAR 2024 a las 23:56 
@Coffee Man Thank you for this info !!
This code checks if the position of an npc has changed during 10s otherwise deletes it
[code]
local monitoredNPCs = {
"npc_zombie",
"npc_fastzombie",
"npc_poisonzombie",
"npc_zombine"
}

hook.Add("OnEntityCreated", "CheckStuckNPCs", function(_ent)
if GetConVar("a_cleanstucknpc"):GetBool() then
if IsValid(_ent) and _ent:IsNPC() then
if table.HasValue(monitoredNPCs, _ent:GetClass()) then
timer.Simple(1, function()
local _startpos = _ent:GetPos()
timer.Create(
tostring(_ent), 10, 0, function()
if IsValid(_ent) then
local _currentpos = _ent:GetPos()
if (_currentpos == _startpos) then
_ent:Remove()
timer.Remove(tostring(_ent))
else
_startpos = _currentpos
end
end
end
)
end
)
end
end
end
end)[/code]
Coffee Man  [autor] 5 MAR 2024 a las 21:44 
@dvpweb

The structure of a trace in Gmod's Wiki uses start: https://wiki.facepunch.com/gmod/Structures/Trace

You can see a code example here as well: https://wiki.facepunch.com/gmod/util.TraceLine
Coffee Man  [autor] 5 MAR 2024 a las 21:41 
@Doxhot
You're spawning wholeass dropships randomly in sandbox maps that can land and deploy soldiers xd? For that particular case, you'd need a solid 10 seconds before the NPC checks out ok. But the timer I put for the removal check is there to both make sure the NPC is initialized properly and to allow a quick cleanup if you're constantly spawning NPCs in close proximity to you as well.

@dvpweb
You can modify it, fork it, publish your version, whatever, I let anyone do that. But you still didn't explain why should start be changed with startpos. NPCs disappearing is probably due to how that specific spawner works. I may update this release and change the timer to something like 2 or 3 seconds to hopefully add a little bit more compatibility in general.
[FR] Lea 5 MAR 2024 a las 21:27 
@Coffee Man Yes sorry, I realized afterwards that my dev was becoming a little off topic my request is more linked to another addon and what's more I put my messages in FR without translating them. In fact, start does not work, you use endpos and logically I told myself that it was startpos to use in the query and indeed, it works better.
UCEY 5 MAR 2024 a las 21:23 
I never play campaign maps, but that's fair. I like to avoid generic auto-summoning methods if I can
[FR] Lea 5 MAR 2024 a las 21:21 
This is exactly what I modified for the Simple Horde Mode addon, I put at least 10 seconds between each npc position test otherwise, they disappear shortly after being created. I will see about publishing the script
Coffee Man  [autor] 5 MAR 2024 a las 21:17 
@Doxhot
Even if you increase the timer to prevent that specific case from happening, the addon is still going to significantly break a lot of other cases if used in a campaign map. You can have a timer up to 15 seconds and a lot of NPCs in campaign maps will still be removed when they shouldn't because of how they're initially placed. Thats why I'm stating in the description to avoid using the addon when playing in campaign maps entirely. You should mainly use it when you fill sandbox maps with randomly spawning NPCs.

@dvpweb
You've deleted and reposted your comment like 50 times. Why should start be changed with startpos exactly?
UCEY 5 MAR 2024 a las 17:44 
Is there any way to change the time until they're removed? This doesn't play well with the functional dropships addon and deletes people before they deploy properly
[FR] Lea 5 MAR 2024 a las 14:54 
I think we should replace "start" with "startpos"
For your information, I readapted the code for this addon
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/comments/2939410311
[FR] Lea 5 MAR 2024 a las 7:50 
Apparently, the list is in \steamapps\workshop\content\4000\3170702564\3170702564_via_crowbar.gma
Autumnis 5 MAR 2024 a las 5:15 
alrighty. i don't use em, was just curious.
Coffee Man  [autor] 5 MAR 2024 a las 5:05 
I use the Hassassin's AI in my game, I don't use hgrunts (yet). If they're not commonly used NPCs by the players or I don't use them myself, they won't be included to keep the addon as optimized as possible.

If you happen to use 'em, refer to the Limitations Tab in the description.
Autumnis 5 MAR 2024 a las 5:02 
if you're gonna count the assassins then why not the hgrunts?
Coffee Man  [autor] 5 MAR 2024 a las 1:40 
Yes, the black ops assassins from HLS. It's there to add compatibility with one of my other addons.

Hunters and other huge NPCs are pretty buggy if included in the allowed list, they end up getting removed often even in cases when they shouldn't.
Aperture Science Prototype XR7 4 MAR 2024 a las 11:47 
couple questions:
- what's monster_human_assassin? the HL1 black ops?
- what about hunters? they're pretty damn huge and have a much greater tendency to get stuck in hallways than the average combine soldier
TZS 4 MAR 2024 a las 11:41 
I'm really surprised it took this many years to finally be a mod like this here. This is gonna be one of those nice qol mods.
Awakened NPC. 4 MAR 2024 a las 11:15 
@Ernie the giant chicken bro really thought @Pyroshark got offended by a your mom joke even though he is obviously joking.
Raylen 4 MAR 2024 a las 7:42 
bro really got offended by a mom joke
Coffee Man  [autor] 4 MAR 2024 a las 3:48 
Ok.

Your dad.
Jäger 4 MAR 2024 a las 3:32 
"your mom, etc." Take that back :(
bUh8 4 MAR 2024 a las 0:43 
BUG
Combine unloading from dropships get deleted immediatly
loklal_foxymoksi 4 MAR 2024 a las 0:37 
nice thanks a lot dude!:p03::GDNormal::eli::p2chell::resmile::steamhappy:
nasty rat 3 MAR 2024 a las 18:37 
Aw crap John! My leg is-

(randomly dissapears all of a sudden)
evil foll ginlan davbrer witer 3 MAR 2024 a las 15:58 
finally those idiots won't get stuck in eachother
thex710 3 MAR 2024 a las 15:52 
OK, I messed around with the script and managed to make it so ANY npc(SNPCs and Nextbots) can get removed, no need to add them to a list. Still a bit buggy though.
Cêcedilha 3 MAR 2024 a las 11:30 
why are we only getting this now???
AgentBuddPennCentral 3 MAR 2024 a las 9:50 
does it support SNPCS?
Rizz Monkey 2 MAR 2024 a las 19:22 
please add support for rebels
aeiou [DFS] 2 MAR 2024 a las 18:13 
Cool.
Dragai 2 MAR 2024 a las 17:07 
please make it work for all npcs like nextbots
izyooil moai 2 MAR 2024 a las 15:44 
fuck you patrick imma search up starfish recipe
N00bGsav™ 2 MAR 2024 a las 15:22 
Patrick Why?