• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Help with trigger enhanced healing spell

Status
Not open for further replies.
Level 4
Joined
Sep 22, 2011
Messages
70
Ok, so I made a Holy Nova type spell (if u've played wow u know what it is)

Bascially, the hero casts it, it has no target unit/location, and all friendly targets within x distance are to get healed by x amount.

I'm having problems with this part..

i'm using the following trigger to make the spell's effect:
  • Holy Nova
  • Events
    • Unit - A units begins the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Holy Nova
  • Actions
    • Set HolyNova_Caster = (Triggering unit)
    • Set HolyNova_Targets = (Units within 350.00 of (Position of (HolyNova_Caster)))
    • Unit Group - Pick every unit in HolyNova_Targets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Real((Level of Holy Nova for (Triggering unit)))) x 21.00 + 56.00)))
    • Custom Script: call DestroyGroup(udg_HolyNova_Targets)
now, using this algorithim for the amount healed, at spell level 1, it heals for 1*21+56=77 at level 2 it is 2*21+56=98, lvl3 is 3*21+56=119

THIS is where the problem starts, the first two levels are perfect.. however, using the object editor on a basic healing spell (Holy Light for example) Using the lvl 1 base of 56, and setting the level factor as 21, it comes out, 56, 98, 161, 245 but using it mathmatically, it comes out as 56, 98, 119, 140

Why is this? and what can I do to fix this? because I like the numbers for the 10 levels of the baility for the heal, they fit in perfectly with the Level Factor as 21, starting at 56, (Yes i know the first level of the spell will actually heal for 77(21 more then 56) because of how the trigger is set up, that is fine)

Basically, since there is no mass-aoe instant-heal spell already in the game, that is casted by a unit, rather then passive, I need to create one.
Healing wave wont work, one because another hero already has one like it, and two i want the heal to be instant to everyone around, not take a few seconds to jump around.

I thought using the algortithim of the *Ability Level* times 21(level factor) +56(base value) would equal *Heal desired*, however it equals far lower then that, on the GUI object editor, the level 10 heal is 1190, but using the mathmatical algorithim for it is 10*21=210+56=266 which is far from 1190 infact its 4.47 times lower.. and obviously I cant just take the number and multiply the current total by 4.47, it woudl work for the max level, but at lvls 1-9 it would make the heal higher then desired, as at lvl 9 the heal is only 4.0times lower, and ect.8 is 3.53, ect.


I need to know why I'm runnign into this error, is my math wrong somewhere? Did I fubar my own equations? or am I simply using the wrong values in the equation? is the way the object editor is figureing the numbers somehow diffrent then: <ability level>*<level factor>+<base value>=<total value> ??

and I already tried <ability level>+<Base value>*<level factor> that comes out way higher then the object editor says.. sooo.. help..plz..
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
(Level - 1) * 21 + 56
56, 77, 98, 119, 140...

Level * 21 + 56
77, 98, 119, 140, 161...

Use base 56 and constant factor 21 for the first option.
Use base 77 and constant factor 21 for the second option.

Use units matching condition in the unit pick filter, filter out enemies and dead units at least.
 
Level 4
Joined
Sep 22, 2011
Messages
70
either way the options arent what the object editor gives with the level factor 21, which are the numbers i want..
which is 56 98 161 245 350 476 623 791 980 1190
should I just do if/then/else actions for each level of the ability?
such as
if ability lvl 1
then heal for 56
else - if ability level 2
then heal for 98
else - if ability lvl 3
then heal for 161 ect. ?
 
Level 4
Joined
Sep 22, 2011
Messages
70
could u explain exactly what that would do?

Sorry but i would consider myself very very inept in most of this, I prefer trigger enhanced abilities that don't exactly scale with ability level, I usually leave that to the object editor and the trigger enhanced part remains the same on all levels, lol.
 
Level 4
Joined
Sep 22, 2011
Messages
70
I meant.. could u explain HOW it does this? If i understand the math behind the trigger then I can use it for anyother spells i might need to do this with, without having to ask for help on each one over and over.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You've got to try to see whether the numbers have something in common, is the some kind of constant value to be added from level to next or something.

The most basic way stats per level are handled, is an arithmetic sequence. The increase from level to next is constant, always the same. For example,
Lvl1: 1 dmg, lvl2: 2 dmg, lvl3: 3 dmg... +1 per level.

1,2,3... forms an arithmetic sequence. The equation would be 1*lvl.

Likewise, 11, 22, 33... forms an arithmetic sequence. +11 added per level. 11*lvl

Another basic way is an arithmetic sequence with an offset.
5,6,7... has been offset by 4. 4+1*lvl.

Then there's geometric sequence. To get a new value, multiply the previuos with a value.

2,4,8,16... is a geometric sequence. The multiplier (q) is 2. You can find out the q by dividing n+1 with n, for example 16/8=2.

Let's take a look at
56 98 161 245 350 476 623 791 980 1190

161/98 = 1.75
98/56 = 1.64
Doesn't match, so it isn't a geometric sequence.

161-98=63
98-56=42
No arithmetic either.

But
245-161=84
350-245=105

We get the numbers 42,63,84,105.
42=2*21, 63=3*21, 84=4*21, 105=5*21

So 21 is something common for all numbers. We can subtract it.

56 becomes 35. So at level 1 the equation is 35 + 21
Lvl2: 35 + 3*21
Lvl3: 35 + 6*21
Lvl4: 35 + 10*21
Lvl5: 35 + 15*21
Lvl6: 35 + 21*21

We have a pattern here. One could then try to find an equation for 3,6,10,15,21...

I saw that it is an arithmetic sum.

Lvl 1 = 35 + 1*21
Lvl2 = Lvl1 + 2*21
Lvl3 = Lvl2 + 3*21
...
->Lvl n = Lvl n-1 + n*21

And that is what the loop calculates. First is sets i = 35. Then it adds level 1 value, level 2 value and so on. Upto the level that was used.
 
Level 4
Joined
Sep 22, 2011
Messages
70
ahhh, ok, makes sense, thank you VERY much +rep
Now I should be able to figure out how to do this on other spells when needed. thx
 
Status
Not open for further replies.
Top