Activate(): Difference between revisions
Jump to navigation
Jump to search
Warning:
TomEdwards (talk | contribs) (created) |
TomEdwards (talk | contribs) (Activate() is not related to entity inputs or flags of the same name.) |
||
Line 6: | Line 6: | ||
{{warning|<code>CBaseEntity</code> executes code in this function, so '''always''' call <code>BaseClass::Activate()</code> from your version.}} | {{warning|<code>CBaseEntity</code> executes code in this function, so '''always''' call <code>BaseClass::Activate()</code> from your version.}} | ||
{{tip|<code>Activate()</code> is not related to entity [[input]]s or [[flag]]s of the same name. It is ''always'' called.}} | |||
== Example == | == Example == |
Revision as of 13:55, 1 March 2008
Activate()
is a void
member function of CBaseEntity
that is available through inheritance to every entity in a Source game. It is called by the engine after Spawn()
and, if Spawn()
occurred during a map's initial load, after all other entities have been spawned too.
Activate() is used to perform spawning tasks that require interaction with other entities. Such tasks should never be performed in Spawn()
itself, as it may be called before any other entities become available.

CBaseEntity
executes code in this function, so always call BaseClass::Activate()
from your version.Example
void CAlyxEmpEffect::Activate() { // Start out with a target entity SetTargetEntity( STRING(m_strTargetName) ); BaseClass::Activate(); }