Companion System

v2.0.0

GC2 Integration

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

InstructionDescriptionParameters
Summon CompanionSpawn a companion from a CompanionDefinitionDefinition, Position (optional), Owner
Recall CompanionRemove a companion from the sceneTarget Companion, VFX Delay (optional)
Companion WaitTransition companion to the Waiting stateTarget Companion
Companion FollowReturn companion to the Following stateTarget Companion
Issue CommandExecute a command on a specific companionTarget Companion, Command (SO reference)
Complete CommandMark the current command as complete (call from within command trigger)Target Companion
Change Companion OwnerReassign the companion to follow a different ownerTarget Companion, New Owner
Teleport Companion to OwnerInstantly move companion to owner positionTarget Companion
Store CompanionMove companion to persistent storageTarget Companion
Retrieve From StorageSpawn a stored companion back into the sceneDefinition, Position, Owner
Toggle Path VisualizerShow or hide the debug path gizmo for a companionTarget Companion, Enabled

Group Commands

Group instructions operate on all active companions simultaneously.

InstructionDescriptionParameters
Group Set StateSet all active companions to the same stateState (Following/Waiting/Idle)
Group Send CommandSend a command to all companions — companions that don't support it are skippedCommand (SO reference)
Group Set FormationChange formation type for all companionsFormation (Line / V-Shape / Circle)
Recall All CompanionsRecall 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.

NameDescription
Has Active CompanionTrue if at least one companion is currently active in the scene
Is Companion ActiveTrue if a specific CompanionDefinition is currently summoned
Active Companion CountCompare the number of active companions against a value (supports >, <, >=, <=, ==)
Can Summon MoreTrue if the active companion count is below the configured max
Storage ContainsTrue if a specific CompanionDefinition is in persistent storage
Companion In StateTrue if a specific companion is in a given state (Following/Waiting/Idle/Commanded)
Any Companion In StateTrue if any active companion matches the specified state
Is Companion IdleTrue if companion state is Idle
Is Companion MovingTrue if companion motor reports active movement
Is Visiting POITrue if companion is currently navigating to an interest point
Companion In RangeTrue if companion is within a given distance of its owner
Proximity StateTrue if companion proximity matches Beside / Near / Far (maps to FollowProfile radius tiers)
Is Owner StationaryTrue if the owner has not moved for the configured idle threshold
Has Active CommandTrue 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.

NameDescription
On Companion SummonedFires when a companion is summoned — optionally filter by Definition
On Companion RecalledFires when a companion is recalled — optionally filter by Definition
On Companion StoredFires when a companion is moved to storage
On Command ReceivedFires when a companion receives an Issue Command instruction — filter by Command SO
On Command CompletedFires when Complete Command is called — filter by Command SO to distinguish commands
On State ChangedFires when any companion transitions state — optionally filter by companion or target state
On Companion StuckFires when a companion's stuck detection triggers
On Companion Stuck RecoveredFires when a companion successfully recovers from a stuck state
On Proximity ChangedFires 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.
Instructions
InstructionDescriptionParameters
Modify BondAdd or subtract bond points from a companionTarget Companion, Amount (positive = add, negative = remove)
Set Bond LevelSet the companion's bond to an exact valueTarget Companion, Value
Conditions
NameDescription
Bond TierTrue if the companion's bond tier is at or above the specified threshold (Stranger / Familiar / Loyal / Bonded)
Compare Bond LevelCompare the companion's bond level against a value using >, <, >=, <= operators
Events
NameDescription
On Bond Tier ChangedFires 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
InstructionDescriptionParameters
Damage CompanionDeal damage to a companion's healthTarget Companion, Amount, Source (optional)
Heal CompanionRestore a companion's health by a flat amountTarget Companion, Amount, Source (optional)
Set Companion HealthSet health directly by value, percent, or fill to maximumTarget Companion, Mode (Value / Percent / Full), Amount
Kill CompanionInstantly kill a companion — triggers death state and OnCompanionDeath eventTarget Companion
Revive CompanionRevive a dead companion, restoring health to a given percentTarget Companion, Health Percent
Set InvulnerableEnable or disable damage immunity on a companionTarget Companion, Enabled
Spend ResourceDeduct from a companion's Mana / Energy / Stamina / RageTarget Companion, Amount
Restore ResourceReplenish a companion's resource by an amountTarget Companion, Amount
Conditions
NameDescription
Companion HealthCompare companion health as a flat value or percent using >, <, >=, <= operators
Companion Is DeadTrue if the companion's health is zero
Companion Is AliveTrue if the companion has health greater than zero
Companion In CombatTrue if the companion has taken or dealt damage recently (combat timeout per VitalsProfile)
Has ResourceTrue if the companion has at least the specified amount of its resource
Events
NameDescription
On Companion DamagedFires when a companion takes damage — provides damage amount and source
On Companion HealedFires when a companion is healed — provides heal amount and source
On Companion DeathFires when a companion's health reaches zero
On Companion RevivedFires 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

  1. Event: On Key Press (GC2 native)
  2. Condition: Can Use Ability — slot 0, Target Companion
  3. Instruction: Use Ability — slot 0, current target
Instructions
InstructionDescriptionParameters
Use AbilityActivate an ability slot on a companion — validates bond tier, cooldown, and resourceTarget Companion, Slot (0–7), Target
Set AbilityAssign a CompanionAbility to a specific slot at runtimeTarget Companion, Slot (0–7), Ability (SO reference)
Reset CooldownsClear all active cooldowns on a companionTarget Companion
Cancel CastInterrupt an in-progress cast without triggering effectsTarget Companion
Conditions
NameDescription
Ability On CooldownTrue if a specific ability slot is currently on cooldown
Can Use AbilityTrue if the ability slot passes all validation checks (cooldown, resource, bond tier, range)
Is CastingTrue if a companion is currently in a cast animation
Events
NameDescription
On Ability UsedFires 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
InstructionDescriptionParameters
Assign TraitAdd a specific CompanionTrait to a companionTarget Companion, Trait (SO reference)
Remove TraitRemove a specific trait from a companionTarget Companion, Trait (SO reference)
Assign Random TraitPick a trait by weighted rarity from a TraitPool and assign itTarget Companion, TraitPool (SO reference)
Clear All TraitsRemove every trait from a companionTarget Companion
Conditions
NameDescription
Has TraitTrue if the companion has a specific trait assigned
Can Add TraitTrue if the trait passes all requirement checks (bond tier, incompatibility, required trait)
Trait CountCompare the number of assigned traits against a value
Events
NameDescription
On Trait AssignedFires when a trait is successfully added to a companion — provides trait reference
On Trait RemovedFires 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)

  1. Event: On Mouse Down on an object with Targetable
  2. Instruction: Set Target — Target Companion, this GameObject
  3. Optionally follow with Use Ability to auto-attack
Instructions
InstructionDescriptionParameters
Set TargetAssign a specific GameObject as the companion's current targetTarget Companion, Target GameObject
Clear TargetRemove the companion's current targetTarget Companion
Target NearestAutomatically target the nearest Targetable in range matching a faction filterTarget Companion, Faction (Player / Enemy / Neutral / Any), Range
Cycle TargetsAdvance to the next valid Targetable in the scene (same filtering as Target Nearest)Target Companion, Faction Filter
Conditions
NameDescription
Has TargetTrue if the companion has an active target assigned
Target Type IsTrue if the current target's Targetable faction matches the specified type
Target In RangeTrue if the current target is within a given distance of the companion
Events
NameDescription
On Target ChangedFires 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.