Skeleton producing AR2

Is it possible to rig an AR2’s secondary fire to not only insta-kill the victim on the first hit but to leave a model of a skeleton or perhaps a charple ? If this is possible , then I request someone make it

Don’t use this code, Though I whipped it up in about 5 minutes, after going through loads of crashes due to the hook EntityTakeDamage being called loads of times during a combine ball hit the target.

I’m guessing some one else could do a better job, though right now I can’t get my head around what’s going on at all.

[lua]local nextEntSpawn = 0

function InstantBallKill( ent, inflictor, attacker, amount, dmginfo )

print( dmginfo:GetAmmoType( ) )
print( "checking damage info" )
--if not ent:IsNPC() or not ent:IsPlayer() then return; end
if tostring(dmginfo:GetAmmoType()) == "-1" then

	if nextEntSpawn < CurTime() then 
		
		df = CurTime()
		local a = ent:GetPos()
		local b = ent:GetAngles()
	
		print( "making corpse" )
	
		local	corpse = ents.Create( "prop_ragdoll" )
		corpse:SetModel( "models/skeleton/skeleton_whole.mdl" )
		corpse:SetPos( a )
		corpse:SetAngles( b )
		corpse:Spawn()
		corpse:Activate()
		corpse:PhysWake()
	
		nextEntSpawn = CurTime() + 15
		
	end
end
		print(df - CurTime())

print( "done" )

end
hook.Add( “EntityTakeDamage”, “instantKillCombineBall”, InstantBallKill )[/lua]

Note this also creates a ragdoll for entities such as breakable props etc. All testing done on NPCs


local nextEntSpawn = 0

function InstantBallKill( ent, inflictor, attacker, amount, dmginfo )
 
	print( dmginfo:GetAmmoType( ) )
	print( "checking damage info" )
	--if not ent:IsNPC() or not ent:IsPlayer() then return; end
	if tostring(dmginfo:GetAmmoType()) == "-1" then
	
		if nextEntSpawn < CurTime() then 
			
			df = CurTime()
			local a = ent:GetPos()
			local b = ent:GetAngles()
		
			print( "making corpse" )
		
			local	corpse = ents.Create( "prop_ragdoll" )
			corpse:SetModel( "models/skeleton/skeleton_whole.mdl" )
			corpse:SetPos( a )
			corpse:SetAngles( b )
			corpse:Spawn()
			corpse:Activate()
			corpse:PhysWake()
		
			nextEntSpawn = CurTime() + 15
			
		end
	end
			print(df - CurTime())
	
	print( "done" )
end
hook.Add( "EntityTakeDamage", "instantKillCombineBall", InstantBallKill )

Just pasting it as CODE for the 70% of people who cant see lua tags… well, i guess you could use string.find and Getclass npc, then get the combine ball entity and make it have that effect on NPCS only.

Just an idea :3:


hook.Add("DoPlayerDeath", "CreateCharple", function(ply, attacker, dmginfo)
	if dmginfo:GetInflictor():GetClass() == "prop_combine_ball" then
		local c = ents.Create("prop_ragdoll");
		c:SetModel("models/Humans/Charple0" .. math.random(1, 4) .. ".mdl");
		c:SetPos(ply:GetPos());
		c:SetAngles(ply:GetAngles())
		c:Spawn();
		c:Activate();
		c:PhysWake();
		timer.Simple(20, c.Remove, c);
	end
end)

Could make the model the skeletons from ep2 if you have ep2 =)

On the other hand, nice work.

I have ep2 but for some reason the skeleton model didn’t work.

That would create a charple in the t-pose position, use this:
http://www.facepunch.com/showthread.php?t=517762

Nice bump for an unneeded fix. The charple falls to floor straight away making the t-pose unnoticeable.


(User was banned for this post ("Bump to complain about bumping" - mahalis))