Skip to main content
Version: Next (dev)

Interaction Feedback

React when the player interacts with an object by changing something about it — here, the colour of its mesh. Four nodes, and it demonstrates the pattern you will reach for constantly: find a component on this object, then change one of its properties.

What you need in the scene

The graph

OnMsgInteractionMessage [exec] -> SetProperty [exec]
TryGetComponentOfBaseType [Component] -> SetProperty [Object]

Node configuration:

NodeSettingValue
TryGetComponentOfBaseTypeType NameplMeshComponent
SetPropertyTypeplMeshComponent
SetPropertyPropertyColor

How it works

OnMsgInteractionMessage is a message handler entry point. It appears in the palette under Events because a plMsgInteraction-style message type exists — every message type in the project generates one of these automatically. See Entry Points and Events for how that naming works.

TryGetComponentOfBaseType is the node you use whenever a script needs to talk to another component on the same object. You pick the component type in the property grid, and it returns that component — or nothing, if the object does not have one. Its palette title reads TryGet {TypeName}.

SetProperty then writes to a named property on whatever component it is handed. Both the type and the property name are chosen in the property grid, not through pins, so the node knows what type of value to expect.

Note that TryGetComponentOfBaseType has no execution pin. It is a data node, evaluated on demand when SetProperty needs its Object input. Only the SetProperty node sits on the execution line from the entry point.

note

This script is a placeholder in its source project — it changes a colour to prove the interaction path works, and would normally be replaced by the real behaviour (playing an animation, opening a door, granting an item). The structure is what to copy.

Adapting it

  • Do something other than recolour — keep the first two nodes and swap SetProperty for the message or property that matches your case. The find-a-component step is unchanged.
  • Drive a door or platform — replace SetProperty with a message node such as SendMsgSetPlaying, or set a property on a slider or rotor component.
  • Act on a different object — instead of the implicit owner, use FindChildByName and feed its result into the component lookup.
  • Guard against a missing component — add IsValid after the lookup and branch, so the script fails quietly rather than doing nothing mysteriously.

Source

AbyssPlasma/Abyss/LeverScript.plVisualScriptClassAsset

See Also