• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

Wiki Article 10. Triggers

Status
The first post in this thread is a WikiPost, and can be edited by anyone with the appropriate permissions.
VAM triggers:

cover for wiki post



Triggers are commands that perform an action on an atom's property.
that translates into:
something that does something on something



Triggers in VAM follow this basic structure:
Receiver Atom > Receiver > Receiver Target
a.k.a.
this atom > this thing in the atom > to do this





Examples of triggers

Person > AtomControl > On (checkbox unchecked = false)
This trigger will turn OFF a person atom named "Person"

Person > AtomControl > On (checkbox checked = true)
This trigger will turn ON a person atom named "Person"

InvisibleLight > Light > ToggleOn
This trigger will switch to ON or OFF the light in a light atom by switching to the opposite state of the current state.
example shown in MacGruber's guide to triggers linked below

Some examples people ask about a lot

Play music in a scene:
  1. add a music file to Scene Audio
  2. add an audiosource atom to the scene
  3. use an UIButton or other means to trigger:
    AudioSource > AudioSource > Play(youroption) > URL > web > your music
Have a person say something:
  1. add your speech audio file to Scene Audio
  2. add a person atom to the scene if not present yet
  3. use an UIButton or other means to trigger:
    Person > HeadAudioSource > Play(youroption) > URL > web > your speech audio
"Play music in a scene" example shown with screenshots:

trigger event.png
trigger - play music.png


Audio can also come from assetbundles (audiobundles), not just from Scene Audio, but you'll need a plugin to play them (see guide below).

Some guides showing trigger uses



Using triggers in a scene
Please first check the above guides on how to make a trigger if you haven't yet.

Triggers allow you to execute actions on a scene when you use buttons, have animations that trigger the triggers (yes, get used to the verb+noun mix), plugins, etc.

An UIButton atom is probably the first atom you'll use when starting to peruse the world of triggers, just because it's so simple to add, put in a trigger in the button trigger tab, and click to see it working (hopefully).
If you never set a trigger in VAM, here's your first trigger exercise:
  1. In a new scene, add a person atom and an UIbutton atom
    • maybe some lights too to see anything
  2. Go to the UIButton options and select the "Button trigger" tab to add a new trigger
  3. Create a trigger with this format:
    • Person (default name of the person atom) > AtomControl > On (change the checkbox to be unchecked)
  4. Click the button to trigger your new trigger
The person should now be OFF because you set a trigger to turn it off. Clicking again will still leave it off as that is your instruction.
If you want to have the button turn the person On and Off, adapt your trigger to use the toggle option shown on "Examples of triggers".

Congratulations, you now know how to make triggers and deserve a biscuit. Treat yourself!


Triggers, triggers, triggers...

What's the difference between a trigger in a UIButton and a trigger in the Triggers track of Timeline?
Only their location, because the trigger system is a core VAM feature, not a property of an atom or plugin.*
*well... kind of


What's with some atoms/plugins having "start actions", "transition actions", "end actions" tabs for triggers?

Triggers in these actions act upon their moment. For example, in a collision trigger like shown in the image above:
End Actions are triggered when the collision ends, i.e. the collision sphere moves out of the range of any object.

Transition actions are float triggers that get set to 1 once the collision starts and back to 0 once it ends. It can be used to set a number value or color based on whether there is a collision.
Quote from MacGruber

start-transition-end.png



The trigger system and atom properties

As you probably suspect already, each atom type will have properties that are different from other atoms. A person atom will have receiver targets for the head for example, but a UIButton won't because it has no head. Makes sense, right? Even with all their differences, they will still share many receiver targets between them, like the AtomControl that can turn the atom on or off.
There is no list of all the receivers and receiver targets for each atom type. Such a list would be really big for some, especially the person atom, and no one made one. Also, objects in an atom can expand that list. Clothing, hair, plugins, they will often include new trigger options that the base atom did not include earlier. A full list of triggers is in a way infinite because it depends on what's in the scene, where, and what else you have beyond the scene.

But fear not, there's method to the madness here. As you start exploring people's scenes, and you should because that's how you best learn about triggers and implementations, you'll notice patterns for the base and dynamic targets. Those patterns are the key to make your scene triggers and understanding how to find them.


How to learn about what triggers exist and how to use them

Open and explore scenes, break them down, see how things work. This is by far the best way to get acquainted to triggers and how to implement them to make your scene.
There are also plugins that expand the range of VAM's built-in trigger system, like MacGruber's LogicBricks, hazmhox's VAMStory, and many more. Start small, make simple triggers that perform some actions, learn and expand on that.
And the last advice about triggers:
K.I.S.S.!
Keep It Simple, Stupid!
 
Last edited by a moderator:
This guide is incredibly helpful! I especially loved the section about trigger locations—it really clarified a concept I struggled with at first. Understanding that triggers can exist in multiple places, like UI buttons, the Timeline, and even within different atoms where timelines can be placed on multiple atoms, was a game-changer for me.
 
There are also collision triggers. This can make for more interesting game play. For example, you could have a collision trigger set on an invisible empty atom such that when the player enters a room, a welcome message appears, or a character in the game greets them. If you like modding scenes (who, me?), finding all the triggers can be a challenge, because as pointed out, they can be on anything.
 
Status
The first post in this thread is a WikiPost, and can be edited by anyone with the appropriate permissions.
Back
Top Bottom