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 Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

Simple Trigger

Discussion in 'World Editor Help Zone' started by darkalex13, Jul 6, 2010.

  1. darkalex13

    darkalex13

    Joined:
    Feb 20, 2008
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Ok, I've made an AoE spell, that when cast should damage all nearby enemies within 500 range of the casting units... The problems is that the allied units are also damaged... And I can't understand why...

    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) equal to Armaggedon
    • Actions
    • Set Armag = (Casting unit)
    • Wait 1.00 seconds
    • Unit Group - Pick every unit in (Units within 500.00 of (Position of Armag) matching (((Picked unit) belongs to an enemy of (Owner of Armag)) equal to true) and (((Picked unit) is a structure) equal to false)
    • Unit - Cause Armag to damage (Picked unit), dealing 250 damage of attack type Spells and damage type normal
     
  2. Etzer

    Etzer

    Joined:
    Feb 18, 2009
    Messages:
    1,256
    Resources:
    0
    Resources:
    0
    Don't use waits, and use an If/Then/Else, "Pick every unit close to Armag and do actions, I/T/E, owner of Picked unit is an ally of owner of triggering unit, then, (nothing) else deal damage."
     
  3. darkalex13

    darkalex13

    Joined:
    Feb 20, 2008
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Yeah it worked that way, but I still kept a wait and it shows no problem. I don't understand why matching doesn't work... Anyway thanks. rep+
     
  4. watermelon_1234

    watermelon_1234

    Joined:
    Nov 18, 2007
    Messages:
    1,066
    Resources:
    10
    Spells:
    9
    JASS:
    1
    Resources:
    10
    • Unit Group - Pick every unit in (Units within 500.00 of (Position of Armag) matching (((Picked unit) belongs to an enemy of (Owner of Armag)) equal to true) and (((Picked unit) is a structure) equal to false)
    You're supposed to use Matching unit instead of Picked unit.

    Unrelated:
    It would be better to use Triggering unit instead of Casting unit.

    You're also leaking a location and a unit group. If you don't know how to fix leaks, you can look at this link: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

    It would be better if you checked if the matching units were alive.
     
  5. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    894
    Resources:
    2
    Maps:
    2
    Resources:
    2
    He's right about "matching unit".

    Also, Watermelon, why is it better to use Triggering unit over casting unit?
     
  6. watermelon_1234

    watermelon_1234

    Joined:
    Nov 18, 2007
    Messages:
    1,066
    Resources:
    10
    Spells:
    9
    JASS:
    1
    Resources:
    10
    I'm not really good at explaining this but basically Triggering unit is a bit faster and it's thread-specific while Casting unit could get messed up after a wait.
     
  7. Arisato

    Arisato

    Joined:
    Dec 17, 2009
    Messages:
    991
    Resources:
    7
    Models:
    1
    Maps:
    4
    Spells:
    1
    Tutorials:
    1
    Resources:
    7
    use matching unit, add a variable point

    then use custom script
    Look
    call RemoveLocation( udg_VariableName )
    Set - UnitGroupsVariable = Every unit within 500 range .....(condition)
    there are many types that leaks, like unit groups too, use a variable unit groups, set it there, the Unit Groups - Pick every unit in UnitGroupsVariable and Unit - Damage (Value) to picked unit

    call DestroyGroup( udg_UnitGroupVariable )

    that should do the trick!

    i could create a test map if you want.
     
  8. darkalex13

    darkalex13

    Joined:
    Feb 20, 2008
    Messages:
    54
    Resources:
    0
    Resources:
    0
    I understand what you're saying, the thing is I usually test my triggers so they'll work and only if I see it's worth all the trouble I remove the leaks too, because if it's a bad trigger, why bother...
     
  9. haxel96

    haxel96

    Joined:
    Oct 17, 2009
    Messages:
    357
    Resources:
    0
    Resources:
    0
    Im not Watermelon^^ but Triggering unit is a "Local" variable, so if the trigger is triggered again when its running it wont interrupt eachother, if i use for example "A unit cast a ability." and then a "Wait 20 seconds", and then "Kill Casting unit" but it was triggered again before 20 seconds, the first caster wouldn't die. AFAIK
     
  10. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    894
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Mother of....*$#%#$%! Seriously? Oh, that would have saved me so much time...
     
  11. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Not really, haxel96, there are some occasions were event responses (e.g. Casting unit) normally work after a wait; it most likely has to do with the use of global variables.
     
  12. haxel96

    haxel96

    Joined:
    Oct 17, 2009
    Messages:
    357
    Resources:
    0
    Resources:
    0
    Ok, but triggering is at least faster than casting unit :D