First, I have never made a lua script before and I do not plan on actually making mods. I just want to know how this is used. I just wanna do this one thing.
Is there any way to, for instance, place an existing NPC like a citizen, in the player collision group?
And if so, will it work the way I hope it will?
I was hoping that if it is possible, it would make said NPC collide with objects in the game in the same way players do.
Read the table that links on the page.
Some groups have different collision rules that collide with different objects.
I've already read that it's useful, but not what I'm looking for. I would like to know how you want use this in a lua script.
Hm if u want to use custom collisions for entity/npc and players.. you can watch into this hook:
hook.Add( "ShouldCollide", "ShouldCollideChecks", CollisionChecker )
but care changing collision rules can break the physics
You call it on whatever entity you want to change the collision group for.
For example, this will make every prop currently on the map have no collisions with players and vehicles:
for _, ent in ipairs(ents.GetAll()) do -- Loop through every entity
if ent:GetClass() ~= "prop_physics" then
continue -- If the entity isn't a prop then ignore it
end
ent:SetCollisionGroup(COLLISION_GROUP_WEAPON) -- Change the entity's collision group
end
https://my.mixtape.moe/gbyrvt.webm
I wrote a script a few months back too that gives this a more practical use.
https://pastebin.com/b0BX2iPZ
This script basically allows certain teams to use this command, they can use it once every minute, if they spam it it will notify staff.
When a player with this whitelist uses the command it allows other players to walk though them for a small amount of time, useful when running Entity/SetModelScale on a player due to bugged hull scaling. It's not a perfect script by any means but it fits my and the players on my servers needs. Work 90% of the time as long as the area is not too cramped.
You really shouldn't be using a NW variable to keep track of the cooldown like that. NW vars get networked every tick regardless of whether they changed or not. You could really just say ply.unstuck_command = false/true
Did not know that, learn something everyday. Thank you kind sir
Sorry, you need to Log In to post a reply to this thread.