CORE2
GAMEPLAY INSTANCES
CORE2
GAMEPLAY INSTANCES
Gameplay Instances aims to solve one of my big hurdles with Gameplay Effects; the inability to edit “Period” at runtime. (below image)
Question: What if you want to dynamically change the period based on Gameplay Attributes? An example - if you want a poison ability but want to scale how often the poison applies to the character. The base Period might be “0.1” but you might want to add modifiers to equipment that brings it to “0.08” Period time. Or add debuffs that increase this time to 1.0 and then go back to 0.1 once the debuff is removed.
My system solves this.
1) Create a new blueprint. Under “all classes” search for GameplayInstance”
2) Open it up and go to functions, and override the top 3 functions (OnPoolBeginPlay, OnReturnedToPool, OnTickInterval)
OnPoolBeginPlay triggers when you apply a Gameplay Instance to a character. This doesn’t start the ticking though. This is done by Can Tick (below image)
WARNING: NOTHING will happen unless you call this as true. So at minimum, you should be calling CanTick on the OnPoolBeginPlay (as per above).
This allows you to, however, adjust values prior to the ticks actually occurring. Putting this to false during ticking will pause all ticking, but not remove it from the character. Make sure not to accidentally False this node and cause your instance to just remain dormant on a character.
Example Of Modifying prior to Ticking:
In this example, I am increasing the tick frequency prior to ticking, based on a Gameplay Attribute.
This leads into the TickInfo Values found in class defaults. As you notice below, it's an array, allowing multiple effects to be layered under one Gameplay Instance Skill, each being able to be modified separately.
e.g. You could have a spell that heals every 0.5 seconds but damages you every 2 seconds - each applying their own unique gameplay effect. You could modify the damage tick interval using Gameplay Attributes without ever affecting the healing portion of the skill.
PreActionDuration - A beginning delay before any ticking functionality happens. This is basically a delay before “CanTick”
DurationAmount - How long the Instance can last for. Once this duration passes, the Instance will auto finish
TickInterval - The time between each tick. e.g. 1.0 will mean every 1 second, it will trigger the Event OnTickInterval
MaxTickCount - This puts a hard limit on the amount of ticks that can occur. e.g. 5.0 will mean it can only ever tick 5 times. Whichever occurs first (MaxTickCount or DurationAmount) will auto-cancel the instance
TickOnFirstSpawn - unticking this means a tick interval wait time will occur before the first activation. e.g. if tick interval is 5.0 and you have OnFirstSpawn unticked, it will wait 5 seconds before initiating the first Event OntickInterval.
EffectToTrigger - obviously, this is the gameplay effect that it will trigger on every tick. For most cases, this will be an instant effect.
This is triggered each tick, but does not inherently apply the gameplay effect in the TickInstances Array. I have left this as a manual setup as some people might want to create their own spec handle with the effect. Below is a simple version of the setup:
Below is a more complex setup, where we are changing the TickInterval on each tick by a Gameplay Attribute.
(Note: this scales the value as you are changing the array used to tick in the background. You might need to copy this array on the OnPoolBeginPlay to keep a static version of the array)
So when you couple this with the OnPoolBeginPlay modifications before Can Tick, you can completely control the ticks, duration, the amount of ticks that can occur, and also if you want, which gameplay ability activates. This is limitless control over duration based abilities.
This is basically an “On Destroyed” event. This will fire once the Gameplay Instance has finished.
1) add the Instance Manager and Ability System to your character (This requires the Gameplay Ability System)
2) click on the instance manager
3) In the details panel of the Manager, you define the GI that can be applied and the max amount each can be applied to the character. Note: Right now, if your GI is not defined here, it will not be applied to the character. I might change this later, but right now, you MUST define all applied GI’s here.
PooledClass - the Gameplay Instance BP you setup goes in here.
InitialPoolSize - I have made the Gameplay Instances pooled, to help with effects that stack in large amounts, like Poison. The Initial Pool Size is how many do you want in the background, ready to spawn.
MaxActiveCount - What the limit you want to have for a given GI. E.g. if you want a max of 100 Poisons per character, make the max active count 100. It will never exceed that amount.
ReplaceOnceAtMax - This will replace/refresh the oldest GI with a new one, if you try and apply one when you are at MaxActiveCount.
Out of the Instance Manager, call Apply Instance. Into this node, you can select the GI you want to apply, the instigator, as well as an override array. You can use the TickInstances Array to override what you have setup in the GI Blueprint. If you leave it blank, as per below, it will just default to the values you set in the GI.
Summary
This system can be used for just applying damage over time/heal over time effects but you can also use this as an all round system to apply your gameplay effects. You can simply just apply single effects through this too if you wish.
Questions and Answers
Road Map
Adding the functionality to still create instances even if not defined in the Pool Class Array