Trigger

A Trigger class is a utility class to trigger events when some Actor enters an Area.

Attention

This page is under construction.

Usage

local MyTrigger = Trigger(Vector(-200, 100, 500), 100)

MyTrigger:on("BeginOverlap", function(trigger, actorTriggering)
        Package:Log("Someone entered my Trigger")
end)

Constructor Parameters

Type

Name

Default

Vector

Location

Vector(0, 0, 0)

number

Radius

100

boolean

Is Visible

true

Color

Color of the Trigger Sphere (if Visible)

Color(1, 0, 0, 1)

Functions

Returns

Name

Description

server-only-label

SetRadius(number Radius)

Sets the radius of this trigger

server-only-label

SetVisibility(boolean Visible)

Sets if this Trigger is visible as a Sphere

Attention

Trigger inherits from Actor, but some of the following functions doesn’t have any effect. E.g. SetCollision, SetGravityEnabled, AddImpulse, SetScale.

Functions (Inherited from Actor)

Returns

Name

Description

Vector

GetLocation()

Get the actor’s position in the game world

Rotator

GetRotation()

Gets the actor’s rotation in the game world

number

GetCollision()

Gets the current actor’s collision

boolean

IsGravityEnabled()

Gets the actor’s gravity enabled

server-only-label

SetRotation(Rotator NewRotation)

Sets the actor’s rotation in the game world

server-only-label

SetLocation(Vector NewLocation)

Sets the actor’s location in the game world

server-only-label

SetScale(Vector Scale)

Sets the actor’s scale

server-only-label

SetCollision(number CollisionType)

Sets the actor’s collision (0 - Normal, 1 - Static Only, 2 - No Collision)

server-only-label

SetGravityEnabled(boolean NewGravity)

Sets the actor’s gravity enabled

server-only-label

SetInitialLocation(Vector NewInitialLocation)

Sets the initial location

server-only-label

Vector

GetInitialLocation()

Gets the initial location

server-only-label

SetTintColor(Color NewTintColor)

Sets the tint color, for completely paint an object, multiply the color by 10 or 100

Color

GetTintColor()

Gets the Tint Color

server-only-label

Destroy()

Destroys this Actor

boolean

IsValid()

Returns if this is Valid

string

GetType()

Returns the type of this Actor

server-only-label

AttachTo(Actor Other, string BoneName, Vector RelativeLocation)

Attaches this Actor to any other Actor with a Relative Offset

server-only-label

AddImpulse(Vector Force)

Applies a Force in world coordinate on this Actor (the force is applied on Client side, by the (in most of cases) the closest player of this object)

SetValue(string Key, any Value)

Sets a value in this entity, which can be accessed by any package (local only)

any

GetValue(string Key)

Gets a value given a key

Events

Name

Arguments

Description

BeginOverlap

Trigger self, any Actor

When an Actor enters this trigger

EndOverlap

Trigger self, any Actor

When an Actor leaves this trigger

Events (Inherited from Actor)

Name

Arguments

Description

Spawn

Entity actor

Triggered when an Entity is Spawned/Created

Destroy

Entity actor

Triggered when an Entity is Destroyed