Instructions, Conditions, Events, and Persistence for GC2 visual scripting
All CPS operations are accessible through Game Creator 2's visual scripting system. Instructions, Conditions, and Events appear under the Companion System category in the GC2 node picker. No code required.
Instructions
Single Companion
Instruction
Description
Parameters
Summon Companion
Spawn a companion from a CompanionDefinition
Definition, Position (optional), Owner
Recall Companion
Remove a companion from the scene
Target Companion, VFX Delay (optional)
Companion Wait
Transition companion to the Waiting state
Target Companion
Companion Follow
Return companion to the Following state
Target Companion
Issue Command
Execute a command on a specific companion
Target Companion, Command (SO reference)
Complete Command
Mark the current command as complete (call from within command trigger)
Target Companion
Change Companion Owner
Reassign the companion to follow a different owner
Target Companion, New Owner
Teleport Companion to Owner
Instantly move companion to owner position
Target Companion
Store Companion
Move companion to persistent storage
Target Companion
Retrieve From Storage
Spawn a stored companion back into the scene
Definition, Position, Owner
Toggle Path Visualizer
Show or hide the debug path gizmo for a companion
Target Companion, Enabled
Group Commands
Group instructions operate on all active companions simultaneously.
Instruction
Description
Parameters
Group Set State
Set all active companions to the same state
State (Following/Waiting/Idle)
Group Send Command
Send a command to all companions — companions that don't support it are skipped
Command (SO reference)
Group Set Formation
Change formation type for all companions
Formation (Line / V-Shape / Circle)
Recall All Companions
Recall every active companion simultaneously
—
Naming Convention: CPS instructions are prefixed with the companion context to avoid confusion with GC2's native instructions. For example, "Companion Follow" is distinct from GC2's built-in follow actions.
Conditions
Core conditions cover party membership, companion state, proximity, and commands. System-specific conditions (Vitals, Abilities, Traits, Targeting, Bonding) are in their own sections below.
Name
Description
Has Active Companion
True if at least one companion is currently active in the scene
Is Companion Active
True if a specific CompanionDefinition is currently summoned
Active Companion Count
Compare the number of active companions against a value (supports >, <, >=, <=, ==)
Can Summon More
True if the active companion count is below the configured max
Storage Contains
True if a specific CompanionDefinition is in persistent storage
Companion In State
True if a specific companion is in a given state (Following/Waiting/Idle/Commanded)
Any Companion In State
True if any active companion matches the specified state
Is Companion Idle
True if companion state is Idle
Is Companion Moving
True if companion motor reports active movement
Is Visiting POI
True if companion is currently navigating to an interest point
Companion In Range
True if companion is within a given distance of its owner
Proximity State
True if companion proximity matches Beside / Near / Far (maps to FollowProfile radius tiers)
Is Owner Stationary
True if the owner has not moved for the configured idle threshold
Has Active Command
True if companion is currently executing a command
Events
Core companion lifecycle events. Use these to drive dialogue, UI updates, VFX, and game logic. System-specific events (Vitals, Abilities, etc.) are in their own sections below.
Name
Description
On Companion Summoned
Fires when a companion is summoned — optionally filter by Definition
On Companion Recalled
Fires when a companion is recalled — optionally filter by Definition
On Companion Stored
Fires when a companion is moved to storage
On Command Received
Fires when a companion receives an Issue Command instruction — filter by Command SO
On Command Completed
Fires when Complete Command is called — filter by Command SO to distinguish commands
On State Changed
Fires when any companion transitions state — optionally filter by companion or target state
On Companion Stuck
Fires when a companion's stuck detection triggers
On Companion Stuck Recovered
Fires when a companion successfully recovers from a stuck state
On Proximity Changed
Fires when a companion crosses a proximity tier boundary (Beside → Near → Far) — AnyState flag fires on all transitions
Inspector Events: CompanionBrain also exposes UnityEvents in the Inspector (Events foldout) for per-companion event wiring without visual scripting.
Bonding Nodes
Bonding nodes let you read and modify the relationship between owner and companion. Bond grows passively via proximity and actively via commands, POI visits, and these instructions. The four tiers — Stranger → Familiar → Loyal → Bonded — gate abilities, traits, reactions, and dialogue.
On Bond Tier Changed is the key hook for progression systems: play a cutscene, unlock a new ability slot, or write a journal entry when the player's companion reaches Bonded.
True if the companion's bond tier is at or above the specified threshold (Stranger / Familiar / Loyal / Bonded)
Compare Bond Level
Compare the companion's bond level against a value using >, <, >=, <= operators
Events
Name
Description
On Bond Tier Changed
Fires when a companion advances to a new bond tier — use this to unlock dialogue, abilities, or cutscenes
Vitals Nodes
Vitals nodes give full control over companion health and resources through visual scripting. CPS's vitals system is standalone — it does not require GC2 Stats. Use these for combat, traps, healing spells, death sequences, and resource management.
Death Behavior: When a companion dies (health reaches zero), CompanionBrain automatically transitions to the Recalled state. Use Revive Companion to bring it back — this also sets the state back to Following.
Instructions
Instruction
Description
Parameters
Damage Companion
Deal damage to a companion's health
Target Companion, Amount, Source (optional)
Heal Companion
Restore a companion's health by a flat amount
Target Companion, Amount, Source (optional)
Set Companion Health
Set health directly by value, percent, or fill to maximum
Instantly kill a companion — triggers death state and OnCompanionDeath event
Target Companion
Revive Companion
Revive a dead companion, restoring health to a given percent
Target Companion, Health Percent
Set Invulnerable
Enable or disable damage immunity on a companion
Target Companion, Enabled
Spend Resource
Deduct from a companion's Mana / Energy / Stamina / Rage
Target Companion, Amount
Restore Resource
Replenish a companion's resource by an amount
Target Companion, Amount
Conditions
Name
Description
Companion Health
Compare companion health as a flat value or percent using >, <, >=, <= operators
Companion Is Dead
True if the companion's health is zero
Companion Is Alive
True if the companion has health greater than zero
Companion In Combat
True if the companion has taken or dealt damage recently (combat timeout per VitalsProfile)
Has Resource
True if the companion has at least the specified amount of its resource
Events
Name
Description
On Companion Damaged
Fires when a companion takes damage — provides damage amount and source
On Companion Healed
Fires when a companion is healed — provides heal amount and source
On Companion Death
Fires when a companion's health reaches zero
On Companion Revived
Fires when a dead companion is revived via Revive Companion instruction
Ability Nodes
Ability nodes let you trigger and manage the companion's 8 ability slots from visual scripting. Each Use Ability call automatically validates cooldown, resource cost, bond tier requirement, and range before executing — you don't need to check conditions manually unless you want early exits.
Typical Ability Trigger Flow
Event: On Key Press (GC2 native)
Condition: Can Use Ability — slot 0, Target Companion
Instruction: Use Ability — slot 0, current target
Instructions
Instruction
Description
Parameters
Use Ability
Activate an ability slot on a companion — validates bond tier, cooldown, and resource
Target Companion, Slot (0–7), Target
Set Ability
Assign a CompanionAbility to a specific slot at runtime
Interrupt an in-progress cast without triggering effects
Target Companion
Conditions
Name
Description
Ability On Cooldown
True if a specific ability slot is currently on cooldown
Can Use Ability
True if the ability slot passes all validation checks (cooldown, resource, bond tier, range)
Is Casting
True if a companion is currently in a cast animation
Events
Name
Description
On Ability Used
Fires when a companion activates an ability — provides companion reference and ability SO
Trait Nodes
Trait nodes let you build loot-style trait assignment, class progression, and random companion generation without code. Use Assign Random Trait with a TraitPool ScriptableObject to pull a weighted random trait from a rarity-weighted list.
Incompatibility & Requirements:Can Add Trait checks MinBondTier, IncompatibleTraits, and RequiredTrait automatically. Always run this condition before assigning to prevent invalid combinations.
Instructions
Instruction
Description
Parameters
Assign Trait
Add a specific CompanionTrait to a companion
Target Companion, Trait (SO reference)
Remove Trait
Remove a specific trait from a companion
Target Companion, Trait (SO reference)
Assign Random Trait
Pick a trait by weighted rarity from a TraitPool and assign it
Target Companion, TraitPool (SO reference)
Clear All Traits
Remove every trait from a companion
Target Companion
Conditions
Name
Description
Has Trait
True if the companion has a specific trait assigned
Can Add Trait
True if the trait passes all requirement checks (bond tier, incompatibility, required trait)
Trait Count
Compare the number of assigned traits against a value
Events
Name
Description
On Trait Assigned
Fires when a trait is successfully added to a companion — provides trait reference
On Trait Removed
Fires when a trait is removed from a companion
Target Nodes
Target nodes drive the companion's targeting system — useful for click-to-target UI, tab-cycling, and AI-driven target acquisition. Any GameObject with a Targetable component is eligible. Target Nearest uses the faction filter to ignore allies or enemies as needed.
Click-to-Target Setup (GC2)
Event: On Mouse Down on an object with Targetable
Instruction: Set Target — Target Companion, this GameObject
Optionally follow with Use Ability to auto-attack
Instructions
Instruction
Description
Parameters
Set Target
Assign a specific GameObject as the companion's current target
Target Companion, Target GameObject
Clear Target
Remove the companion's current target
Target Companion
Target Nearest
Automatically target the nearest Targetable in range matching a faction filter
Advance to the next valid Targetable in the scene (same filtering as Target Nearest)
Target Companion, Faction Filter
Conditions
Name
Description
Has Target
True if the companion has an active target assigned
Target Type Is
True if the current target's Targetable faction matches the specified type
Target In Range
True if the current target is within a given distance of the companion
Events
Name
Description
On Target Changed
Fires when the companion acquires or loses a target — fires with null when cleared
Persistence (Remember)
CPS integrates with GC2's Remember system for save/load. Add theCompanionRemember component to your CompanionManager GameObject — no further configuration is required.
What Gets Saved
Active companions: definition, bond level and tier, active traits, command cooldowns, current state
Stored companions: full CompanionData including last state and bond level
Vitals: current health, resource, and in-combat flag
Active companions are re-summoned at the owner's position on load
State Restore Logic
Transient states are mapped to sensible defaults on load:
Following / Waiting → restored as-is
Idle → restored as Following (will auto-idle when owner stops)
Commanded → restored as Following (command context is lost on save)
Recalled → restored as Following (shouldn't be active when saved)
Owner Fallback: If no owner is found at load time (e.g., player hasn't spawned yet), active companions are automatically moved to storage instead of being lost.