Time for another tutorial

I'm only going to make it very simple, you can expand it to fit your needs. I am going to cover adding new attribute to character which will be used to cast spells and also make spells use it, I'm not going to cover adding this new attribute to your status bar (I might do a status bar tutorial later, but I don't think it's needed).
Note: I did not actually test this tutorial. I am using a bit more complex system that is specific to my game. So if something doesn't work as intended, just tell me and I'll try and fix it.1. Let's add mana to our character
Open DOM Editor: Windows -> DOM Editor
Add new field to the client side. Call it E_manaPoints and make it an integer.
2. Copy it to server.
3. Go to Server DOM, click on your E_manaPoints field and set Destination Field (client) to "E_manaPoints" and set Delta Priority to 1. Also set Change Callback to true (even though it's not changed to that value in the picture).
Note: You should have E_manaPoints instead if TS_powerPoints.4. Now let's add our field to character. Find E_CommonCharacter in client DOM. Add new field and choose E_manaPoints, click the Save button.
5. Do the same for E_CommonCharacter in server DOM and also check the 'R' checkbox (it indicates that this field is going to be replicated), click the Save button. That's it for clicking, it's time to write some code now.
Note: Yours should be named E_manaPoints6. Open E_CommonCharacterClassMethods server script. In the InitCommonChatacter() method, we will need to add an initial value for mana. Modify this
me.E_hitPoints = 100
me.E_isDead = false
to
me.E_hitPoints = 100
me.E_manaPoints = 100
me.E_isDead = false
We also need to add a method that will allow us to modify mana upon casting a spell.
method AdjustMana(manaDelta as Integer, ability as NodeRef of Class E_Ability)
me.E_manaPoints = MiscUtils:Min(me.E_manaPoints + manaDelta, me.E_manaPoints)
.
Find the ApplyDeath method and modify it so character won't have mana when dead. Modify this
me.E_isDead = true
me.E_hitPoints = 0
to
me.E_isDead = true
me.E_hitPoints = 0
me.E_manaPoints = 0
Find ApplyLife method and modify this
me.E_hitPoints = 100
to this
me.E_hitPoints = 100
me.E_manaPoints = 100
Find E_RegenTimer_tick() method and add a new line like this
me.E_manaPoints = MiscUtils:Min(me.E_manaPoints + 10, 100)
Note: In case you already did the "combat tutorial" you might want to have different regeneration values for when the character is in combat and different when out of combat.We're done with this script, so click "Compile" and then "Submit" and close the script.
7. Open server script called E_playerCharacterClassMethods, locate the ProcessXPGain() method and modify this
me.E_hitPoints = 100
to this
me.E_hitPoints = 100
me.E_manaPoints = 100
Compile and Submit the script and close it afterwards.
8. Open server script called E_CharacterCreationSystemClassMethods. Find the HE_CCSCharacterActivated method and modify this
char.E_hitPoints = 100
to this
char.E_hitPoints = 100
char.E_manaPoints = 100
Compile, Submit, Close ...
9. Now we are going to modify the ability scripts so they use mana too. I'm not going to write code for each of those scripts as it's pretty much the same for each of them. Now as abWeaponStrike and abSwipe are kinda basic attacks, we won't modify these (but you can of course, it's up to you).
Open abFireball server script (repeat for abHeal and abRubyFire too)
add function for getting a mana cost
shared function GetManaCost() as Integer
return 50
.
Note: replace 50 with any number you see fit as the cost. Remember we have set 100 as maximum mana, so it would be nice to keep this number lower than that.Now we need to modify ApplyEffects function to look like this
shared function ApplyEffects( owner as NodeRef of Class E_CommonCharacter, target as NodeRef, ability as NodeRef of Class E_Ability )
cost as Integer = GetManaCost()
if (owner.E_manaPoints >= cost)
abEffects:ApplyDirectDamage( owner, target, ability, GetMinDamage(), GetMaxDamage() )
owner.AdjustMana(-cost, ability)
.
.
10. We should have a working mana system now. Just make sure to add a mana gauge to your status bar or otherwise you won't be able to see how much mana you have.