Skip to content

TE_PROJECTILE

GeckoN edited this page Jan 31, 2017 · 4 revisions

Shoots a model in some direction. The model has no gravity and kills itself after colliding with an entity or the world.

Parameters

Type Name Description
Vector pos Center point for the effect
Vector velocity Speed and direction of the model
CBaseEntity@ owner If set, the projectile will not collide with this entity.
string model Model to display
uint8 life Time to display model (seconds * 0.1)

API Function

No API function exists as of SC 5.02

NetworkMessage Function

void te_projectile(Vector pos, Vector velocity, CBaseEntity@ owner=null, 
	string model="models/grenade.mdl", uint8 life=1, 
	NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
	int ownerId = owner is null ? 0 : owner.entindex();
	NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
	m.WriteByte(TE_PROJECTILE);
	m.WriteCoord(pos.x);
	m.WriteCoord(pos.y);
	m.WriteCoord(pos.z);
	m.WriteCoord(velocity.x);
	m.WriteCoord(velocity.y);
	m.WriteCoord(velocity.z);
	m.WriteShort(g_EngineFuncs.ModelIndex(model));
	m.WriteByte(life);
	m.WriteByte(ownerId);
	m.End();
}
Clone this wiki locally