• 🏆 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!

[Trigger] why is this Variable so big?

Status
Not open for further replies.
Level 2
Joined
Feb 3, 2008
Messages
11
first I explain what i want to do:
I want to make a spell, that sucks out 20 life from all nearby Units and add it to the caster, but if the caster reaches full Health the life grows still, by adding instead of each 25life 1 strength. And that happens (5+lvlofability)times. Here is the Trigger:

  • ability4lebensaugen
    • Events
      • Unit - A unit starts the effect of a ability
    • Conditions
      • (Ability being cast) like Leben entziehen
    • Actions
      • For each (Integer A) from 1 to (5 + (3 x (Level of Leben entziehen for (Triggering unit)))), do (Actions)
        • Loop - Actions
          • Wait 1.00 seconds
          • Unitgroup - Pick every unit in (Units within 1024.00 of (Position of (Triggering unit)) matching ((Matching unit) unlike (Triggering unit))) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (20.00 + (Real ((Level of Leben entziehen for (Triggering unit))))) damage of attack type spell and damage type Normal
              • Set absorbiertesleben = ((Number of units in (Units within 1024.00 of (Position of (Triggering unit)) matching ((Matching unit) unlike (Triggering unit)))) x (20 + 0))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • (Life of (Triggering unit)) like (Max. Life of (Triggering unit))
                • 'THEN'-Actions
                  • Hero - Modify strength of (Triggering unit): add (absorbiertesleben / 25)
                • 'ELSE'-Actions
                  • Unit - Set life of (Triggering unit) to ((life of (Triggering unit)) + (Real(absorbiertesleben)))
              • Floating Text - Create floating text that reads (String(absorbiertesleben)) at (Position of (Triggering unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
something could be written wrong, cause i had to translate the Trigger from german to English

my Problem is:
at the end it shows me, that the variable "absorbiertesleben" is 260 (cause there were 13 Units near) but when I add the Variable to Life i always got far to much (3250), and when the Hero got his Life full he gets always 130 strength. I noticed, that 130x25= 3250 so it looks that everything looks well except, that the trigger thinks when adding the variable as life, that the variable is 3250 instead of 260

Does anybody know why too much life is added? How can I fix that?
 
Level 2
Joined
Feb 3, 2008
Messages
11
is it too hard to read should i make the post simpler or doesnt really nobody know what the problem is? it would also be nice if somebody could give me at least an alternative trigger suggestion, that does the same effect without this problem, if nobody knows what the problem is
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
It should be something like this

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Acid Bomb
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set unitGroup = (Units within 1024.00 of Point matching ((Matching unit) Not equal to (Triggering unit)))
      • Set Integer = ((Number of units in unitGroup) x 20)
      • Unit Group - Pick every unit in unitGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (20.00 x (Real((Level of Acid Bomb for (Triggering unit))))) damage of attack type Spells and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer + (Integer((Life of (Triggering unit))))) Less than or equal to (Integer((Max life of (Triggering unit))))
            • Then - Actions
              • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Integer)))
            • Else - Actions
              • Unit - Set life of (Triggering unit) to (Max life of (Triggering unit))
              • Set Integer = (Integer - ((Integer((Max life of (Triggering unit)))) - (Integer((Life of (Triggering unit))))))
              • Set Integer = (Integer / 25)
              • Hero - Modify Strength of (Triggering unit): Add Integer
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyGroup(udg_unitGroup)
      • Unit Group - Remove all units from unitGroup
 
Level 2
Joined
Feb 3, 2008
Messages
11
why does it not work if I add a Variable, that is so high like Integer, when it is added to Strength, to remove it again?
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Acid Bomb
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set unitGroup = (Units within 1024.00 of Point matching ((Matching unit) Not equal to (Triggering unit)))
      • Set Integer = ((Number of units in unitGroup) x 20)
      • Unit Group - Pick every unit in unitGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (20.00 x (Real((Level of Acid Bomb for (Triggering unit))))) damage of attack type Spells and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer + (Integer((Life of (Triggering unit))))) Less than or equal to (Integer((Max life of (Triggering unit))))
            • Then - Actions
              • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Integer)))
            • Else - Actions
              • Unit - Set life of (Triggering unit) to (Max life of (Triggering unit))
              • Set Integer = (Integer - ((Integer((Max life of (Triggering unit)))) - (Integer((Life of (Triggering unit))))))
              • Set Integer = (Integer / 25)
              • Set strengthremove = Integer
              • Hero - Modify Strength of (Triggering unit): Add Integer
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyGroup(udg_unitGroup)
      • Unit Group - Remove all units from unitGroup
      • For each (Integer B) from 1 to (7 + (3 x (Level of Leben entziehen for (Triggering unit)))), do (Actions)
        • Loop - Actions
          • Hero - Modify Strength of (Triggering unit): remove strengthremove
          • Wait 0.50 seconds
 
Level 2
Joined
Feb 3, 2008
Messages
11
perhaps its not easy for you to see the changes i have made: (I hope thats why nobody replies me^^)

here I want to make my variable as high as the added strength:
  • Untitled Trigger 001
    • Set Integer = (Integer - ((Integer((Max life of (Triggering unit)))) - (Integer((Life of (Triggering unit))))))
    • Set Integer = (Integer / 25)
    • Set strengthremove = Integer
    • Hero - Modify Strength of (Triggering unit): Add Integer
and here I want to remove the added strength:

  • For each (Integer B) from 1 to (7 + (3 x (Level of Leben entziehen for (Triggering unit)))), do (Actions)
    • Loop - Actions
      • Hero - Modify Strength of (Triggering unit): remove strengthremove
      • Wait 0.50 seconds
but why is it not working? the strength still remains hig and nothing will be removed...

or could somebody give me at least an alternative method to remove the added strength? That would be very nice! i would try to do it myself but i dont know how i should do it cause nobody can say me what Im doing wrong...
 
Level 6
Joined
Feb 12, 2008
Messages
207
humm i dont really get it... just say me the Damage you want the spell to do, the range, and all the data... ill try to make the trigger from the start..
 
Level 2
Joined
Feb 3, 2008
Messages
11
ok thax.
What i want to do is:
A unit drains 20 life from all Units (even friendly) in a specific Range (lets say 1024) an if he reaches full Health he increases his max Life temporarily by transforming the getting life to strength. This would repeat (5 times + the Level of the ability)

for example:
bobo = caster
hippo = first target
hippo2 = the second target


bobo starts the spell, he sucks 20 life from hippo and 20 Life from hippo2, so he gets 40 Life, he waits 0.5 seconds (the targets are stunned for the whole duration), and does the same again, but now he has already full health, so he could not get any Life anymore, but instead of rejecting the Life, he would gain, the Life will be transformed to strength so that his max Hp is growing instead of his normal Hp but in the same realation.

So now comes the problem:
That would be far to powerful to increase his strength permanently so we have to remove his gained strength again. That should be done in 5 steps each takes 0.5 seconds

it would be really nice of you if you could make that for me! Im sorry for my english (Im a German) but I hope that you could understand it! If not just tell me what you didnt understand and i'll try to explain it better!^^

(thx again for your effort)
 
Level 6
Joined
Feb 12, 2008
Messages
207
and how much time would the unit have the extra strength before its removed?

[starting to trigger the spell, please wait :)]
 
Level 6
Joined
Feb 12, 2008
Messages
207
sorry, i had to go out... but im back..

so as far as i got it, it will drain (20x5)+(20xLvlOfAbility) for each unit in range? as in your example the casting unit would do 240dmg, and have 240 life increased (in both life & str). is that right?

another questions:
1) in your map, the constants are that every 1str = 20HP rite?
2) the stun for each damaged unit comes directly from the ability right? or i have to include it on the trigger?
3) the ability is channeled? cause the casting unit would be able to move, and still be damaging units if not... like if it would be an aura activated for some seconds

EDIT: this would be the 1st trigger... i think i have to fix the Strength added cause you will get 25HP for each str... lemme do some maths (not good at that :p) and ill fix it. also, it will leak some HP, as if you just need 2HP, it will 1st get your HP to 100%, and then once the HP is at 100%, starts to add the strength.

  • Soul Steal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Steal
    • Actions
      • Set STR_GAINED = 0
      • For each (Integer A) from 1 to (5 + (Level Soul Steal for (Casting unit))), do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 1024.00 of (Position of (Casting unit))) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of (Casting unit)) Equal to 100.00
                • Then - Actions
                  • Hero - Modify Strength of (Casting unit): Add 1
                  • Set STR_GAINED = (STR_GAINED + 1)
                  • Wait 0.50 seconds
                • Else - Actions
                  • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 20.00)
                  • Wait 0.50 seconds
      • Wait (5.00 + (Real((Level of Soul Steal for (Casting unit))))) seconds
      • Hero - Modify Strength of (Casting unit): Subtract STR_GAINED
im going to test the skill

EDIT: No matter how much i try, the "wait x seconds" action before the "pick every unit" doesnt trigger properly... it stops the trigger execution for some reason. And if i use it inside the "Then" and "Else" from the "If", they trigger properly, but doesnt wait the time specified.
if any1 can help i could go on with this trigger :p


------------------------------------------------------------------

EDIT: Ok i got this far: as the loops screw everything they touch xD (i had a lot of issues on those loops) i made a custom loop, now if you need to do the math gimme just some more mins and ill have the math to give you 20hp instead of 25 :)
EDIT2: i done the math and it works great... at your service:

  • Soul Steal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Steal
    • Actions
      • Set HERO = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • COUNT Less than (4 + (Level of Soul Steal for HERO))
        • Then - Actions
          • Set COUNT = (COUNT + 1)
        • Else - Actions
          • Set STR_GAINED = ((Integer(DMG_DONE)) / 25)
          • Hero - Modify Strength of HERO: Add STR_GAINED
          • Wait (5.00 + (Real((Level of Soul Steal for HERO)))) seconds
          • Hero - Modify Strength of HERO: Subtract STR_GAINED
          • Set DMG_DONE = 0.00
          • Set STR_GAINED = 0
          • Set COUNT = 0
          • Skip remaining actions
      • Unit Group - Pick every unit in (Units within 1024.00 of (Position of HERO) matching (((Matching unit) is alive) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause HERO to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of HERO) Equal to 100.00
            • Then - Actions
              • Set DMG_DONE = (DMG_DONE + 20.00)
            • Else - Actions
              • Unit - Set life of HERO to ((Life of HERO) + 20.00)
      • Wait 0.50 seconds
      • Trigger - Run (This trigger) (checking conditions)
i've tried myself this trigger and it works properly, i used War Stomp with no damage, range 1024, if you move the casting unit while the trigger is working, it works as if the caster would be in a magic bubble that destroys everything that touches :p
so if you cast the spell, stun 2 units, and go away (more than 1024 range) from the units... they will be stunned but stop getting damage from the caster and the same for non stunned units (if they enter range they will get hit)

remember to have the spell cooldown to more than 5+[Lvl of ability] seconds (the time that takes the trigger to finish). As if the trigger is still running and you cast another "Soul Steal" spell, it will bug, and the strength will be permanent. (same if you have an item that resets cooldowns)
Also, if more than one player will be using the same skill at the same time, use arrays so you assign each value to each player

oh, and last... make sure you add some nice effects to the spell cause it looks like shit as it is xD
 
Last edited:
Level 6
Joined
Feb 12, 2008
Messages
207
well... in the tests wasnt the same. cause the trigger is ordered to wait, and had problems with the variables
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Here is a version of my trigger with the wait.

This version uses Manual of Health items instead of strength (I see it as a better solution since strength also adds damage in case the hero is strength based and it also adds life regeneration rate).

Things you need for this to work:
  • Your ability
  • Manual of Health +10
  • Manual of Health -10

You can change those +10/-10 to any other number to change accuracy but you'll also need to change the calculation.

This trigger is MPI and can be casted once per player at the same time without getting bugged.

If the damage/healing calculations aren't right its because I didn't understand you currectly.

  • BLEH
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to yourAbility
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set Group = (Units within 1024.00 of Point)
      • Custom script: call RemoveLocation(udg_Point)
      • Set Integer = ((Number of units in Group) x (100 + (20 x (Level of Acid Bomb for (Triggering unit)))))
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (100.00 + (20.00 x (Real((Level of yourAbility for (Triggering unit)))))) damage of attack type Spells and damage type Normal
      • Unit Group - Remove all units from Group
      • Custom script: call DestroyGroup(udg_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer + (Integer((Life of (Triggering unit))))) Less than or equal to (Integer((Max life of (Triggering unit))))
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Integer)))
        • Else - Actions
          • Unit - Set life of (Triggering unit) to (Max life of (Triggering unit))
          • Set Integer = (Integer - ((Integer((Max life of (Triggering unit)))) - (Integer((Life of (Triggering unit))))))
          • Set Integer = (Integer / 10)
          • For each (Integer A) from 1 to Integer, do (Actions)
            • Loop - Actions
              • Hero - Create Manual of Health +10 and give it to (Triggering unit)
          • Set IntegerP[(Player number of (Owner of (Triggering unit)))] = Integer
      • Wait (5.00 + (Real((Level of yourAbility for (Triggering unit))))) seconds
      • For each (Integer A) from 1 to IntegerP[(Player number of (Owner of (Triggering unit)))], do (Actions)
        • Loop - Actions
          • Hero - Create Manual of Health -10 and give it to (Triggering unit)
 
Level 2
Joined
Feb 3, 2008
Messages
11
wow you are both very helpful^^ well,

i think I can correct these misunderstandings for my self, i just want to clarify what i meant^^:

so as far as i got it, it will drain (20x5)+(20xLvlOfAbility) for each unit in range? as in your example the casting unit would do 240dmg, and have 240 life increased (in both life & str). is that right?

That would be a bit too powerful, i thought that only the Duration of the ability is levelbased and the power remains always the same, but its good like its now cause if I change my Opinion i can modify it easier^^

1) in your map, the constants are that every 1str = 20HP rite?

no, they are 1 str= 25, thats why i divided it by 25 (but i want the spell to do 20 damage anyway)

2) the stun for each damaged unit comes directly from the ability right? or i have to include it on the trigger?

since i also want to damage friendly Units
(and I always had trouble with the "allowed targets" in the Object editor,[when i tried it earlier in an other spell it says, the target MUST be a friendly Unit, and if i uncheck it, it doesnt affect them])
it would be good to include it in the spell. (As I said i could try it for myself but i cant guarantee, that i'll not come the next day again to post the next problem i would get)

3) the ability is channeled? cause the casting unit would be able to move, and still be damaging units if not... like if it would be an aura activated for some seconds

yes, the ability should be channeled.

ill try GhostWolfs trigger soon to see if it works like i wanted it to and tell you about it how it works.

Thank you for your effort, i think that took you for sure an hour to help me, i will not forget you (if my map is finished ill add you to the credits^^)

btw: to stun the targets: should i give them the buff from warstomp? Or should I pause them? o_O
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
From each post to post im getting more and more confused as to how this ability should work x.X

Anyway about the stun - just create a dummy that will warstomp (or base the ability on it and then there is no need for a dummy).

As to the targets, tick only Friendly,Enemy.
 
Level 6
Joined
Feb 12, 2008
Messages
207
yeah, i ticked Friend, Enemy and it stunned even neutral passive units... works properly for me.
 
Status
Not open for further replies.
Top