Hello Everyone
I am using Spellcasting Package.. Plus I am Using Mana With The Spell Casting Motion Pack
So I have a Question ?
Anyone know how to rig the Magic Missile Mana Spell to the Mana Bar ?
Thank you
So No Comments wow
No one knows
Hey Jody,
The Mana Bar is typically a user interface image. It grows and shrinks because you tell it what percentage or number the mana value currently is.
https://weeklyhow.com/how-to-make-a-health-bar-in-unity/
I explain how to get the mana value in this post:
https://ootii.com/knowledge-base/mana/
I also explain how to use the mana value in spells.
If you mean only allow the Magic Missile Mana Spell to cast if there mana, I show that in the post above.
I’ve added the “Test Mana” node to see if we have enough mana. So, I add a “Test Attribute Int” node and renamed it. As you can imagine, the attribute we’ll test is if the “Mana” attribute is >= 10.
If you mean take mana away from the mana pool when the spell is cast, that's shown in the post too.
If the “Test Mana” node succeeds, we need to reduce the Mana attribute by 10 since we’re casting the spell. We do that with the “Set Attribute” node that I renamed.
So, I’m not sure what you mean by “rig the Magic Missile Mana Spell to the Mana Bar”. If you can be more specific, I’ll try to help more.
Thanks,
Tim
Hello all
Will its been 3 Months and still no answer to my Question - My Question it how do I link my Mana Bar to my Spells so when I fire off a Spell it redoes the
amount of Mana I have
PS Is Tim doing ok I haven't Heard from him
@solarmanjc I would probably take the approach of basing your spells off of a custom class that inherits from Spell. You would define the mana cost of the spell in that custom class. You would then build a custom component which inherits from SpellInventory, which would contain all of the logic for checking if the caster has sufficient mana before proceeding with casting the spell. I think that this would ultimately be a lot less working that building that logic in every single spell's node editor.
There is a Player HUD prefab under Assets/MotionController/Content/Resources/UI that provides a workable example for hooking up to a spell bar (you could even re-use this prefab and just change the color and attribute name that it checks). It uses a Basic Combatant HUD component, which listens for changes on a specific attribute and then updates the UI graphic.
Hey Chris
Will I am using ootii spell casting Package ... I am just trying to tie the Spell casting to my Mana bar so when I cast a spell that my Mana bar goes down
any Help would be Awesome
Thanks
Jody
Hey @solarmanjc,
I looked at your pictures above and they seemed right, but I could have missed something simple. Can you zip up your project and email it to tim@ootii.com? That's probably the best way for me to see what's different between what I did and you did.
Following my "Using Mana with Spell Casting Motion Pack" should have worked. It does for me, but there may be something small that I didn't call out.
Hey @solarmanjc,
The issue is that you didn't put the "Compare Start Node State" link action back. When you redirected the link from "Spawn Particle" to "Test Mana", the link action wasn't added.
The "Test Attribute Exists" node check is the attribute "NPC" exists. If it does, the node results in a "success" and follows the left path. If not, the node results in a "failure".
Without a link action, that "failure" stops the tree from being traversed.
By adding the "Compare Start Node State" link action and setting the node state to "Failed", we're saying it's ok for the previous node to result in a failure... in fact, we expect it. Now the tree traversal continues.
With that, I got your mana messages.
Side node: I used the "Utility - Debug" node to write my own text to see where the tree was failing.
You should be good from there.
Hey Tim
Thank you every much 😀
So the Big question is how do I link the Spell casting to my Dragon Mana Sphere ?
I am not a Programmer.. I am a 3D Graphics Artist
Anyways Thank you again for the Help
solarmanJc
So, it really depends on your Dragon Mana Sphere.
Now that the code for the Mana value change is working, you need to use that to set the value on the mana sphere. Just like you printed out "mana from x to y", that "y" value needs to get to the mana sphere. Of course, that depends on the mana sphere asset. I'm assuming they use code something like this:
DragonSphereGameObject.ManaValue = lMessage.Attribute.GetValue<int>();
Notice how that last part (in orange) is the code we use to "get the integer value".
Unfortunately, I don't own the mana sphere asset. So, you'll have to look in their directions to determine what the left side of the statement looks like.