Magic using Mana Attribute

omg_ketchup

New member
I have created a Mana Attribute, and a Magic Item. The Magic Item works properly- it fires a projectile at a target, applies damage, creates particles, etc. All good.

Once I set the Magic Item to use the Mana attribute (selected from the dropdown, not typed in), it works properly UNTIL I have less than the required amount of Mana. In this situation, the animation plays, but the projectile is not instantiated. If I wait, the projectile will fire once the character has enough Mana. If I keep trying to trigger the ability with less than the required amount of Mana, sometimes the animation plays (with no projectile), and sometimes it doesn't. Note- I'm tracking the Mana via a copy of the "Health" healthbar in the UI.

I doubt there's an easy solution here, but what steps could I take to start to debug this? I'd like to avoid directly editing UCC source code if possible, but I certainly don't mind extending it or writing my own components to interact with it.

Also, if this is not the intended behavior and is an actual bug that will be fixed- please let me know so I can stop pulling my hair out.

I would appreciate any insight into how I can resolve this. Thanks in advance!
 
When you say that you are using mana, did you create a new cast action? Or something different?
 
Apologies, I didn't see you had responded until now.

I create a new MagicItem for the character. I create a CastAction to spawn a projectile. I'm including a screenshot of the MagicItem settings inspector, and here's a link to a GIF of the behavior:
You'll notice that when the Mana2 is low (below 25), the character still attempts to cast the spell (plays the animation), but the fireball does not come out on time. Instead, the animation plays, and the fireball comes out when the Mana2 bar reaches 25.
 

Attachments

  • settings.png
    settings.png
    164.5 KB · Views: 15
I'm also having trouble figuring out how to adjust the direction the projectile fires. I can only get it to go forward- I'd like to get 3 fireballs shooting at once, with slight angle offsets on each on to give a bit of a spread. The position offset works, but I can't seem to get the rotation offset to impact anything.
 
I can't reproduce this in the demo scene - I've got the same magic item setup using an attribute, but not seeing the issue of the projectile being spawned later. Do you have anything unexpected happening with your Use item ability? (E.g. it's getting stuck in "active"?)

The Magic Item action doesn't really allow you to set an angle spread on the projectiles spawned, although you can have multiple cast actions with each projectile spawning at an offset. You could instead subclass Magic Projectile and have it slightly randomise its starting direction.
 
I have a similar issue which might be related to this issue.

It appears that the "Character Use Attribute" on Magic Items does not work properly.
It uses all the specified amount of ressources correctly (for example mana) but the check in method "CanStartAbility" in Ability.cs does not take this Character Attribute into account - only the "local" attribute like in the demo scene.
In my usecase this leads to wrong results since the ability will be called even if the required mana is not there.
 
It's true that the Use ability will still get called, but any UsableItem action will be prevented from firing when the attribute is missing, due to a check in UsableItem.CanUseItem.
 
I was actually able to repro the original problem and this has been fixed in the version that was just released.
 
Top