To get right to the point; I had used IKilledKEnny's and Chocobo's tutorials to make this and altered it slightly. Everything works perfectly fine except for a slight thing I had added.
I want this certain unit to get mana for doing damage which works fine but the mana doesnt stack. Meaning that when it hits a unit and gets 13 mana and if he hits the unit again and get 18 mana, the units mana will not be 13+18 = 31 but instead replacing the old mana into the new one resulting in 18.
I've tryed everything I can think of so im asking you guys now.![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I want this certain unit to get mana for doing damage which works fine but the mana doesnt stack. Meaning that when it hits a unit and gets 13 mana and if he hits the unit again and get 18 mana, the units mana will not be 13+18 = 31 but instead replacing the old mana into the new one resulting in 18.
I've tryed everything I can think of so im asking you guys now.
Code:
Init Dmg Detect
Events
Map initialization
Unit - A unit enters (Entire map)
Conditions
Actions
Set TempInt = (TempInt + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempInt Equal to 1
Then - Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
Loop - Actions
Player - Disable Passives -Warrior- for (Owner of (Picked unit))
Trigger - Add to Show Damages <gen> the event (Unit - (Picked unit) Takes damage)
Else - Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Show Damages
Events
Conditions
Actions
Set TempLoc = (Position of (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Damage source) has buff Critical Strike ) Equal to True
Then - Actions
-------- Equipment --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
-------- Specialize --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
Set RandomInt = (Random real number between 2.00 and 2.50)
Set CriticalMultiplier = RandomInt
Set RandomReal = (Random real number between 0.00 and 100.00)
Set CriticalPercentage = ((Real((Agility of (Damage source) (Include bonuses)))) / ((Real((Hero level of (Damage source)))) + CritChance[(Player number of (Owner of (Damage source)))]))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomReal Less than CriticalPercentage
Then - Actions
Set DamageDealt = ((Damage taken) x CriticalMultiplier)
Trigger - Turn off (This trigger)
Unit - Cause (Damage source) to damage (Triggering unit), dealing (DamageDealt - 0.00) damage of attack type Chaos and damage type Universal
Trigger - Turn on (This trigger)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Damage source) has buff Rage ) Equal to True
Then - Actions
Set RageConvers = (((Real((Level of (Damage source)))) x (Real((Level of (Triggering unit))))) / 2.00)
Set RageRegainHit = (DamageDealt / RageConvers)
Unit - Set mana of (Damage source) to (((Mana of (Damage source)) + RageRegainHit) / 4.00)
-------- test --------
Game - Display to (All players) the text: ((String(((RageRegainHit x 1.00) / 4.00))) + Crit)
Else - Actions
Do nothing
Floating Text - Create floating text that reads ((TempColor[(Player number of (Owner of (Damage source)))] + (String((Integer(DamageDealt))))) + !) above (Triggering unit) with Z offset (Random real number between -30.00 and 30.00), using font size 9.20, color (90.00%, 90.00%, 90.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 60.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
Set DamageDealt = (Damage taken)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Damage source) has buff Rage ) Equal to True
Then - Actions
Set RageConvers = (((Real((Level of (Damage source)))) x (Real((Level of (Triggering unit))))) / 2.00)
Set RageRegainHit = (DamageDealt / RageConvers)
Unit - Set mana of (Damage source) to (((Mana of (Damage source)) + RageRegainHit) / 4.00)
Game - Display to (All players) the text: ((String(((RageRegainHit x 1.00) / 4.00))) + Crit)
Else - Actions
Do nothing
Floating Text - Create floating text that reads ((TempColor[(Player number of (Owner of (Damage source)))] + (String((Integer((Damage taken)))))) + |r) above (Triggering unit) with Z offset (Random real number between -30.00 and 30.00), using font size 8.40, color (90.00%, 90.00%, 90.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 60.00 towards (Random real number between 0.00 and 150.00) degrees
Floating Text - Change the lifespan of (Last created floating text) to 1.80 seconds
Floating Text - Change the fading age of (Last created floating text) to 1.20 seconds