TTT Manhack Grenade

A grenade item that spawns a swarm of manhacks for TTT.

Subscribe on Steam GitHub Repo

This was a fun weapon I made for the Garry’s Mod TTT gamemode for my group of friends based off of an older buggier version I saw. The traitors can buy the item from the traitor shop and when thrown after a few seconds it spawns a swarm of manhacks who chase after players nearby. Pretty great for dealing with people who think they’re safe by barricading up a room, just don’t let it backfire on you!

The code for this is really simple so feel free to put your own spin on it with maybe some other types of enemies or a flock of birds even.

function ENT:Explode( tr )
	if SERVER then
		local manhackcount = GetConVar( "ttt_manhackgrenade_count" ):GetInt()
		self:EmitSound("npc/roller/mine/rmine_explode_shock1.wav")
		i = manhackcount
		while i > 0 do
			local ent = ents.Create("npc_manhack")
			local vec = Vector(0, 0, math.random()*2-1):GetNormalized()
			ent:SetPos(self:GetPos() + vec * 15)
			ent:SetAngles(vec:Angle())
			ent:Spawn()
			ent:SetVelocity(vec * 700)
			i = i -1
		end
		self:SetNoDraw(true)
		self:SetSolid(SOLID_NONE)
		self:Remove()
	end
end

Code is provided under GPL v3 so feel free to do whatever you want with it so long as you obey the rules of GPL v3.