Entity bottoming event||doc135517

September 20, 2022

Format

 ENTITY_TOUCHDOWN
  • The class to which the function belongs:Entity

Description

This event is triggered when the entity object falls outside the map and hits the bottom. When the entity hits the bottom, it will automatically cause damage regardless of any attribute configuration.


Context

The context content of the event

name type Description
obj1 Entity Bottomed Entity Instance
boolean canDoDamage Whether to take bottoming damage, default true


Code Samples

On the server side of the entity templatemount script, when the registered entity of this class bottoms outCallback, if you will take bottoming damage, turn off bottoming damage and jump to the location

Trigger.RegisterHandler(this:cfg(), "ENTITY_TOUCHDOWN", function(context)
  local entity = context.obj1                        --Get bottomed entity
  if context.canDoDamage then                        --Have bottomed out damage
     context.canDoDamage = false                     --Sets this entity to be immune to bottoming damage
     entity:setPos(Vector3.new(30, 55, 30), 0, 0)    --Set entity location
  end
end)