• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Need someone good at math.

Status
Not open for further replies.
Level 3
Joined
Aug 4, 2008
Messages
56
Right, I know there is a shorter way to do this so if any math genius can help me much appreciated :grin:

  • Life Link
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Life Link Warlock/Witch 3
    • Actions
      • Set largelvl[(Player number of (Owner of (Casting unit)))] = (Level of Life Link Warlock/Witch 3 for (Casting unit))
      • Unit Group - Pick every unit in (Units within 1000000000.00 of (Position of (Casting unit)) matching ((Picked unit) Equal to (Target unit of ability being cast))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 1
            • Then - Actions
              • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 3.00 damage of attack type Chaos and damage type Normal
              • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 3.00)) else do (Do nothing)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 2
                • Then - Actions
                  • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 4.05 damage of attack type Chaos and damage type Normal
                  • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 4.05)) else do (Do nothing)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 3
                    • Then - Actions
                      • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 5.47 damage of attack type Chaos and damage type Normal
                      • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 5.47)) else do (Do nothing)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 4
                        • Then - Actions
                          • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 7.38 damage of attack type Chaos and damage type Normal
                          • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 7.38)) else do (Do nothing)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 5
                            • Then - Actions
                              • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 9.96 damage of attack type Chaos and damage type Normal
                              • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 9.96)) else do (Do nothing)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 6
                                • Then - Actions
                                  • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 13.45 damage of attack type Chaos and damage type Normal
                                  • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 13.45)) else do (Do nothing)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 7
                                    • Then - Actions
                                      • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 18.16 damage of attack type Chaos and damage type Normal
                                      • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 18.16)) else do (Do nothing)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 8
                                        • Then - Actions
                                          • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 24.52 damage of attack type Chaos and damage type Normal
                                          • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 24.52)) else do (Do nothing)
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 9
                                            • Then - Actions
                                              • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 33.10 damage of attack type Chaos and damage type Normal
                                              • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 33.10)) else do (Do nothing)
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 10
                                                • Then - Actions
                                                  • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 44.68 damage of attack type Chaos and damage type Normal
                                                  • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 44.68)) else do (Do nothing)
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 11
                                                    • Then - Actions
                                                      • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 60.32 damage of attack type Chaos and damage type Normal
                                                      • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 60.32)) else do (Do nothing)
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 12
                                                        • Then - Actions
                                                          • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 81.43 damage of attack type Chaos and damage type Normal
                                                          • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 81.43)) else do (Do nothing)
                                                        • Else - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 13
                                                            • Then - Actions
                                                              • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 109.93 damage of attack type Chaos and damage type Normal
                                                              • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 109.93)) else do (Do nothing)
                                                            • Else - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • (Level of Life Link Warlock/Witch 3 for (Casting unit)) Equal to 14
                                                                • Then - Actions
                                                                  • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing 148.41 damage of attack type Chaos and damage type Normal
                                                                  • If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 148.41)) else do (Do nothing)
                                                                • Else - Actions
          • Unit - Remove (Last created unit) from the game
          • Wait 1.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • largelvl[(Player number of (Owner of (Casting unit)))] Less than or equal to 2
        • Then - Actions
          • Set largelvl[(Player number of (Owner of (Casting unit)))] = 10
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 3
            • Then - Actions
              • Set largelvl[(Player number of (Owner of (Casting unit)))] = 11
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • largelvl[(Player number of (Owner of (Casting unit)))] Less than or equal to 5
                • Then - Actions
                  • Set largelvl[(Player number of (Owner of (Casting unit)))] = 12
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • largelvl[(Player number of (Owner of (Casting unit)))] Less than or equal to 7
                    • Then - Actions
                      • Set largelvl[(Player number of (Owner of (Casting unit)))] = 13
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 8
                        • Then - Actions
                          • Set largelvl[(Player number of (Owner of (Casting unit)))] = 14
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 9
                            • Then - Actions
                              • Set largelvl[(Player number of (Owner of (Casting unit)))] = 15
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • largelvl[(Player number of (Owner of (Casting unit)))] Less than or equal to 11
                                • Then - Actions
                                  • Set largelvl[(Player number of (Owner of (Casting unit)))] = 16
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 12
                                    • Then - Actions
                                      • Set largelvl[(Player number of (Owner of (Casting unit)))] = 17
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 13
                                        • Then - Actions
                                          • Set largelvl[(Player number of (Owner of (Casting unit)))] = 18
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • largelvl[(Player number of (Owner of (Casting unit)))] Equal to 14
                                            • Then - Actions
                                              • Set largelvl[(Player number of (Owner of (Casting unit)))] = 19
                                            • Else - Actions
      • Wait (Real(largelvl[(Player number of (Owner of (Casting unit)))])) seconds
      • Trigger - Turn off (This trigger)
I'm trying to make a DOT (non-channeled) move that damages the target and heals you at the same time.
largelvl is a integer for the 3d move for each character.
 
Level 3
Joined
Aug 4, 2008
Messages
56
Exactly. That's the problem. I'm not that good at math but i know that it is possible to do with loads of Arimethric calculations to make the if then else action be turned into a single action.

Oh and i forgot to mention the damage increase is 35% per level just in case it matters and the duration increase is (supposed to be) 5% per level.
 
Level 13
Joined
Mar 16, 2008
Messages
941
I think you could calculate your damage like this:

  • Set Damage = 3.0
  • For each Integer A from 1 to (Level of Life Link Warlock/Witch 3 for (Casting unit)-1) do
    • Set Damage = Damage x 1.35
  • Unit - Cause (Casting Unit) to damage (Target unit of ability being cast), dealing <Damage> damage of attack type Chaos and damage type Normal
  • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + <Damage>)
Btw its not a dot, your trigger isn't either :S
 
Level 2
Joined
Nov 17, 2008
Messages
4
If there is a fixed rate per level, you can do something like

Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing {initial damage}+{rate}x{level} damage of attack type Chaos and damage type Normal
If ((Percentage life of (Casting unit)) Not equal to 100.00) then do (Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + {initial damage}+{rate}x{level})) else do (Do nothing)

or some kind of formula that fits the damage. if you could briefly explain how you reach your numbers, I could probably write said formula for your trigger.
 
Level 3
Joined
Aug 4, 2008
Messages
56
I think you could calculate your damage like this:

  • Set Damage = 3.0
  • For each Integer A from 1 to (Level of Life Link Warlock/Witch 3 for (Casting unit)-1) do
    • Set Damage = Damage x 1.35
  • Unit - Cause (Casting Unit) to damage (Target unit of ability being cast), dealing <Damage> damage of attack type Chaos and damage type Normal
  • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + <Damage>)
Btw its not a dot, your trigger isn't either :S

Thanks, that one should work (can't check atm).
But doesn't that loop actions for dealing damage make it do it over and over until trigger is turned off?
 
Level 13
Joined
Mar 16, 2008
Messages
941
Thanks, that one should work (can't check atm).
But doesn't that loop actions for dealing damage make it do it over and over until trigger is turned off?

Let me explain it to you.
Damage is a variable of type real.
I checked your trigger and saw that your damage increases by 35% per level, but not of the original value. So you need to do one step after the other.
Look:
Your damage at level 1 is 3x1.35
At level 2 it's 3x1.35x1.35 or 3x1.35²
this loop just calculates the damage for your level, it is finished after a milisecond and won't stop the trigger ;)
 
Level 3
Joined
Aug 4, 2008
Messages
56
No no I mean the
  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing Damage[(Player number of (Owner of (Casting unit)))] damage of attack type Chaos and damage type Normal
part

Anyway this is the improved version ATM.
  • Life Link
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Life Link Warlock/Witch 3
    • Actions
      • Set largelvl[(Player number of (Owner of (Casting unit)))] = (Level of Life Link Warlock/Witch 3 for (Casting unit))
      • Set Damage[(Player number of (Owner of (Casting unit)))] = 3.00
      • For each (Integer A) from 1 to ((Level of Life Link Warlock/Witch 3 for (Casting unit)) - 1), do (Actions)
        • Loop - Actions
          • Set Damage[(Player number of (Owner of (Casting unit)))] = (Damage[(Player number of (Owner of (Casting unit)))] x 1.35)
      • Unit Group - Pick every unit in (Units within 1.00 of (Position of (Target unit of ability being cast)) matching ((Picked unit) Equal to (Target unit of ability being cast))) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing Damage[(Player number of (Owner of (Casting unit)))] damage of attack type Chaos and damage type Normal
          • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + Damage[(Player number of (Owner of (Casting unit)))])
          • Wait 1.00 seconds
      • Set Time[(Player number of (Owner of (Casting unit)))] = 10.00
      • For each (Integer A) from 1 to ((Level of Life Link Warlock/Witch 3 for (Casting unit)) - 1), do (Actions)
        • Loop - Actions
          • Set Time[(Player number of (Owner of (Casting unit)))] = (Time[(Player number of (Owner of (Casting unit)))] x 1.05)
      • Wait (Real((Integer(Time[(Player number of (Owner of (Casting unit)))])))) seconds
      • Trigger - Turn off (This trigger)
Haven't tested it yet just finished it.
BTW thanks for helping :grin:
 
Level 24
Joined
Jun 16, 2008
Messages
1,939
when do u want the loop actions to stop? So as this is a DOT, do u want it to be added to a unit as well as a target when the unit casts an ability? I dont even get the meaning of what u want to reach with this trigger...
i think ur last posted trigger does nothing but damage the target a single time for 3 * level of the skill damage and then w8 a long duration of time to turn the trigger off ...

so its no damage over time at all but more a life drain from all units around the caster, right?

plz tell us more precisly what u mean
 
Level 3
Joined
Aug 4, 2008
Messages
56
It's a move that is supposed to damage 1 unit over time and heal the caster for the damage dealt. And yes it didn't work it only did the damage once.
 
Level 3
Joined
Sep 25, 2008
Messages
39
Here's my attempt. It's not MUI but it can be used by one unit for each player.

You'll need the following variables
integer level
real array[8] damage
integer array[8] time

  • Life Link
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Life Link Warlock/Witch 3
  • Actions
    • set level = (Level of Life Link Warlock/Witch 3 for (Casting unit))
    • Set damage[(Player number of (Owner of Unit(Casting Unit)))] = (3 x Power(1.35, level))
    • Set time[(Player number of (Owner of (Casting Unit)))] = (10 x Power(1.05, level))
    • For each (Integer A) from 1 to time[(Player number of (Owner of (Casting Unit)))], do (Actions)
      • Loop - Actions
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing damage[(Player number of (Owner of (Casting unit)))] damage of attack type Chaos and damage type Normal
      • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + damage[(Player number of (Owner of (Casting unit)))])
      • Wait 1.00 seconds
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
It will work just fine, it won't be MPI.

This however should be MPI.
You should have a unit variable named 'target' for this.

  • Life Link
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Life Link Warlock/Witch 3
  • Actions
    • Custom script: local unit udg_target = GetSpellTargetUnit()
    • set level = (Level of Life Link Warlock/Witch 3 for (Triggering unit))
    • Set damage[(Player number of (Owner of Unit(Triggering Unit)))] = (3 x Power(1.35, level))
    • Set time[(Player number of (Owner of (Triggering Unit)))] = (10 x Power(1.05, level))
    • For each (Integer A) from 1 to time[(Player number of (Owner of (Triggering Unit)))], do (Actions)
      • Loop - Actions
      • Unit - Cause (Triggering unit) to damage (target), dealing damage[(Player number of (Owner of (Triggering unit)))] damage of attack type Chaos and damage type Normal
      • Unit - Set life of (Triggering unit) to ((Life of (Casting unit)) + damage[(Player number of (Owner of (Triggering unit)))])
      • Wait 1.00 seconds
    • Custom script: set udg_target = null
 
Last edited:
Level 3
Joined
Aug 4, 2008
Messages
56
Ok the move is a damage over time move that deals base 3 damage per tick, ticks every 1 seconds, lasts base 15 secs and heals you for the damage dealt. Damage increases per level is 35%, the duration increases by 5% per level. It also has an effect that the target has all healing effects reduced by 50% and the caster gets 50% of the full heal. It's the 3d move for Warlock and Witch (they have the same spells but one is female the other male) and it's name is Life Link. It has 14 levels. That's all.
 
Level 24
Joined
Jun 16, 2008
Messages
1,939
To have ur spell rly MUI and MPI u n local variables or simply JASS. Since i am not very common with JASS and i dont know if its possible to use local variables in GUI and if, how to use them, i recommend u to go to the request forum of thehive and to ask someone to make the spell for u.

anyway, i made the math formula used for dmg and duration, which u should use for ur spell. They are done in GUI, but a good JASS - scripter will know how to use them.

  • Set IntegerDur = (((Level of Ability for (Triggering unit)) x (Integer(1.35))) x 15)
  • Set IntegerDmg = (((Level of Ability for (Triggering unit)) x (Integer(1.05))) x 3)
 
Status
Not open for further replies.
Top