1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger problem

Discussion in 'Triggers & Scripts' started by Dr. Boom, Sep 26, 2009.

  1. Dr. Boom

    Dr. Boom

    Joined:
    May 1, 2008
    Messages:
    1,549
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Seas =)

    I want create a spell, that drains a random amount of life and mana from the hero, each friendly unit in range get healed by both amounts and nearly enemy units get damage by both amounts. Also the Hero should lose the drained life and the drained mana.

    I create the following trigger, but it doesn't work correct. The casting hero always die, and the damage/heal is always the same. Tested it 20 times and always the same. Can someone help me please? =)

    • Heart of Sheria
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Ds Basic
      • Actions
        • Set TempPoint11 = (Position of (Casting unit))
        • Set DragonCounterLife = (Random integer number between (Integer((Life of (Casting unit)))) and (Integer((Max life of (Casting unit)))))
        • Set DragonCounterMana = (Random integer number between (Integer((Mana of (Casting unit)))) and (Integer((Max mana of (Casting unit)))))
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units within 450.00 of TempPoint11 matching (((Matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Real(DragonCounterLife)) + (Real(DragonCounterMana))))
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units within 450.00 of TempPoint11 matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - ((Real(DragonCounterLife)) + (Real(DragonCounterMana))))
        • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - (Real(DragonCounterLife)))
        • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) - (Real(DragonCounterMana)))
        • Custom script: call RemoveLocation(udg_TempPoint11)
     
  2. Diehard@Azeroth

    Diehard@Azeroth

    Joined:
    Sep 21, 2007
    Messages:
    483
    Resources:
    1
    Spells:
    1
    Resources:
    1
    hehe silly :) life of casting unit is the current life of the casting unit, and max life is the maximum life it can sustain, meaning the damage caused to casting unit is equal to a number between its current life and the maximum life it can sustain, so lets say the hp of the casting unit is 5, and its max hp is 7, the random integer will not be any less than 5, and so 5-5 = 0 = dead unit :p

    dont worry, everyone makes silly mistakes like this xP

    happy mapping!
     
  3. Dr. Boom

    Dr. Boom

    Joined:
    May 1, 2008
    Messages:
    1,549
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Seas =)

    Ahh rofl - lol now as you said it omg - really stupid mistake =D

    Thanks for answer =D

    Diehard@Azeroth gets: +rep "Thanks for answer and helping me to detect my mistake"
     
    Last edited: Sep 26, 2009
  4. Arnadath

    Arnadath

    Joined:
    Oct 31, 2008
    Messages:
    227
    Resources:
    0
    Resources:
    0
    Uh we use to say "problem solved"
     
  5. Dr. Boom

    Dr. Boom

    Joined:
    May 1, 2008
    Messages:
    1,549
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Seas =)

    But one problem still remains - my trigger should pick a random amount of his life and his max life (and mana) but it always picks up the max life and max mana and heal/damage the targets in range.

    How to fix that? =O
     
  6. EpixBelongToMe

    EpixBelongToMe

    Joined:
    Aug 19, 2006
    Messages:
    188
    Resources:
    1
    Maps:
    1
    Resources:
    1
    are you testing the map with the test mode of the editor?
    the test mode sets every random integer always to the highest value.
    i don't know why.
     
  7. Dr. Boom

    Dr. Boom

    Joined:
    May 1, 2008
    Messages:
    1,549
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Seas =)

    Hmm I tested it with the normal way and the editor test - but always its the amount of max mana and max life =S

    I looked to the trigger 3 times now - but I don't get it :wbored:
     
  8. EpixBelongToMe

    EpixBelongToMe

    Joined:
    Aug 19, 2006
    Messages:
    188
    Resources:
    1
    Maps:
    1
    Resources:
    1
    ok it could be also the mistake that you choose a value between the life and max life. so if the unit is at max hp the result value will always be the full hp amount.
    maybe you should just use a value between 1 and the max hp/mana.