Spell and Damage System

NEW ON MARKETPLACE!

Description

Preview:

The system is designed to be used with any game that needs advanced damage system. This includes RPG games, FPS, MOBA, MMOs … The spell system is built on top of the damage system so you can use either one or both if you want to.

Core features:

  • different spell type templates: projectile, lock-on projectile, direct spell, area of effect, spell following ground, link spell
  • enhanced damage system with very flexible modifiers (buff and debuffs): increase/decrease of damage, healing, critical strike, critical strike chance …
  • modifiers also effect other properties of the actor: speed, casting speed, movement, is it in control …
  • working examples with unique effects: there are over 15 unique game-ready spells and modifiers implemented
  • full support for networked game
  • built so it is easy to setup and prototype
  • data based spell and modifier description so you can load properties from cvs file
    Technical Details

The package contains (without Demo content):

  • Blueprint Library for extended damage system (can be used separately from the spells, only depends on the modifiers)
  • 11 Blueprints
  • 3 Blueprint interfaces
  • 2 Blueprint structures
  • 27 particle effects (explosions are modified Epic’s assets needed for the demo but other are unique), 34 materials and material instances used mostly by particle effects
  • 3 vector fields

Demo example contains working examples of spells where some, but far from all possibilities are used.

REQUEST: how do I implement casting system?

The current version does not include the sample how casting could be implemented. Casting system, in general, is very game specific so this example here might not suit all your needs. For example, can we move while casting, how are casts interrupted (can this happen), are there movement penalties when casting, … Additionally, you should probably implement it in your character blueprint (or have a blueprint component you can attach to all characters that need casting). Here, I give a simple step by step example how to extend your character to implement it (this example will be included in the next update):

  1. Add replicated variables CastFullTime (float), CastCurrentTime (float), IsCasting (bool) and CastSpellID (int or enum) to the ThirdPersonCharacter blueprint (or your character blueprint class)
  2. Create a function StartCast that takes spell ID and cast time. Only call this function on the server! Check if we are currently not casting and in control, and if so, set the cast full time to cast time, spell ID to the input spell ID and IsCasting to true. Also set CastCurrentTime to zero.
  3. On tick on the server only, if we are casting, increment CastCurrentTime by delta time; if it goes above CastFullTime, call the event that handled when the ability. You can do a switch based on the spell ID to route to the correct event.

This should make for a simple casting system. You can easily add more logic later on.

Is it possible to use this system in a turn-based game?

Would love a few tutorials on different types of cast systems and how to execute them with your spells and damage. would def pay more

I have not thought of this possibility but I would say yes. I guess you would use the spell and damage system each turn, and let the animation (that is spell effect and dealing damage) play before allowing the opponent to do his turn.

I will try to include those systems in the next update. I just have to think of a good way to abstract it as I do not want people to have to copy and paste it into their character blueprint. Thanks for the advice though!

First of all thank you for this awesome pack, it is very well documented. But i have a request too, i would love to see a Tutorial on how to implement a Mana system. :slight_smile:

If you are in a hurry, it should be easy to implement something resource like mana directly on the character blueprint by adding a mana variable, set it to replicated and some initial value. Probably you will also need MaxMana variable as well. Then when you cast something that needs mana, you check if you have enough on the server, and only execute the attach if that is true. At the end of the cast (or immediately if instant), also subtract that mana cost from Mana variable.

I will try to include as much of the requested things in the next pack, for now this included casting and resource management. I already did some work on the casting system; it should now be almost as simple as adding a component to the actor to enable him to cast. I will also try to make the system as general as possible to also include mana/rage/other components and allows a fair amount of modification if someone want things done in a different way. This system should be totally independent from the current system so you can built on top of it (just like the spell template system is independent from the damage system).

A new version of Spell and Damage system is on the marketplace. Besides the migration to 4.13, it also includes casting and resource system in a new CastingComponent that you can attach to your actor. This component also manages resources as they are used or generated by spells. The example character and UI fully uses the new system.

The component allows you to start casting spells using StartCast by supplying cast information such as name, time, resources requirement and various other options. Checks for cast errors will first be made (other cast going on, global cooldown not available, not enough resources, …) and if successful, the cast will start. All you need to do is to subscribe to the delegate OnCastSuccessfull to add logic, like spawning a spell from the template. The system currently supports two simultaneous resources (resource 1 and resource 2) that you can use for anything you want, typical examples would be mana/rage + secondary resource like focus if needed by your character. The system also supports global cooldown (usually used so you can’t spam instant/short casts), interrupts, intercept of any other event (interrupted, start cast …), interrupts when moving for spells that enable that, intermediate event during the cast …

Also, the system will be on -15% sale from 16-23 of September!

Hey , I absolutely love your system! I really like the update that added casting and resources to it. Too bad I already bought it, that -15% off would have been nice. But I do not regret buying it for full price at all! It is well worth it! Has excellent Tutorials too! The tutorials are very clear, easy to follow. Only thing I would add to the tutorial system you have, is to have a master tutorial guide that would take you thru your entire tutorial system in a specific order. Also I noticed in the Advanced Casting System tutorial it says to make sure you have covered the Basic Casting System tutorial first, would be nice if there was a link right there to the Basic Casting System tutorial AND would be nice if the name of the Basic Casting System tutorial was actually called “Basic Casting System” instead of “Spell Casting”

Anyways, I highly recommend this system to anyone wanting spells or damage modifiers in their game!!!

Thanks!

I am really happy that you like the system, this gives me additional boosts for expanding the system. Also thank you for the tips, I will correct those Tutorial names and order them, that is something I missed on review. Be sure to give me more ideas on what you would like in the system for the next update!

The item is on sale now for a week!

Thank you for this awesome system !
I’ve successfully implemented it on my top down “shooter”. At this point, I’ve one question : if I want to make a spell that make the owner invisible and one that make the owner immaterial (enemies spells go through him and has no collision with enemies) where and how should I implement this cleanly ?

Hi! Sorry for the late response.

  1. For the first spell to make someone invisible, you will have to make your own logic. I suggest you have a IsStealth boolean on character that signals visibility and additional method, SetStealth that switches between stealth and unstealth mode. Whenever you cast the ability, you will want to call SetStealth(true) and after a delayed time, SetStealth(false). In this method, set the visibility of the character mesh to false (or some other visualization of stealth). You may also want to tweak collision. The reason to also use boolean is to replicate to all clients if you have networked game. Set it to RepNotify and call SetStealth with its value. Also make sure you set the varable after calling SetStealth (or in SetStealth but be aware of recursive calling on the server)

  2. If you want the spell to go through you, implement BPI_ProjectileIgnoreOverlap on the character and pass true whenever you get something that should hit you. Also, if the projectile is lock-on, make sure you remove the lock-on target at that stage otherwise it won’t explode but it will be pinned to you character.

I hope this helps at l

I’m a bit new to unreal, after i kill the actor with the spell system. How do i get rid of the HUD? I’ve tried to hide it, and destroy it. Is there a particular way i should be dealing with removing it upon death? Also apologies if this was covered someplace already.

are there things like:

  • increase block chance to target ally by x%

  • knockdown system

  • way to implement conditions like bleeding, burning (stronger effect), “deep wound” (lowers the max hp by 20% and healing received by 20%)

  • cast bar on enemy and ways to interrupt a skill (interrupt skills)

  • spells based on condition on enemy (for x conditions you get x health regeneration or x mana)

  • spells based on next attack/spell skill used (in next x seconds you lose x amount of mana/health if you use spell/attack)

  • blind condition system (lowers chance to attack by 90%)

  • move speed increase/decrease on skill use or on target ally/enemy cast. same for attack speed

  • spells like lower next attack hit by x amount and heal yourself for x amount

if not, do you play to add a bit more complicated skill systems? I would gladly pay for it!

Hi,

first thanks for so suggestions, I might implement some of them for the next update.

So the system is quite complex as it is and it has some, but not all of the features you requested. The ones not supported, like a block chance, feel maybe too game specific but it should be very trivial to add them to the current system. So I will just enumerate what is in the system and how I would add things that are not in yet:

  1. increase block chance to target ally by x%
    The actual miss/block/parry system could be added to the current system. How I would approach is add additional attribute to modifiers (BlockChance, ParryChance, MissChance) and the same attributes should also be on the SpellData. Then these attributes could be set directly on the spell as well as propagated to the spell via a modifier (i.e. a debuff that decreases your hit chance for x seconds etc). This is currently not (yet) in the system and it might be a good addition, I am just unsure if it is not too MMORPG specific system to implement for everyone.

  2. knockdown system
    While in knock down, this could be handled the same as stuns. Just add IsNotControl to false on a new Modifier KnockedDown and add appropriate animation handlers for that.

  3. way to implement conditions like bleeding, burning (stronger effect), “deep wound” (lowers the max hp by 20% and healing received by 20%)
    Healing and damage modification is supported on modifiers, as well as damage/healing over time. Decreasing maximum hp/healing is something you would probably need to handle on a character in a game specific event. You could, for example, handle this using a modifier by name search: so whenever there is a modifier named “DeepWound” on target, decrease the MaxHealth (in update) and Health accordingly. It is not a generic solution but if you do not have too many “special” modifiers, this works rather nicely.

  4. cast bar on enemy and ways to interrupt a skill (interrupt skills)
    Cast bars (simple version) should work if you attach them on enemies as well as they feed from character (can also be enemy or networked unit). Skill interruption is part of the casting system and should work (there is no test though). Interrupted targets also cannot cast for X seconds if you want. The same is true for silence.

  5. spells based on condition on enemy (for x conditions you get x health regeneration or x mana)

Modifiers can stack so you can easily implement for example HealingOverTime with 10 stacks that regenerates 5*10 health every second.

  1. spells based on next attack/spell skill used (in next x seconds you lose x amount of mana/health if you use spell/attack)

This can be solved with modifiers. So the initial skill should fire and attach a modifier on you. Then the next spell can consume that modifier for an addition effect. Damage to self is not directly supported but you can implement it by overriding the appropriate event in the modifier.

  1. blind condition system (lowers chance to attack by 90%)

Same as 1): you would add those attributes and add a modifier Blind with ChanceToHit to -90

  1. move speed increase/decrease on skill use or on target ally/enemy cast. same for attack speed

The skill use should apply a modifier. This is implemented in the system. For attack speed, you can use Haste.

  1. spells like lower next attack hit by x amount and heal yourself for x amount

Same as 1) and 6)

I might add Dodge/Hit/etc chances to the next release but it would have to wait for a while (maybe even months) because I am busy with other stuff. Everything else should be implementable or is too game specific.

Hi Got your system mate.
Trying to learn how to use and customize. Its seems very complex But i am enjoying it.

I am making a Hack and slash at the moment and learning to write BPs and stuff.
One good way is to see how other people make Blueprint code.
Hope your system works well with my ideas.

Thanks

Jesse

Hi, I am not sure if these are good suggestions or not. But here it goes:

  1. A spell inventory system (that can be either added to a character OR a player controller as I see a need for each) with ability to select a spell loadout (or list of spells bringing to a match each assignable to a key with ability to chain spells with same castingtype) out of all the spells a player owns on that character.

  2. Create ability for different spell casting types. Casting types that I can think of (you have ability for some already):
    A. Single Shot - press the cast button and casts one single spell. (also could create ability to chain multiple spells together with each succeeding input action press)
    B. Burst - press cast button and casts one burst of X amount of a single spell.
    C. Auto - continuously casts a single spell while holding down the cast button
    D. Auto Burst - continuously casts a burst of a single spell.
    E. Press and Hold - think of beam spell or flamethrower casts while button is held down.
    F. Charge cast - This type of cast, you hold the cast button down for x secs then casts upon button release. Think of a fireball that gets charged up then released and the longer it gets charged up the more powerful/bigger the spell is upon release but if you hold it for too long say more than 20 secs then you end up taking damage instead and the spell fizzles out. Between 0-1 sec its extrasmall then between 1-2 secs its small, 2-3 its normal, 3-4 its big, 4-5 its huge!
    G. Press to target an area, then release to cast a spell that comes from the sky. Not sure how to really describe this one, but its how World of Warcraft does its warlock’s Rain of Fire ability.

Note: I am sure I can implement those cast types myself, I just thought you could do it so that more people benefit from it than just me.

  1. Changes to Damage System:

    A. Add Distance Levels to spells. Each DistanceLevel has its own Min and Max Value as well as its own Variance. So that if I had 3 different DistanceLevels then it would also have 3 different Spell Power Variances as well. Note Distance Levels should not be overlapping.
    B. Add ability to change Spell Distance depending on a Player Stat or Character Stat. Not sure if there is an easy way to do that without changing the system.

Awsome system but I still have some questions:

1- how to make my pawn imune to self damage? When i cast a area of effect spell it still hits my character.
2- is there any way to create a cone area of effect spell and tweak the range, angle etc?
3- How do I set the range of a spell? ( by time and death? or there is a way to calculate the physical range? )