Return to Main Docs Page

AcceptInput

NewerServer.png Called when another entity fires an event to this entity.

Entity:AcceptInput( string InputName , Entity pActivator , Entity pCaller , string data )
               

Arguments:


  • 1) string InputName
  • The name of the input that was triggered.

  • 2) Entity pActivator
  • The initial cause for the input getting triggered. (EG the player who pushed a button)

  • 3) Entity pCaller
  • The entity that directly triggered the input. (EG the button that was pushed)

  • 4) string data
  • The data passed.

Example:


function ENT:Touch(pEntity)
   local boom = CreateEntityByName( "env_explosion" )
   if ( boom ~= NULL ) then
      boom:SetAbsOrigin( Vector(0,0,25) ) --Explosion position on map origin. 
      boom:Spawn() --Spawn the entity. 
      boom:AcceptInput( "Explode" ) --Explode it! 
   end
end