Skip to main content

Chain Hook

Pulls the player toward enemies.

Pressing the attack button again after connecting performs either a Punch or a Kick, depending on the distance to the target.

Punch slightly knocks enemies back.

Kick launches enemies into the air, causing them to take fall damage when they land.

Implementation​

As you might expect, this is a multi-state skill with states such as Hook, Pull, Kick, and Punch.

When the Hook attack collides with an enemy, we use an Effect Pack to send the hook data to ourselves.

HookToActor — Effect Pack
Effect Pack: HookToActor
Linker Effect (BS): LinkHookGrapPositionToTargetPosition
Target Stat:ChainHook / Vector3 / HookGrapPosition
Processor:Linker
Apply Type:Temporary
Int Stat Effect (BS): IncreaseEvolutionNo_1
Target Stat:ChainHook / IntClamped / SkillEvolutionNo
Value:1
Int Stat Effect (BS): Hooked
Target Stat:ChainHook / IntClamped / Hooked
Value:1
Processor:Add_Int
Apply Type:Temporary

At the start of the pulling state, we use a Linker to copy the enemy's position to the GrapPosition Stat. This Stat is updated whenever the enemy moves.

The Tweener Stat then uses the Start and GrapPosition Stats to interpolate the player's position toward the enemy.

HookPullTween — Stat (Tweener Vector3)
Stat (Tweener Vector3): HookPullTween
Stat Key:ChainHook / Tween_Vector3 / HookPullTween
Default:0.5
Permanent Effects Consume Modifiers First:true
Consume From Oldest:true
Max:0.5
Togglable:true
Toggle Stat Key:Hooked
Toggle On Value Type:On Positive
Ease:In Quad
Effect Template:HookPullTweenTemplate

We also set the Hooked flag to true.

A StateBasedTrigger Stat listens for the Hooked flag and starts the pull tween when the flag is enabled.

TriggerHookedEffects — Stat (StateBasedEffect)
Stat (StateBasedEffect): TriggerHookedEffects
Stat Key:ChainHook / StateBasedEffect / TriggerHookedEffects
Single Stat Checker › Condition:Is1(Int)
Default: TriggerHookedEffects
Tween Effect Model BS Vector3: HookPullTween
Target Stat:ChainHook / Tween_Vector3 / HookPullTween
Processor:Tween_Vector3
Int Stat Effect (BS): MovementBlock
Target Stat:Movement / IntClamped / MovementBlocker
Value:1
Processor:Add_Int
Apply Type:Temporary

We also have a ConditionalModifier assigned to SkillEvolutionNo.

ChainHook_EvolutionNo — Stat (Clamped Int)
Stat (Clamped Int): ChainHook_EvolutionNo
Stat Key:ChainHook / IntClamped / SkillEvolutionNo
Max:4

This modifier checks the distance to the closest enemy and determines which state should be activated next.

If the distance check passes, the modifier adds the result to the incoming Effect value. This effectively skips the Punch state at index 3 and activates the Kick state at index 4.

ConditionalEvolutionNoModifier — Stat (ConditionalModifier Float)
Stat (ConditionalModifier Float): ConditionalEvolutionNoModifier
Stat Key:ScrapTossers / ConditionalModifier / ConditionalEvolutionNoModifier
Default:1
Max:1
Single Stat Checker › Condition:NoEnemyInSight

The closest enemy is set when we toggle off the Pull state by pressing the skill button again.

ToggleOff_2 — Effect Pack
Effect Pack: ToggleOff_2
Modifier Remover Effect (BS): RemoveCastingBlock_ToggleOff
Target Stat:Default / IntClamped / SkillCastingOnProgress_
Processor:ModifierRemover
Float Stat Effect (BS): SetClosestEnemyDistance_2
Target Stat:ChainHook / Float_EdgeValue / ClosestEnemyInSightDistance
Processor:Set_Float
Apply Type:Temporary
Modifier Remover Effect (BS): RemoveHookedModifiers_State_2
Target Stat:ChainHook / IntClamped / Hooked
Processor:ModifierRemover
Injector Remover Effect (BS): RemoveHookGrapPositionInjectors_State_2
Target Stat:ChainHook / Vector3 / HookGrapPosition
Processor:InjectorRemover
Conditional Effect Model: IncreaseEvolutionNo_2_Conditional

The closest enemy is then assigned using the following Effect:

SetClosestEnemyDistance_2 — Float Stat Effect (BS)
Float Stat Effect (BS): SetClosestEnemyDistance_2
Processor Id:Set_Float
Attributes:Everything
Apply Type:Temporary
Target Stat:ClosestEnemyInSightDistance
Use Stat Value:true
Value Stat › Actor:Custom
Value Stat › Custom Actor:ClosestInSight
Use Value Adapter:true
Value Adapter:StatValueAdapter_DistanceBetweenSource