CEntityFuncs

Global entity functions

Type: Reference type

Methods

Declaration Description
CBaseEntity@ CreateEntity(const string& in szClassName, dictionary@ pDictionary = null, bool fSpawn = true) Create an entity by class name. Pass keyvalues in using the dictionary, if any. Keyvalues must be strings.
The class name can be either one of the entities included with the game or a custom entity.
CBaseEntity@ Create(const string& in szClassname, const Vector& in vecOrigin, const Vector& in vecAngles, bool fCreateAndDontSpawn, edict_t@ entOwner = null) Creates an entity by class name.
void CreateDecal(const string& in szDecalName, const Vector& in vecOrigin, const string& in szTargetName = "") Creates a decal with the specified name.
If given a name, has to be triggered to be placed, otherwise, is placed immediately.
CSprite@ CreateSprite(const string& in szSpriteName, const Vector& in vecOrigin, bool fAnimated, float flFrameRate = 10.0f) Creates a sprite. flFrameRate must be set to a valid value to animate the sprite.
CBeam@ CreateBeam(const string& in szSpriteName, int width) Creates a beam entity with the given sprite and width set.
void CreateExplosion(const Vector& in vecCenter, const Vector& in vecAngles, edict_t@ pOwner, int iMagnitude, bool fDoDamage) Creates an explosion.
If fDoDamage is true, also deals damage to entities within its effect radius, which is determined by the magnitude.
CBaseEntity@ CreateDisplacerPortal(const Vector& in vecOrigin, const Vector& in vecVelocity, edict_t@ pOwner, float flDamage, float flRadius) Creates a displacer portal.
CBaseEntity@ CreateRPGRocket(const Vector& in vecOrigin, const Vector& in vecAngles, edict_t@ pOwner) Creates an rpg rocket.
CBaseEntity@ CreateRPGRocket(const Vector& in vecOrigin, const Vector& in vecAngles, const Vector& in vecVelocity, edict_t@ pOwner) Creates an rpg rocket with custom velocity.
CGib@ CreateGib( const Vector& in vecOrigin, const Vector& in vecAngles) Creates a server side gib.
CGrenade@ ShootTimed(entvars_t@ pevOwner, const Vector& in vecStart, const Vector& in vecVelocity, float flTime) Spawns a timed grenade.
CGrenade@ ShootContact(entvars_t@ pevOwner, const Vector& in vecStart, const Vector& in vecVelocity) Spawns a contact grenade.
CGrenade@ ShootMortar(entvars_t@ pevOwner, const Vector& in vecStart, const Vector& in vecVelocity) Spawns a mortar grenade.
CGrenade@ ShootBananaCluster(entvars_t@ pevOwner, const Vector& in vecStart, const Vector& in vecVelocity) Spawn a banana bomb.
void UseSatchelCharges(entvars_t@ pevOwner, SATCHELCODE code) Triggers all satchel charges owned by pevOwner to either be released from ownership, or detonated.
void SpawnHeadGib(entvars_t@ pevVictim) Spawns a head gib for the target victim.
void SpawnRandomGibs(entvars_t@ pevVictim, int cGibs, int iHuman) Spawns random gibs for the target victim.
iHuman specifies whether the gibs are human or alien.
void SpawnStickyGibs(entvars_t@ pevVictim, const Vector& in vecOrigin, int cGibs) Spawns sticky gibs for the target victim.
cGibs specifies how many gibs there are.
void SetOrigin(CBaseEntity@ entity, const Vector& in vecOrigin) Set the origin of an entity
void SetModel(CBaseEntity@ entity, const string& in szFileName) Set the model of an entity
void SetSize(entvars_t@ pev, const Vector& in vecMin, const Vector& in vecMax) Set the size of an entity
CBaseEntity@ FindEntityInSphere(CBaseEntity@ pStartEntity, const Vector& in vecCenter, float flRadius,const string& in szValue = "", const string& in szKeyword = "targetname") Finds an entity in a sphere
CBaseEntity@ FindEntityByString(CBaseEntity@ pStartEntity,const string& in szKeyword, const string& in szValue) Finds an entity based on a key value pair
CBaseEntity@ FindEntityByClassname(CBaseEntity@ startEntity, const string& in name) Finds an entity by class name
CBaseEntity@ FindEntityByTargetname(CBaseEntity@ startEntity, const string& in name) Finds an entity by target name
CBaseEntity@ FindEntityGeneric(const string& in szName, const Vector& in vecSrc, float flRadius) Finds an entity by target name in a sphere
int MonstersInSphere(array<CBaseEntity@>@ pArray, const Vector& in vecCenter, float flRadius) Finds monsters in a sphere
int EntitiesInBox(array<CBaseEntity@>@ pArray, const Vector& in mins, const Vector& in maxs, int flagMask) Finds entities in a box
int TargetsInBox(array<CBaseEntity@>@ pArray, const Vector& in mins, const Vector& in maxs) Finds targets in a box
int BrushEntsInBox(array<CBaseEntity@>@ pArray, const Vector& in mins, const Vector& in maxs ) Finds brush entities in a box
int DispatchSpawn(edict_t@ entity) Dispatches the spawning of an entity
bool DispatchKeyValue(edict_t@ entity, const string& in szKeyName, const string& in szValue) Dispatches the passing of a key value pair to an entity
bool EntvarsKeyvalue(edict_t@ entity, const string& in szKeyName, const string& in szValue) Handles the initialization of keyvalues located in the entity's entvars_t object.
void DispatchObjectCollisionBox(edict_t@ entity) Dispatches the initialization of the collision box of an entity
CBaseEntity@ Instance(edict_t@ edict) Gets the entity instance of an edict instance
CBaseEntity@ Instance(entvars_t@ vars) Gets the entity instance of an entvars instance
CBaseEntity@ Instance(int iEdictNum) Gets the entity instance based on an edict number
void FireTargets(const string& in szTargetName, CBaseEntity@ pActivator, CBaseEntity@ pCaller, USE_TYPE useType, float flValue = 0.0f, float flDelay = 0.0f) Triggers targets. If flDelay is nonzero, causes a temporary entity to be spawned to trigger the target at the given time.
The temporary entity becomes the caller, not the entity passed in.
bool IsMasterTriggered(const string& in szMaster, CBaseEntity@ pActivator) Returns whether the master with the given name would be triggered if activated by the given entity.
void Remove(CBaseEntity@ pEntity) Removes the given entity before the next frame starts.
bool IsValidEntity(edict_t@ pEntity) Returns whether this is a valid entity.
int EntIndex(edict_t@ pEdict) Gets the index for the given edict.
edict_t@ IndexEnt(int iEdictNum) Gets the edict for the given index.
void EjectBrass(const Vector& in vecOrigin, const Vector& in vecVelocity, float flRotation, int iModel, TE_BOUNCE soundtype) tosses a brass shell from passed origin at passed velocity.
ScriptClassInterface@ CastToScriptClass(CBaseEntity@ pEntity) Casts an CBaseEntity@ representing a custom entity to the ScriptClassBaseClass type
CBaseEntity@ RandomTargetname(const string& in szTargetname) Returns a randomly selected entity that has the given target name.
void PrecacheMaterialSounds(const Materials material) Precaches the sounds used by a particular material