View Single Post
Author Message
Tetradox
Junior Member
Join Date: Aug 2016
Old 08-02-2017 , 02:24   [TF2] Custom Projectile
Reply With Quote #1

Hello, well, i was trying to spawn an arrow projectile, but i have a problem, it appears to not collide with anything, for some reason, when spawned, it disappears when it is about to hit something. I tried setting "m_CollisionGroup" and "m_usSolidFlags" but the problem persists.

The code i use is this:

Code:
int ShootArrow(int client)
{
	float pos[3], rot[3], vel[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", pos);
	GetClientEyeAngles(client, rot);
	pos[2]+=63;			

	int proj = CreateEntityByName("tf_projectile_arrow");
	SetVariantInt(GetClientTeam(client));
	AcceptEntityInput(proj, "TeamNum", -1, -1, 0);
	SetVariantInt(GetClientTeam(client));
	AcceptEntityInput(proj, "SetTeam", -1, -1, 0); 
	SetEntPropEnt(proj, Prop_Send, "m_hOwnerEntity", client);

	vel[0] = Cosine(DegToRad(rot[0]))*Cosine(DegToRad(rot[1]))*2600.0;
	vel[1] = Cosine(DegToRad(rot[0]))*Sine(DegToRad(rot[1]))*2600.0;
	vel[2] = Sine(DegToRad(rot[0]))*2600.0;
	vel[2]*=-1;

	TeleportEntity(proj, pos, rot, vel);
	DispatchSpawn(proj);
}
What should i add to make it collide with things and do damage?

Last edited by Tetradox; 08-02-2017 at 02:24.
Tetradox is offline