what should i do with this?

snmiglight

Active Member
Reaction score
3
Help please for damage dealing on spell casting...

i'm making a spell....
an active spell that will deal damage equal to 75%/100%/125%
of caster's damage taken from last 5 seconds plus his (caster's) attack damage...

now i have these codes, but still i can't figure out
how to deal those damage mentioned above

Trigger:
  • Reversal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reversal
    • Actions
      • Set Reversal_Point = (Position of (Triggering unit))
      • Set Reversal_Group = (Units within 225.00 of Reversal_Point matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True))))
      • Custom script: call RemoveLocation(udg_Reversal_Point)
      • Unit Group - Pick every unit in Reversal_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (WHAT TO PUT HERE??) damage of attack type Chaos and damage type Normal
          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup(udg_Reversal_Group)

can someone help me? thanks
 

WindexIsBack

New Member
Reaction score
100
Damage unit (50 + (level of ability x 25))

The ability at level one will do 50 + 25 = 75
The ability at level two will do 50 + 50 = 100
And so on.
 

snmiglight

Active Member
Reaction score
3
thanks... but it's not like that

i want to deal damage equal to caster's received

damage from past five seconds plus another damage

equal to caster's minimum to maximum damage...

um..... is this possible anyway?
 

UndeadDragon

Super Moderator
Reaction score
447
That is possible, but very complex. JASS/vJASS would be almost nessesary to have a readable code for something like this.
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
I really don't get this spell, but check out my method.
First, the triggers:
Trigger:
  • Reversal Init
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reversal
    • Actions
      • Trigger - Add to Reversal TakeDmg <gen> the event (Unit - (Triggering unit) Takes damage)
      • Trigger - Turn off (This trigger)

Trigger:
  • Reversal TakeDmg
    • Events
    • Conditions
    • Actions
      • Set TempReal = (Damage taken)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempReal Greater than 0.00
        • Then - Actions
          • Set ReversalDamageTaken = (ReversalDamageTaken + TempReal)
          • Trigger - Run Reversal DmgExpire <gen> (ignoring conditions)
        • Else - Actions

Trigger:
  • Reversal DmgExpire
    • Events
    • Conditions
    • Actions
      • Custom script: local real dmg = udg_TempReal
      • Wait 5.00 seconds
      • Custom script: set udg_TempReal = dmg
      • Set ReversalDamageTaken = (ReversalDamageTaken - TempReal)

Trigger:
  • Reversal Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reversal
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempUnit2 = (Target unit of ability being cast)
      • Set TempReal = (ReversalDamageTaken x (0.50 + (0.25 x (Real((Level of Reversal for TempUnit))))))
      • Floating Text - Create floating text that reads (|c0000FFFFReversal: |c007EBFF1 + ((String((Integer(TempReal)))) + !|r)) above TempUnit2 with Z offset 0.00, using font size 13.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 128.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
      • Unit - Cause TempUnit to damage TempUnit2, dealing TempReal damage of attack type Spells and damage type Magic


Now, the explanation:
- the frist trigger, when the hero learn Reversal ability, add to trigger Reversal TakeDmg the event trigger unit takes damage. Well, to detect damage taken, of course we have to use that event.
- the second trigger: when the above hero takes damage, increases the "endured damage", then run third trigger. ( "endured damage" is stored in variable ReversalDamageTaken)
- the third trigger: a little jass, local variable real dmg will store the value of the damage the hero just take, 5 seconds after that decreases the "endured damage".
- the fourth trigger: depend on the "endured damage", deal damage to the target. I use a floating text to show the damage deal.

If you are still confusing, see the demo map.
Note: this spell is not MUI. If you want a MUI version, I can make it for you :thup:

P/S: the damage dealt by the spell, it should include the attack damage of the hero, it can be calculated but it takes some times, well, the min damage, max damage of the hero, plus his primary attribute and bonus from items, also buffs, auras :rolleyes:
 

Attachments

  • [Spell] Reversal.w3x
    46.3 KB · Views: 74

snmiglight

Active Member
Reaction score
3
woah! 'tis great...

what about if it is on MUI? can it be written in GUI please?

can you please use hellscream model and use its spin animation

upon casting the skill and inflicting damage on enemy unit group within 225 AOE?

(like counter helix, but active)

something like that, thanks

EDIT: OMG! i don't have WE here T_T
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Here is the MUI version, GUI.

Trigger:
  • Reversal Init
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reversal
      • (Level of Reversal for (Triggering unit)) Equal to 1
    • Actions
      • Set Reversal_InsCount = (Reversal_InsCount + 1)
      • Set Reversal_Caster[Reversal_InsCount] = (Triggering unit)
      • Set Reversal_DamageTaken[Reversal_InsCount] = 0.00
      • Trigger - Add to Reversal TakeDmg <gen> the event (Unit - (Triggering unit) Takes damage)

Trigger:
  • Reversal TakeDmg
    • Events
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempReal = (Damage taken)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempReal Greater than 0.00
        • Then - Actions
          • -------- get the index --------
          • Set TempInt = 0
          • For each (Integer A) from 1 to Reversal_InsCount, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempUnit Equal to Reversal_Caster[(Integer A)]
                • Then - Actions
                  • Set TempInt = (Integer A)
                • Else - Actions
          • -------- --------
          • Set Reversal_DamageTaken[TempInt] = (Reversal_DamageTaken[TempInt] + TempReal)
          • Trigger - Run Reversal DmgExpire <gen> (ignoring conditions)
        • Else - Actions

Trigger:
  • Reversal DmgExpire
    • Events
    • Conditions
    • Actions
      • Custom script: local real dmg = udg_TempReal
      • Custom script: local integer inx = udg_TempInt
      • Wait 5.00 seconds
      • Custom script: set udg_TempReal = dmg
      • Custom script: set udg_TempInt = inx
      • Set Reversal_DamageTaken[TempInt] = (Reversal_DamageTaken[TempInt] - TempReal)

Trigger:
  • Reversal Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reversal
    • Actions
      • Set TempUnit = (Triggering unit)
      • -------- get the index --------
      • Set TempInt = 0
      • For each (Integer A) from 1 to Reversal_InsCount, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempUnit Equal to Reversal_Caster[(Integer A)]
            • Then - Actions
              • Set TempInt = (Integer A)
            • Else - Actions
      • -------- --------
      • Set TempInt2 = (Level of Reversal for TempUnit)
      • Set TempReal = (Reversal_DamageTaken[TempInt] x (0.50 + (0.25 x (Real(TempInt2)))))
      • Set TempReal = (TempReal + (Real((TempInt2 x (Agility of TempUnit (Include bonuses))))))
      • -------- create a floating text to show the "endured damage", you can remove this if you don't want to show the "endured damage". --------
      • Floating Text - Create floating text that reads (|c0000FFFFReversal: |c007EBFF1 + ((String((Integer(TempReal)))) + !|r)) above TempUnit with Z offset 0.00, using font size 13.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 128.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
      • -------- --------
      • Set TempLoc = (Position of TempUnit)
      • Set TempGroup = (Units within 225.00 of TempLoc matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause TempUnit to damage (Picked unit), dealing TempReal damage of attack type Chaos and damage type Normal
      • Custom script: call DestroyGroup( udg_TempGroup )
      • Custom script: call RemoveLocation( udg_TempLoc )


When a hero learn this skill (first level), increase the number of instance (Reversal_InsCount), the store the hero in a variable - Reversal_Caster. When I need the index (the instance number) of a hero, I use a loop, check if the hero is the "Caster" at which instance then I have the index:
Code:
-------- get the index --------
        Set TempInt = 0
        For each (Integer A) from 1 to Reversal_InsCount, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TempUnit Equal to Reversal_Caster[(Integer A)]
                    Then - Actions
                        Set TempInt = (Integer A)
                    Else - Actions
        --------   --------
If I use "Custom Value", it will be faster, but what if you have use it, so I don't use the "Custom Value".

Also, the damage when "spin", I add 1/2/3 times Agility of the hero to it. If he didn't take any damage in the past 5 seconds -> spin with 0 damage -> .... ( I can't think of a right word now :eek: )
----
I'm not good at explaining things, so just see the demo map. :)
 

Attachments

  • [Spell] Reversal MUI.w3x
    48.3 KB · Views: 69

snmiglight

Active Member
Reaction score
3
.... my mind clouds up....

better should i see this in WE

*grabs WE*




EDIT: wow it's perfect!!...

anyway, i got questions.

1. damage expire: as i can see the trigg, the damage stored changes every 5 secs;
can't it be changed every second but still deals damage from past 5 secs?


2. about the bonus damage involving agility... meaning to say if i remove the bonus
damage based on agi... then it will deal 0 damage right if the hero
did not receive damage from the past 5 secs?
can't you just deal damage according to hero's current attack damage
instead of his agility?

(so that reversal's minimum dmg will be his attack dmg.
But if it's too complex stuff... i don't require you to do it; you're
doing me too much favor.)



3. one more thing: what is the default font size/color for floating text?
(as what is shown on critical strikes; i think the color is c00FF0000; size i've got no idea.)


thanks anyways... you really helped me a lot... you deserve a thousand reps...



if it's not for this:
58880995.jpg
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
This is how I image this spell, take a look at the picture:

attachment.php


As you can see, at the moment hero casts spell, at "1", he has already taken damage 4 times ( take dmg 1, 2, 3, 4). So, in the past 5 seconds of "1", the "field" between two vertical lines ( the red and pink) (of "1") involves the "time line" of take dmg 1, 2, 3, 4; therefore, the "endured damage" equal to (damage taken of) take dmg 1 + take dmg 2 + take dmg 3 + take dmg 4

The moment "2", its "field" doesn't involve the "time line" of take dmg 1 and take dmg 2, because they have expired, so the "endured damage" equal to (damage taken of) take dmg 3 + take dmg 4

The moment "3", its "field" doesn't involve any "time line", so "endured damage" is 0

----
that is what I think, but my method is.... wrong :( (I just realized that). The expire of take dmg 3 and take dmg 4 happened before "2" so "endured damage" = 0 :(
----

My new method, I use a real array, about 50 indexes to store the "endured damage". the index number 0 is the index at the moment, index number 1 is the index at the past 0.1s, index number 2 is the index at the past 0.2s,...

when the hero take damage, of course, the "endured damage" at index 0 will be increased, the same as when the damage "expired".
a timer of 0.1 seconds periodically "push" the index (I can't think of a better word) like this: ( 50 indexes, 0 -> 49 )
Code:
49 48 47 46 ..... 03 02 01 00
   49 48 47 46 ..... 03 02 01 00 // index in the past 4.9s now is the index at the past 5.0s,  4.8s -> 4.9s,....

when the hero active the spell, I use a loop and check for these 50 indexes, which one has the biggest amount and use this amount for the spell.

I will not post the trigger.

Again with the demo map with non MUI Reversal.
I will upload the demo map with MUI Reversal later. (the problem which I just realized make my head really hurt :( )

---- For the questions
1. my above explanation has already answer this question, right ?

2. the attack damage, not too complex, only complex :rolleyes:
Attack Damage = (Min damage, Max damage) plus primary attribute + item bonus + buffs

- (Min damage, Max damage) plus primary attribute <- this is easy
- Item Bonus <- depend on your items
- Buffs <- the real problem (it's hard to get their levels).

3. I think its font size is 10

--------
sorry if I have some grammar errors, I'm so sleepy
 

Attachments

  • [Spell] Reversal.w3x
    47.3 KB · Views: 74

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Here is the MUI version.

Each instance use 50 indexes of the "Reversal_DamageTaken" variable, so:
instance 1: 0 -> 49
instance 2: 50 -> 99
instance 3: 100 -> 149
...

So it's possible that you will hit the array limit, so, don't use too much instance (unit)
 

Attachments

  • [Spell] Reversal MUI.w3x
    49.2 KB · Views: 80
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top