Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Made a skill that works! Almost. Skill-LVL use question.

Discussion in 'Triggers & Scripts' started by Erandir, Jan 18, 2010.

  1. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    • Made a skill that works! Almost. Skill-LVL use question.[/b]
    • Hello all, this is my first post and it's concerning a triggering issue (or so I hope).
    • I'm relatively new to all this, so most probably the solution to my problem will be a simple one (or at least I hope so).
    • Here's the skill I want to create:
    • [QUOTE][img]http://i43.photobucket.com/albums/e394/DotA_Icons/BTNTransmute.png[/img]
    • [font=Arial][size=3][color=#99CCFF][b]Mammon’s Fury[/b][/color][/size][/font]
    • Vingdal, Mammon Servant sacrifices 2/3 of his money to land a devastating strike!
    • [color=#FFCC33]Level 1[/color] – dmg = Used amount of money x 1
    • [color=#FFCC33]Level 2[/color] – dmg = Used amount of money x 1.5
    • [color=#FFCC33]Level 3[/color] – dmg = Used amount of money x 2
    • Vingdal strikes an enemy unit with amplified damage using all his money. On lvl 3 = 1500g = 2000 dmg[/QUOTE]
    • I managed to do everything except the increased lvl damage.
    • I used the formula: 0.5 + LVL/2
    • This schould get 1 for LVL 1, 1.5 for LVL 2 and 2 for LVL 3
    • But why isn't it working?
    • Here's the code:
    • [CODE]Unit- Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (MammonDamageCount x [B](0.50 + ((Real((Level of Mammon's Fury for (Picked unit)))) / 2.00)))[/B] damage of attack type Normal and damage type Divine
    • [/CODE]
    • Note that 'MammonDamageCount' has the formula: Actual Gold x 0.67
    • When I try it out it always gives me the damage times 1.
    • Does anybody know what's wrong with my code?
    • Thanks in advance!
    • Erandir
    • PS.: it's my first code ever so be patient with me :)
     
    Last edited: Jan 18, 2010
  2. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Hey uhm is this such a difficult prob or just a too noobish question? ^^
     
  3. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Ok here's the whole GUI code, hope it clarifies it a bit (although it's partly in german ^^)
     

    Attached Files:

  4. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Please? Just ANY reaction would be helpful... even "fuck off noob" or so...
     
  5. Shiroaisu

    Shiroaisu

    Joined:
    Jul 17, 2008
    Messages:
    202
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I dont know if i got the problem right but it might be an error in the calculations:

    (0.50 + ((Real((Level of Mammon's Fury for (Picked unit)))) / 2.00)))

    if lvl=1 then this would give 0.75 as result...

    oh and also: when you post triggers post them bettween trigger tags:
    HTML:
    [TRIGGER][/TRIGGER]
    like this:
    • Debug
      • Events
        • Time - Every 20.00 seconds of game time
      • Conditions
      • Actions
        • Unit Group - Pick every unit in (Units of type Abomination) and do (Actions)
          • Loop - Actions
            • Unit - Order (Entering unit) to Attack-Move To runnerloc


    this as nothing to do with ur trigger... just an example :p

    good luck anyway
     
  6. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Change the <picked unit> to <triggering unit>.

    Remove the wait and "destroy last created floating text." Add "Disable permanence for <last created floating text>" and set life time ot 2 seconds. Try also adding fading age.

    Also take care of the location leaks.
     
  7. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,124
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    You are doing integer division currently so decimals can not be generated. Thus what you are doing is 0.5 + 1/2 = 0.5.

    Make it 0.5 + 1/2.0 = 1.

    This is due to integer of floatingpoint maths.
     
  8. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    In the actual code he uses a real.
     
  9. zerox144

    zerox144

    Joined:
    Oct 18, 2007
    Messages:
    59
    Resources:
    0
    Resources:
    0
    instead of using "triggering unit", use "Event Response - Casting Unit" however this only works if your event is "A unit begins casting an ability"
     
  10. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Using triggering unit is just fine.
     
  11. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Ok hey thanks for all the responses, gonna try it out right now.

    Concerning integer vs real, my floating dmg counter always has decimals. Like 1234.0. Is it correct that i would have to convert the real number into an integer before displaying it? (don't want any decimals)

    Oh and btw, i think the formula is correct... 0.5 + half of lvl 1 (0.5) equals 1
     
  12. JeffreyQ

    JeffreyQ

    Joined:
    Sep 28, 2004
    Messages:
    363
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    If you want you need to create a Integer variable say "damage_text". Then set damage_text = yourdamage_var

    And then display it. For some reason if you covert right away from real to integer and display it in a string or floating text it will still display .00 =/
     
  13. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    So I changed some things, and here's the new code:

    • Mammons Fury
      • Events
        • Unit - A unit starts effect of an ability
      • Conditions
        • (Ability being cast) is Mammon's Fury
      • Actions
        • Set Gold_Actual = (Real(((Owner of (Triggering unit)) actual Gold)))
        • Set MammonDamageCount = (Gold_Actual x 0.67)
        • Set Caster = (Casting unit)
        • Set Distance = 0.00
        • Set Angle = (Angle from (Position of Caster) to (Target point of ability being cast))
        • Set Cast_Point = (Position of Caster)
        • Unit - Create 1 Spell-Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Targeted unit))
        • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing (MammonDamageCount x (0.50 + ((Real((Level of Mammon's Fury for (Triggering unit)))) / 2.00))) damage of attack type Normal and damage type Divine
        • Unit - Add a 1.00 second Standard expiration timer to (Last created unit)
        • Player - Add ((Integer(MammonDamageCount)) x -1) to (Owner of (Triggering unit)) actual Gold
        • Floating Text - Create floating text that reads (String(MammonDamageCount, 7, 0)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 30.00% transparency
        • Floating Text - Change (Last created floating text): deactivate 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 2.00 seconds


    Everything works except the damage output... (didn't apply the hint from JeffQ though... will follow)

    Has anyone an idea?
     
    Last edited: Jan 22, 2010
  14. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    How does it not work? Still wrong amount of damage? How much is it?

    For example, you have x gold and the damage is y, when it should be z. What are those values for you?

    Change this to target unit of ability being cast.
    "(Position of (Targeted unit))"

    Set the fading age to something lower than the lifespan.
     
  15. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Ignoring the skill-lvl, it always hits with 2/3rd of his actual money...

    Gold: 5000
    Hit on lvl 1: Rounds up to 3350 actually (Should be 3333)
    Hit on lvl 2: 3350 (Should be 5000)
    Hit on lvl 3: 3350 (Should be 6666)
     
  16. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    I've found the error. It's the displayed damage that is wrong... :aa:

    :ugly:
     
  17. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Here's the new code.
    Now what I do is to calculate the damage in advance, using 1/3rd of the variables I used before:

    • Mammons Fury
      • Events
        • Unit - A unit starts the effekt of an ability
      • Conditions
        • (Ability being cast) is Mammon's Fury
      • Actions
        • Set Dmg_output = ((Integer((0.50 + ((Real((Level of Mammon's Fury for (Triggering unit)))) / 2.00)))) x (Integer(((Real(((Owner of (Triggering unit)) actual Gold))) x 0.67))))
        • Set Caster = (Casting unit)
        • Set Distance = 0.00
        • Set Angle = (Angle from (Position of Caster) to (Target point of ability being cast))
        • Set Cast_Point = (Position of Caster)
        • Unit - Create 1 Spell-Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Target unit of ability being cast))
        • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing (Real(Dmg_output)) damage of attack type Normal and damage type Divine
        • Unit - Add a 1.00 second Standard expiration timer to (Last created unit)
        • Player - Add ((Integer(((Real(((Owner of (Triggering unit)) actual Gold))) x 0.67))) x -1) to (Owner of (Triggering unit)) actual Gold
        • Floating Text - Create floating text that reads (String(Dmg_output)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 30.00% transparency
        • Floating Text - Change (Last created floating text): Deaktivieren 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 1.50 seconds


    But still he messes up the damage.
    What works now is everything but the LVL 2 of the skill.

    On lvl 2 he still strikes with lvl 1 damage...
     
  18. Erandir

    Erandir

    Joined:
    Jan 18, 2010
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Ok sorry for so much posting but it's clear to me now. I have to calculate the damage BEFORE changing them to INTEGER values. All clear.
    Sry for such excessive posting again!

    For all who are interested, here's the final code:

    • Mammons Fury
      • Events
        • Unit - A unit starts the effekt of an ability
      • Conditions
        • (Ability being cast) is Mammon's Fury
      • Actions
        • Set Dmg_output = (Integer(((0.50 + ((Real((Level of Mammon's Fury for (Triggering unit)))) / 2.00)) x ((Real(((Owner of (Triggering unit)) Aktuelles Gold))) x 0.67))))
        • Set Caster = (Casting unit)
        • Set Distance = 0.00
        • Set Angle = (Angle from (Position of Caster) to (Target point of ability being cast))
        • Set Cast_Point = (Position of Caster)
        • Unit - Create 1 Spell-Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Target unit of ability being cast))
        • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing (Real(Dmg_output)) damage of attack type Normal and damage type Divine
        • Unit - Add a 1.00 second Standard expiration timer to (Last created unit)
        • Player - Add ((Integer(((Real(((Owner of (Triggering unit)) actual Gold))) x 0.67))) x -1) to (Owner of (Triggering unit)) actual Gold
        • Floating Text - Create floating text that reads (String(Dmg_output)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 30.00% transparency
        • Floating Text - Change (Last created floating text): Deaktivieren 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 1.50 seconds
     
    Last edited: Jan 22, 2010