Spell Component Overview
Last updated
Last updated
This component provides a lot of functions that enables a spell to be cast correctly and
The only thing there is a reference to the player, this is done with an interface
the only components we are getting from the player are the mesh movement component and other spell components, if you want to use it on other characters as well you technically can also just use "Get Owner -> Cast to Character"
Listens for player input, then calls these Macros and Functions
When adding a spell you assign it to a certain index in a Map, when pressing a button 1-4 we set it in the spell system then it can read the correct data.
A collection of RPC's to make sure all clients are in sync and see the same result
Changes the combat state and notifies animation blueprint to switch animations, it also takes care of rotating the controlled character towards the camera, it also rotates the Character towards any locked in target from the "Targeting Component"
The main function of this component. It reads the data from the data table and saves it, afterwards spawning and attaching is being done with optional offsets. The call for casting a spell comes from the matching animation notifier "Cast Spell".
Add Spell
Adds a spell to the specified index, after that it checks for the UI component and displays the spell to the correct key
Remove Spell
Removes a spell from a specified slot, signals the UI components if available to remove it from the HUD
Initiate Spell
Pre-checks if even able to cast spells, also cancels active animations to prepare for the next spell casting animation which triggers "Cast Spell"
Cancel Montages
Looks for active montages and stops them
Set Widget Spell Index
Fires event dispatcher to notify subscribed components that the index has changed
Get Fire Direction
Either provide the camera direction or the player facing direction or none if wished
Clean Up Spell
Triggers the self-destruction of the spell with a given delay, then invalidates the reference to it in the Spell component
Check If has enough mana
If available, gets data from stats component and checks if we are allowed to cast the spell
Check If can init spell
Does several checks if the spell can be cast
Set Spell Location Camera Auto Aim
Traces from the camera and check for valid surfaces, it has several fail saves if no surface is available. Afterwards it snaps the spell to the closest target near the casting location
Set Spell Location Camera
The same as above but without the snapping. Checks for valid surfaces and cast the spell there
Switch On Spell Type
Set in the Data Table, it defines how the button press casts the spell, Either Instantly which just requires a single button press or Hold and release which requires holding the button and on release it stops casting
End Current Montage
Checks if the spell is a Hold and release button type and stops it then if the button is released
Allow Spell Casting
This is set by an animation notifier which blocks the input for casting a spell to make sure there are no interruptions while casting the spell