Fire And Event Functions

FireEvent

Fire an FSM script event.

Syntax

FireEvent [eventname] -- Fire an event with this name

FireEvent [eventname],[destinationtype] -- Fire an event with this name and destination type

Warning

You must have the OnFire_ prefix before the actual function name of your event when you declare it! For example: OnFire_EventFireTest

When firing events, you only use the name of the function, without the "OnFire_" prefix!

The events that you fire are dependant on the targeted entity!

Despite being pretty global otherwise, keep in mind that the events you fire are destination specific! Make sure to target the correct entities!

Note

Here's a list of all the destination types: owner, target, caller, player, point, anchor, slot, self

It doesn't matter what state, pattern, or behaviour the event is declared in

Note that even if you want the action block empty, in order to declare event functions, you must have an empty one anyway!

This is basically the equivalent of the FireFSMScriptEvent entity output

Tip

You can fire events from entirely seperate entities without inheritance by doing TargetEntByName before you fire them!

Example


st_state1
{
    Group Alert
    Patterns
    {
        pt_default
        {
            actions
            {
                SetAttr "Test 0"

                // When firing events, you only use the name 
                // of the function, without the "OnFire_" prefix!
                FireEvent EventFireTest
            }
        }
    }
}

st_state2
{
    Group Neutral
    Patterns
    {
        pt_default
        {
            // Note that even if you want the action block empty, in order 
            // to declare event functions, you must have an empty one anyway!
            actions
            {

            }
            events
            {
                // Make sure you have the "OnFire_" prefix in your event function name!
                OnFire_EventFireTest "ChangeAttr Test +1"
            }
        }
}



FireEventEx

Unused Postal3Script function.

The same as FireEvent, except it only checks for the self destination type parameter, otherwise it will default to target.

Warning

Only the self destination type parameter is allowed!

Syntax

FireEventEx [eventname]" -- Fire an event on the targeted entity

FireEventEx [eventname],self" -- Fire an event with this name with the self destination type

Example


pt_default
{
    actions
    {
        TargetEntByName scary_npc // Target the npc

        // If the target is close enough to us, fire the GetScared event on ourself!
        IfAttr "DistTo:target < 50 FireEventEx GetScared,self"

        // Otherwise if our target is far away from us, fire the
        // CantFindScaredyCat event on our target!
        IfAttr "DistTo:target > 150 FireEventEx CantFindScaredyCat"
    }
}


FireUser

Fire user entity inputs set through Hammer on the entity.

Warning

Activator and the Caller will be the entity itself.

Syntax

FireUser 1 -- Fire the slot 1 input

FireUser 2 -- Fire the slot 2 input

FireUser 3 -- Fire the slot 3 input

FireUser 4 -- Fire the slot 4 input


EntFireUser

Fire user entity inputs set through Hammer on a named entity.

Warning

Activator and the Caller will be the entity itself (the one that called the function).

Syntax

EntFireUser [ent_name],1 -- Fire the slot 1 input on the entity

EntFireUser [ent_name],2 -- Fire the slot 2 input on the entity

EntFireUser [ent_name],3 -- Fire the slot 3 input on the entity

EntFireUser [ent_name],4 -- Fire the slot 4 input on the entity


FireInput

Fire entity inputs on an entity.
You can see here the list of all available inputs.

Warning

Only self and target are supported.

Syntax

FireInput target,[input] -- Fires input on the entity's target.

FireInput self,[input] -- Fires input on the entity.


EntFireInput

Fire entity inputs on a named entity.
You can see here the list of all available inputs.
Radius is always checked from the executed entity.

Syntax

EntFireInput [name],[input] -- Fires input on the named entity.

EntFireInput [name],[input]:[param] -- Fires input with param (if supported) on the named entity.

EntFireInput [name],[input],[radius] -- Fires input on the named entity if it's around the radius.

EntFireInput [name],[input]:[param],[radius] -- Fires input with param (if supported) on the named entity if it's around the radius.


OnUser (Events)

Fire user entity outputs set through Hammer on a specific entity.
When they are invoked, they can call a Postal3Script event.

Only up to 4 are supported. OnUser1 -> OnUser4