1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  4. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  5. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  6. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  7. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  8. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Triple Blink [malfunction]

Discussion in 'Triggers & Scripts' started by biHmapmaker, Aug 8, 2013.

  1. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    I'm creating a simple "Triple Blink" (Triangular ability, stacking three points (one initial and two additional based on that one) which also damages enemy units in a small cone. What does the ability do? Well ... it does all required. However, in addition, it ignores the cooldown (meaning there is not one) and also damages Hero in the process. I know it has something to do with "Unit Group" but I'm not sure whether I should pre-define it or there's just some miss or something alike in the actual trigger.

    • Triangular BlinkINT
      • Events
        • Unit - A unit Begins casting an ability
      • Conditions
        • (Ability being cast) Equal to Triangular Blink
      • Actions
        • Set TB_Caster = (Triggering unit)
        • Set TB_Damage = (Agility of TB_Caster (Include bonuses))
        • Set TB_Range = 400
        • Set TB_DMG_RAD = 250
        • Set TB_Temp_Points[0] = (Target point of ability being cast)
        • Set TB_Temp_Points[1] = (TB_Temp_Points[0] offset by (Real(TB_Range)) towards 20.00 degrees)
        • Set TB_Temp_Points[2] = (TB_Temp_Points[1] offset by (Real(TB_Range)) towards 90.00 degrees)
        • Unit - Move TB_Caster instantly to TB_Temp_Points[0]
        • Unit Group - Pick every unit in (Units within (Real(TB_DMG_RAD)) of (Position of TB_Caster) matching (((Picked unit) belongs to an enemy of (Owner of TB_Caster)) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Cause TB_Caster to damage (Triggering unit), dealing (Real(TB_Damage)) damage of attack type Pierce and damage type Normal
            • Special Effect - Create a special effect at TB_Temp_Points[0] using Abilities\Spells\Items\SpellShieldAmulet\SpellShieldCaster.mdl
            • Special Effect - Destroy (Last created special effect)
        • Wait 0.40 seconds
        • Unit - Move TB_Caster instantly to TB_Temp_Points[1]
        • Unit Group - Pick every unit in (Units within (Real(TB_DMG_RAD)) of TB_Temp_Points[1] matching (((Picked unit) belongs to an enemy of (Owner of TB_Caster)) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Cause TB_Caster to damage (Triggering unit), dealing (Real(TB_Damage)) damage of attack type Pierce and damage type Normal
            • Special Effect - Create a special effect at TB_Temp_Points[1] using Abilities\Spells\Items\SpellShieldAmulet\SpellShieldCaster.mdl
            • Special Effect - Destroy (Last created special effect)
        • Wait 0.40 seconds
        • Unit - Move TB_Caster instantly to TB_Temp_Points[2]
        • Unit Group - Pick every unit in (Units within (Real(TB_DMG_RAD)) of TB_Temp_Points[2] matching (((Picked unit) belongs to an enemy of (Owner of TB_Caster)) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Cause TB_Caster to damage (Triggering unit), dealing (Real(TB_Damage)) damage of attack type Pierce and damage type Normal
            • Special Effect - Create a special effect at TB_Temp_Points[2] using Abilities\Spells\Items\SpellShieldAmulet\SpellShieldCaster.mdl
            • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation(udg_TB_Temp_Points[0])
        • Custom script: call RemoveLocation(udg_TB_Temp_Points[1])
        • Custom script: call RemoveLocation(udg_TB_Temp_Points[2])
     
  2. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    Btw. I did try using "Triggering Unit" instead of "Picked Unit" in the "Unit Group" line and it does work as intended, however it disables all special effects for a reason.
     
  3. Malhorne

    Malhorne

    Joined:
    Sep 14, 2012
    Messages:
    2,340
    Resources:
    6
    Spells:
    4
    Tutorials:
    1
    JASS:
    1
    Resources:
    6
    First set the position of the caster to a location variable that will be removed at the end :)
    Set picked unit instead of triggering unit.

    It ignores the cd ? What does this mean ?
    It damages the caster hero ?
     
  4. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    I figured out the damage caster problem by making Hero invulnerable before teleporting and reverting back afterwards, but the cooldown problem is still there - the spell never goes on cooldown meaning it can be cast endlessly.
     
  5. Malhorne

    Malhorne

    Joined:
    Sep 14, 2012
    Messages:
    2,340
    Resources:
    6
    Spells:
    4
    Tutorials:
    1
    JASS:
    1
    Resources:
    6
    That's in object editor :)
    You can also create a variable TempGroup and remove the hero from this group but it looks more realistic to make the hero invulnerable during such a move ^^
     
  6. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    Nah, in object editor, the spell has set Cooldown of 7 seconds. However, it is ignored for some reason and I really can't figure out why.
     
  7. Malhorne

    Malhorne

    Joined:
    Sep 14, 2012
    Messages:
    2,340
    Resources:
    6
    Spells:
    4
    Tutorials:
    1
    JASS:
    1
    Resources:
    6
    I FOUND IT !
    NEVER USE Events - A unit Begins casting an ability.
    Use instead Events - A unit Starts the effect of an ability.

    :)
     
  8. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    this
    • Unit Group - Pick every unit in (Units within (Real(TB_DMG_RAD)) of TB_Temp_Points[1] matching (((Picked unit) belongs to an enemy of (Owner of TB_Caster)) Equal to True)) and do (Actions)
    needs to be matching unit not picked unit.

    Also u leak groups.
    anything used twice or more should be stored. example: triggering unit.
     
  9. biHmapmaker

    biHmapmaker

    Joined:
    Oct 10, 2009
    Messages:
    99
    Resources:
    0
    Resources:
    0
    Thanks, works like a charm now :)
     
  10. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,702
    Resources:
    101
    Models:
    86
    Icons:
    4
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    101
    Also.. rmember.. the move thingy stops the ability process. So it's not fully cast at all. Try using some workaround instead of wait, too. Like Mass Teleport. Which only targets the hero.
     
  11. Malhorne

    Malhorne

    Joined:
    Sep 14, 2012
    Messages:
    2,340
    Resources:
    6
    Spells:
    4
    Tutorials:
    1
    JASS:
    1
    Resources:
    6
    The explanation for the event is that the cooldown come when the abilities is fully cast.
    By using begins casting an ability you start to instant move disabling the current ability and cooldown don't appear at all.
     
  12. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
  13. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,968
    Resources:
    0
    Resources:
    0
    Beware of more units casting this spell at around the same time, as the spell is not MUI.

    For the movement part - you could alternatively move the unit via custom script, as that does not interrupt its current order like the action "move unit somewhere" does.
     
  14. Ofel

    Ofel

    Joined:
    Mar 29, 2012
    Messages:
    442
    Resources:
    10
    Spells:
    10
    Resources:
    10
    You can do like this on using unit group :
    • Untitled Trigger 001
      • Events
      • Conditions
      • Actions
        • Set Caster = (Triggering unit)
        • Set Owner = (Owner of Caster)
        • Set TempPoint = (Target point of ability being cast)
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units within 512.00 of TempPoint) and do (Actions)
          • Loop - Actions
            • Set TempUnit = (Picked unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TempUnit belongs to an enemy of Owner) Equal to True
              • Then - Actions
                • -------- Put your action here --------
              • Else - Actions
        • -------- Now, the group above has been destroyed automatically --------
        • Custom script: call RemoveLocation(udg_TempPoint)

    The "set bj_wantDestroyGroup = true" determines if you want the going to be created group to be destroyed after using it or not

    Also using 'if' inside group loop action to check the picked unit will reduce lag AFAICT... :D
     
  15. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,702
    Resources:
    101
    Models:
    86
    Icons:
    4
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    101
    An if inside the loop does not reduce lag. It adds readability. However, it's easier to simply pick every unit in range matching condition.

    You never null TempUnit, Caster or Owner, which causes a leak.

    He wants to triple blink, not to pick every unit somewhere and do something else other than move to the target point and two more points in a matter of 0.80 seconds.
     
  16. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    using the ITE makes it easier to read and more efficient because you can't set matching unit to a variable when it's used twice or more.

    not nulling does not cause leak.
     
  17. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,702
    Resources:
    101
    Models:
    86
    Icons:
    4
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    101
    B-but it's for performance. I tried to null some vars and the lag was reduced.