Need someone good at math.

Status
Not open for further replies.

toomasb

Level 3
Right, I know there is a shorter way to do this so if any math genius can help me much appreciated

• 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.

toomasb

Level 3
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.

Xarwin

Level 19
but I'm pretty sure it would help if you'd post a single map with the ability.
Much easier since this streches the page for pretty much people.

Vercas

Level 21
Man... i should make an tutorial for basic knowdledge required for making a map...
You need to know math very good for these...

Justify

Level 13
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

Vercas

Level 21
You have a wrong line!
it isn't
• Set Damage = Damage*1.35
• it actualy is
• Set Damage = Damagex1.35

Justify

Level 13
Who cares if I write an * instead of an x to multiply?^^
Btw, changed it just for you ;P

de1337

Level 2
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.

toomasb

Level 3
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?

Vercas

Level 21
Thank you, Justify
You're a nice person and i'm happy you're done with this, toomasb, good luck with your project!
have a nice day!

Day-Elven

Level 9
toomasb said:
But doesn't that loop actions for dealing damage make it do it over and over until trigger is turned off?

It does only when you use "wait" inside the loop. If you use it you'll have to create variables. But in this trigger you don't need them.

Justify

Level 13
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

toomasb

Level 3
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.
• 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

Palaslayer

Level 24
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

toomasb

Level 3
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.

Palaslayer

Level 24
i may be able to help u, just give me some time

just tell me exactly the data of ur desired spell, what it is supposed to do, the data for each level, the area, the duration etc.

Abdoma

Level 3
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

• 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

Day-Elven

Level 9
Abdoma, I think it won't work only for red player. You need more variables.

GhostWolf

Level 29
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.

• 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:

Day-Elven

Level 9
1. Mistake: "udg_" before local var
2. You can change Owner of (Triggering Unit)--> Triggering player

Palaslayer

Level 24
didnt u notice that this may not be fitting his request unless he gives us the complete data of the spell? maybe he wants the spell to do a different thing than damaging only one unit?
so, plz toomasb, let us know the ability and we might be rly able to help u

Day-Elven

Level 9
GhostWolf said:
Mistake: no.

You have edited the 1st thing ;/
It was
• Custom script: local unit udg_target = GetSpellTargetUnit()
• <...>
• Custom script: set target=null
And i didn't say that 2nd is mistake.

Anyway, it's nevermind. Your trigger must work correctly now.

toomasb

Level 3
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.

Palaslayer

Level 24
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)

GhostWolf

Level 29
1.35 and 1.05 casted to an integer will always result as 1.

toomasb

Level 3
So if I'm getting this right I need JASS to do it?

Dr Super Good

Spell Reviewer
Level 64
Horray for exponential opperations.
Here is your damage formula to get numbers like in the orignal trigger.

Formula for the number you are after is.
3*1.35^(spell level-1)

Or in JASS

3*Pow(1.35,Spell_Level_Variable_Here-1)

Status
Not open for further replies.

Replies
6
Views
2K
Replies
8
Views
919
Replies
2
Views
965
Replies
6
Views
839
Replies
7
Views
493