Convert Attribute to Damage...?

Nyrano

New Member
Reaction score
4
Hi there, I'm in the middle of 'Energized Strike' spell. Drain 10% of your own mana, deal 200% of the mana drained to the enemy plus your intelligence*1/1.5/2/2.5/3.

My current trigger (or at least the start of it):
Trigger:
  • Energized Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Energized Strike (MAGE)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Energized Strike (MAGE) for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Set mana of (Casting unit) to ((Percentage mana of (Casting unit)) - 10.00)%
          • Set EnergizedDmgIntel[1] = (Intelligence of (Casting unit) (Include bonuses))
          • Set EnergizedDmg[1] = ((Percentage mana of (Casting unit)) x 0.10)
          • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) - (EnergizedDmg[1] x 2.00))
        • Else - Actions


I think the 200% of 10% mana drained works fine, but I can only store the attribute intelligence in an integer variable, not in a 'Real' one. And when I'm setting the life of some unit to minus, I can only use Real variables and not the Integer ones. Therefore not being able to use the intelligence as damage factor.

Any solutions? :)
 

Ayanami

칼리
Reaction score
288
I suggest you use "Unit - Damage Target" instead of setting life. By minus-ing life like that, you won't get any gold for killing that unit. And to your question, here's the solution. You can convert an integer to a real. Basically, go to the "Unit - Damage Target" action. Then there should be a function to convert integers to real when you input the damage.
 

Cookiemaster

New Member
Reaction score
36
HOLD ON.

Unit - Set mana of (Casting unit) to ((Percentage mana of (Casting unit)) - 10.00)%
Set EnergizedDmg[1] = ((Percentage mana of (Casting unit)) x 0.10


If a unit had 152/200 mana, then the first action would set it's mana to 76 % - 10.00 = 66%, so you actually drain mana equal to 10% of your MAX mana, not current (as it would sound the way you described it.)

Unit has 132/200 after the drain.

Then, after you drained the mana, you set the variable EnergizedDmg[1] to 10% of the percentage of mana left, to 66% * 0.6 = 6.6

Then you "deal damage" (use the Unit - Damage action for this! Not reduce life! :<) equal to EnergizedDmg[1]*2, which is 13.2 damage.

152-132 = 20 Mana lost.

200% of 20 mana is 40.

Yeah, that's not right.


You should first set a variable of how much mana the unit has, then reduce the mana of the unit.

The variable should be set to either (Mana of unit * 0.9), or (Mana of unit - (Max mana * 0.1)) if you want it to drain 10% of your max mana, rather than your current mana.


Oh, and regarding the real/integer thing, you can just convert integers to reals and visa-versa. (Under "Conversion" or something? look for it, it should be in the list of reals or integers.)
Be wary that integers do not store decimals, can't be negative (AFAIK), and have some limits on them. (Converting the real -5.24 results in integer value 0, converting the real 59.92 results in integer value 59.)
 

Nyrano

New Member
Reaction score
4
It's supposed to be 10% of maximum mana, hehe.

But I've installed the damage unit action, sadly it isn't working.

Where lies the flaw? :]
Trigger:
  • Energized Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Energized Strike (MAGE)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Energized Strike (MAGE) for (Casting unit)) Equal to 1
        • Then - Actions
          • Set ManaPoints[2] = ((Percentage mana of (Casting unit)) x 0.10)
          • Unit - Set mana of (Casting unit) to ((Percentage mana of (Casting unit)) - ManaPoints[2])%
          • Set EnergizedDmgIntel[1] = (Intelligence of (Casting unit) (Include bonuses))
          • Set EnergizedDmg[1] = ManaPoints[2]
          • Set EnergizedDmgIntel[1] = (Integer(EnergizedDmg[2]))
          • Unit - Cause (Casting unit) to damage (Attacked unit), dealing ((EnergizedDmg[1] x 2.00) + (EnergizedDmg[2] x 1.00)) damage of attack type Hero and damage type Magic
        • Else - Actions


EDIT: The ability is based of off Holy Light, dealing 0 damage in the object editor, with only enemies allowed to target. The things that work: draining the caster's mana and it is actually cast... Things that don't work: The damage dealt to the enemy.
 

Archideas

Active Member
Reaction score
32
Well, of course. Change it to this:

Trigger:
  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((EnergizedDmg[1] x 2.00) + (EnergizedDmg[2] x 1.00)) damage of attack type Hero and damage type Magic
 

Cookiemaster

New Member
Reaction score
36
Doublecheck if the casted ability is really level 1.

Otherwise, see if you can deal any damage at all ( Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing (100000.00) damage of attack type Hero and damage type Magic )
 

canons200

New Member
Reaction score
50
well, armor will reduce spell damage. try to make armor 0

if the damage is still not correct, that is the maths problem.
 

Archideas

Active Member
Reaction score
32
Well, if it doesn't deal the EXACT numbers it should, it's probably because some armor types take reduced damage from Magic, like Hero. So you could try setting the attack type to Chaos and damage type to Universal. That way, it should deal 100% to ANY unit.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top