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.

Triggered Shockwave damage once

Discussion in 'World Editor Help Zone' started by ZiGOR, Nov 24, 2014.

  1. ZiGOR

    ZiGOR

    Joined:
    Mar 17, 2012
    Messages:
    577
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Hi everyone! I have a little problem.
    I got a spell that acts like a Shockwave, but damage is triggered. But for some reason it damages units several time despite the fact that I add units in "Damaged_Group" and check if they are in that group not to damage them again... :ogre_rage:
    1
    • Retribution
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Retribution of Overlord
      • Actions
        • Set Retribution_Counts = (Retribution_Counts + 1)
        • Set Retribution_Caster[Retribution_Counts] = (Triggering unit)
        • Set Retribution_Caster_Point = (Position of Retribution_Caster[Retribution_Counts])
        • Set Retribution_Target_Point = (Target point of ability being cast)
        • Set Retribution_Angle = (Angle from Retribution_Caster_Point to Retribution_Target_Point)
        • Unit - Create 1 Retribution Dummy for (Owner of Retribution_Caster[Retribution_Counts]) at Retribution_Caster_Point facing Retribution_Angle degrees
        • Unit - Set the custom value of (Last created unit) to Retribution_Counts
        • Unit Group - Add (Last created unit) to Retribution_StartGroup
        • Set Retribution_Distance[Retribution_Counts] = 1000.00
        • Set Retribution_DistanceTravel[Retribution_Counts] = 0.00
        • Trigger - Turn on Retribution Move <gen>
        • Custom script: call RemoveLocation (udg_Retribution_Caster_Point)
        • Custom script: call RemoveLocation (udg_Retribution_Target_Point)

    2
    • Retribution Move
      • Events
        • Time - Every 0.02 seconds of game time
      • Conditions
      • Actions
        • Unit Group - Pick every unit in Retribution_StartGroup and do (Actions)
          • Loop - Actions
            • Set Retribution_CustomValue = (Custom value of (Picked unit))
            • Set Retribution_DummyLoc = (Position of (Picked unit))
            • Set Retribution_Movement = (Retribution_DummyLoc offset by 30.00 towards (Facing of (Picked unit)) degrees)
            • Unit - Move (Picked unit) instantly to Retribution_Movement
            • Set Retribution_DistanceTravel[Retribution_CustomValue] = (Retribution_DistanceTravel[Retribution_CustomValue] + 30.00)
            • Set Retribution_UnitGroup = (Units within 200.00 of Retribution_Movement matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of Retribution_Caster[Retribution_CustomValue])) E
            • Unit Group - Pick every unit in Retribution_UnitGroup and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ((Picked unit) is in Retribution_Damaged_Units) Equal to True
                  • Then - Actions
                    • Do nothing
                  • Else - Actions
                    • Unit - Cause Retribution_Caster[Retribution_CustomValue] to damage (Picked unit), dealing ((((Real((Intelligence of Retribution_Caster[Retribution_CustomValue] (Include bonuses)))) x 1.75) + (((Real((Level of Retribution of Overlord for Retribution_Caster[Retribution_CustomValue]))) x 120.00) + 250.00)) + (((Real((Level of Elune's Arrow for Elun damage of attack type Spells and damage type Fire
                    • Unit Group - Add (Picked unit) to Retribution_Damaged_Units
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Retribution_DistanceTravel[Retribution_CustomValue] Greater than or equal to Retribution_Distance[Retribution_CustomValue]
              • Then - Actions
                • Unit - Kill (Picked unit)
                • Unit Group - Remove (Picked unit) from Retribution_StartGroup
              • Else - Actions
            • Custom script: call RemoveLocation (udg_Retribution_DummyLoc)
            • Custom script: call RemoveLocation (udg_Retribution_Movement)
            • Custom script: call DestroyGroup (udg_Retribution_UnitGroup)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in Retribution_StartGroup) Equal to 0
          • Then - Actions
            • Custom script: call DestroyGroup (udg_Retribution_Damaged_Units)
            • Trigger - Turn off (This trigger)
          • Else - Actions


    Help me please
     
    Last edited: Nov 24, 2014
  2. n00b

    n00b

    Joined:
    Mar 21, 2008
    Messages:
    343
    Resources:
    3
    Maps:
    3
    Resources:
    3
    At a quick glance, it's probably not working because you're destroying the "Retribution_Damaged_Units" variable instead of clearing the units from that unit group. This is at the bottom of the second trigger, by the way.

    Also, it seems to me that you haven't even initialized "Retribution_Damaged_Units" anywhere. Although you might have done so in another trigger not shown
     
  3. ZiGOR

    ZiGOR

    Joined:
    Mar 17, 2012
    Messages:
    577
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Unit Group - Add (Picked unit) to Retribution_Damaged_Units

    it's after damage dealt
     
  4. Tonex

    Tonex

    Joined:
    Oct 12, 2011
    Messages:
    457
    Resources:
    0
    Resources:
    0
    Don't think this is directly related to your problem, but it seems like you're trying to make the spell MUI. However, it seems that if your code worked as intended, if the spell is cast on the same target units twice at the same time, the units would only get damaged once, as the damaged units unit group persists for all Retribution dummy units.
     
  5. ZiGOR

    ZiGOR

    Joined:
    Mar 17, 2012
    Messages:
    577
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Nope, I don't need it to be mui

    That's realy helped! Thanks))
     
  6. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    Side note: Don't use Do Nothing, it's just a bloat function.
     
  7. nhocklanhox6

    nhocklanhox6

    Joined:
    Feb 12, 2012
    Messages:
    335
    Resources:
    28
    Models:
    6
    Spells:
    21
    Tutorials:
    1
    Resources:
    28
    Don't use Group, use Hashtable :)

    • Hashtable - Create a hashtable
    • Set myHashtable = (Last created hashtable)


    • Melee Initialization
      • Events
      • Conditions
      • Actions
        • -------- ------------------------- --------
        • -------- Just an example --------
        • -------- ------------------------- --------
        • Set myIndex = (myIndex + 1)
        • Set myCaster[myIndex] = (Triggering unit)
        • -------- Remember: Use dummy handle ID, not the caster --------
        • Unit - Create 1 Footman for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
        • Set myDummy[myIndex] = (Last created unit)
        • -------- ------------------------- --------
        • -------- Get dummy's handle Id --------
        • Custom script: set udg_myHandleId[udg_myIndex]=GetHandleId(udg_myDummy[udg_myIndex])
        • -------- ------------------------- --------
        • -------- Dmg enemy --------
        • Set myGroup[myIndex] = (Units in (Playable map area))
        • Unit Group - Pick every unit in myGroup[myIndex] and do (Actions)
          • Loop - Actions
            • Set myEnemy = (Picked unit)
            • -------- Get enemy's Handle Id --------
            • Custom script: set udg_myEnemyId=GetHandleId(udg_myEnemy)
            • -------- Check if the enemy is stored to this Hashtable with key myHandleId[myIndex] or not --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (myHandleId[myIndex] is stored as a Handle of myEnemyId in myHashtable) Equal to False
              • Then - Actions
                • -------- Your code --------
                • -------- Save them to this Hashtable with key myHandleId[myIndex] so they can't not be damaged twice --------
                • Hashtable - Save Handle OfmyEnemy as myHandleId[myIndex] of myEnemyId in myHashtable
              • Else - Actions
            • -------- ------------------------- --------
        • -------- Destroy leak --------
        • Custom script: call DestroyGroup(.....................
        • Hashtable - Clear all child hashtables of child myHandleId[myIndex] in myHashtable