SPAM Framework Documentation

Adding and removing conditions

img/add-condition-effectpng

To add conditions to a target, it needs both an Ability target- and an Ability Conditions Target-component. Conditions are added and removed with either an Ability effect (
AddCondition, seen above, and RemoveCondition) or through code.

Adding a condition will apply its secondary effects which are set to fire on the added-event, and removing them will apply effects which are set to fire on the removed-event (see Condition settings for more info about events). This can make for some powerful and interesting conditions, since you could make a damage-over-time condition (ticked damage effect) that should not be removed since that will trigger f.eg. massive damage, forcing the player to decide if it's better to let it run to its end to spread out the damage over time, or to remove it and apply lots of damage at once.

Conditions without casting abilities

Conditions can be added and removed outside of abilities.
You can add a condition to a target by calling AddCondition(condition), and remove it by calling RemoveCondition(condition) on it's Ability Conditions Target-component.
This opens up a lot of possibilities since the world, equipment, actions etc. could add and remove conditions to a character. Below is an example of a small component that set a target to be in a "wet" state when entering an area where it rains.
Other systems in your game could react to these changes in character conditions (or interact with conditions directly) to create very interesting mechanics along with emergent gameplay.

  public class WetZone : MonoBehaviour 
    {
        [SerializeField] private AbilityConditionSO _wetCondition;  

        private void OnTriggerEnter(Collider other)  
        {  
            if (!other.TryGetComponent<AbilityConditionsTarget>(out var target)) return;  
            target.AddCondition(_wetCondition,0, null);  
        }  

        private void OnTriggerExit(Collider other)  
        {  
            if (!other.TryGetComponent<AbilityConditionsTarget>(out var target)) return;  
            target.RemoveCondition(_wetCondition);  
        }
    }

Backlinks: