1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. 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.

Collision Problem

Discussion in 'Triggers & Scripts' started by GangSpear, Dec 13, 2011.

  1. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I am making a spell that name is Ancient Blast,but i found a problem,the problem is after the spell cast done,the units's collision still is off,can someone tell me how to fix it?Also,maybe some actions are useless or what,please tell me,i gonna delete.
    +REP to helpers!
    Here's the trigger:
    Spell Cast
    • AB Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Ancient Blast
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AB_IndexSize Equal to 0
          • Then - Actions
            • Trigger - Turn on AB Loop <gen>
          • Else - Actions
        • Set AB_IndexSize = (AB_IndexSize + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AB_IndexSize Greater than AB_IndexMaxSize
          • Then - Actions
            • Set AB_Index[AB_IndexSize] = AB_IndexSize
            • Set AB_IndexMaxSize = AB_IndexSize
          • Else - Actions
        • Set AB_Int = AB_Index[AB_IndexSize]
        • Set AB_Boolean[AB_Int] = False
        • Set AB_Boolean2[AB_Int] = False
        • Set AB_Caster[AB_Int] = (Triggering unit)
        • Set AB_TargetPoint[AB_Int] = (Target point of ability being cast)
        • Set AB_Damage[AB_Int] = (100.00 + (50.00 x (Real((Level of Ancient Blast for AB_Caster[AB_Int])))))
        • Set AB_PullingTime[AB_Int] = 200.00
        • Set AB_PushingTime[AB_Int] = 0.00
        • Unit - Create 1 NatureDummy for (Triggering player) at AB_TargetPoint[AB_Int] facing Default building facing degrees
        • Set AB_Dummy[AB_Int] = (Last created unit)
        • Set AB_DummyPoint = (Position of AB_Dummy[AB_Int])
        • Custom script: set bj_wantDestroyGroup=true
        • Unit Group - Pick every unit in (Units within 500.00 of AB_DummyPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner and do (Actions)
          • Loop - Actions
            • Set AB_PickedUnit[AB_Int] = (Picked unit)
            • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup
            • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (AB_PickedUnit[AB_Int] is dead) Equal to True
              • Then - Actions
                • Unit - Turn collision for AB_PickedUnit[AB_Int] On
              • Else - Actions
    Spell Loop
    • AB Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • For each (Integer AB_IndexLoop) from 1 to AB_IndexSize, do (Actions)
          • Loop - Actions
            • Set AB_Int = AB_Index[AB_IndexLoop]
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AB_PullingTime[AB_Int] Greater than or equal to 0.00
              • Then - Actions
                • Set AB_PullingTime[AB_Int] = (AB_PullingTime[AB_Int] - 2.00)
                • Custom script: set bj_wantDestroyGroup=true
                • Unit Group - Pick every unit in (Units within 500.00 of AB_DummyPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner and do (Actions)
                  • Loop - Actions
                    • Set AB_PickedUnit[AB_Int] = (Picked unit)
                    • Set AB_PickPoint[1] = (Position of AB_PickedUnit[AB_Int])
                    • Set AB_PickPoint[2] = (AB_PickPoint[1] offset by 5.00 towards (Facing of AB_PickedUnit[AB_Int]) degrees)
                    • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup
                    • Unit - Move (Picked unit) instantly to AB_PickPoint[2], facing AB_TargetPoint[AB_Int]
                    • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (AB_PickedUnit[AB_Int] is dead) Equal to True
                      • Then - Actions
                        • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                      • Else - Actions
                    • Custom script: call RemoveLocation(udg_AB_PickPoint[1])
                    • Custom script: call RemoveLocation(udg_AB_PickPoint[2])
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • AB_Boolean[AB_Int] Equal to True
                  • Then - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • AB_PushingTime[AB_Int] Greater than or equal to 20.00
                      • Then - Actions
                        • Set AB_Boolean2[AB_Int] = True
                        • Custom script: set bj_wantDestroyGroup=true
                        • Unit Group - Pick every unit in AB_PickGroup and do (Actions)
                          • Loop - Actions
                            • Unit - Turn collision for (Picked unit) On
                        • Custom script: call RemoveLocation(udg_AB_TargetPoint[udg_AB_Int])
                        • Custom script: call RemoveLocation(udg_AB_DummyPoint)
                      • Else - Actions
                        • Set AB_PushingTime[AB_Int] = (AB_PushingTime[AB_Int] + 1.00)
                        • Custom script: set bj_wantDestroyGroup=true
                        • Unit Group - Pick every unit in (Units within 500.00 of AB_DummyPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner and do (Actions)
                          • Loop - Actions
                            • Set AB_PickedUnit[AB_Int] = (Picked unit)
                            • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup
                            • Set AB_PickPoint[1] = (Position of AB_PickedUnit[AB_Int])
                            • Set AB_PickPoint[2] = (AB_PickPoint[1] offset by -30.00 towards (Facing of AB_PickedUnit[AB_Int]) degrees)
                            • Unit - Move (Picked unit) instantly to AB_PickPoint[2], facing AB_TargetPoint[AB_Int]
                            • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (AB_PickedUnit[AB_Int] is dead) Equal to True
                              • Then - Actions
                                • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                              • Else - Actions
                            • Custom script: call RemoveLocation(udg_AB_PickPoint[1])
                            • Custom script: call RemoveLocation(udg_AB_PickPoint[2])
                  • Else - Actions
                    • Unit - Kill AB_Dummy[AB_Int]
                    • Special Effect - Create a special effect at AB_TargetPoint[AB_Int] using war3mapImported\AncientExplode.mdx
                    • Special Effect - Destroy (Last created special effect)
                    • Special Effect - Destroy AB_SFX[AB_Int]
                    • Custom script: set bj_wantDestroyGroup=true
                    • Unit Group - Pick every unit in (Units within 500.00 of AB_DummyPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner and do (Actions)
                      • Loop - Actions
                        • Set AB_PickedUnit[AB_Int] = (Picked unit)
                        • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup
                        • Unit - Cause AB_Caster[AB_Int] to damage AB_PickedUnit[AB_Int], dealing AB_Damage[AB_Int] damage of attack type Spells and damage type Normal
                        • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (AB_PickedUnit[AB_Int] is dead) Equal to True
                          • Then - Actions
                            • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                          • Else - Actions
                    • Set AB_Boolean[AB_Int] = True
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AB_Boolean2[AB_Int] Equal to True
              • Then - Actions
                • Set AB_Index[AB_IndexLoop] = AB_Index[AB_IndexSize]
                • Set AB_Index[AB_IndexSize] = AB_Int
                • Set AB_IndexSize = (AB_IndexSize - 1)
                • Set AB_IndexLoop = (AB_IndexLoop - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • AB_IndexSize Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                  • Else - Actions
              • Else - Actions
     
  2. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Remove Set AB_DummyPoint = (Position of AB_Dummy[AB_Int]). Use AB_TargetPoint[AB_Int] instead.

    You're turnin collision off, then checking if the unit is dead and if it is, turning collision on instantly. Turn collision off in the else.

    When you use bj_wantDestroy... before picking units in AB_pickGroup, the group is destroyed. You are not creating it again, so it won't work after that as it does not exist.
     
  3. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    So what should i do?I create a new variable of unit group,after add the units into the group,then i destroy the unit group,right?
     
  4. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    One option is to use unit group array and add units into the group using the caster's index.
     
  5. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Do you mean like this?
    • Set AB_UnitGroup(AB_Int) = ...........?
     
  6. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Yes.
     
  7. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    But it still doesn't work,here the trigger how it look like:
    Trigger Cast
    • AB Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Ancient Blast
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AB_IndexSize Equal to 0
          • Then - Actions
            • Trigger - Turn on AB Loop <gen>
          • Else - Actions
        • Set AB_IndexSize = (AB_IndexSize + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AB_IndexSize Greater than AB_IndexMaxSize
          • Then - Actions
            • Set AB_Index[AB_IndexSize] = AB_IndexSize
            • Set AB_IndexMaxSize = AB_IndexSize
          • Else - Actions
        • Set AB_Int = AB_Index[AB_IndexSize]
        • Set AB_Boolean[AB_Int] = False
        • Set AB_Boolean2[AB_Int] = False
        • Set AB_Caster[AB_Int] = (Triggering unit)
        • Set AB_TargetPoint[AB_Int] = (Target point of ability being cast)
        • Set AB_Damage[AB_Int] = (100.00 + (50.00 x (Real((Level of Ancient Blast for AB_Caster[AB_Int])))))
        • Set AB_PullingTime[AB_Int] = 200.00
        • Set AB_PushingTime[AB_Int] = 0.00
        • Unit - Create 1 NatureDummy for (Triggering player) at AB_TargetPoint[AB_Int] facing Default building facing degrees
        • Set AB_Dummy[AB_Int] = (Last created unit)
        • Set AB_Group[AB_Int] = (Units within 500.00 of AB_TargetPoint[AB_Int] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy
        • Unit Group - Pick every unit in AB_Group[AB_Int] and do (Actions)
          • Loop - Actions
            • Set AB_PickedUnit[AB_Int] = (Picked unit)
            • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup[AB_Int]
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (AB_PickedUnit[AB_Int] is dead) Equal to True
              • Then - Actions
                • Unit - Turn collision for AB_PickedUnit[AB_Int] On
              • Else - Actions
                • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
        • Custom script: call DestroyGroup(udg_AB_Group[udg_AB_Int])
    Trigger Loop
    • AB Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • For each (Integer AB_IndexLoop) from 1 to AB_IndexSize, do (Actions)
          • Loop - Actions
            • Set AB_Int = AB_Index[AB_IndexLoop]
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AB_PullingTime[AB_Int] Greater than or equal to 0.00
              • Then - Actions
                • Set AB_PullingTime[AB_Int] = (AB_PullingTime[AB_Int] - 2.00)
                • Set AB_Group[AB_Int] = (Units within 500.00 of AB_TargetPoint[AB_Int] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy
                • Unit Group - Pick every unit in AB_Group[AB_Int] and do (Actions)
                  • Loop - Actions
                    • Set AB_PickedUnit[AB_Int] = (Picked unit)
                    • Set AB_PickPoint[1] = (Position of AB_PickedUnit[AB_Int])
                    • Set AB_PickPoint[2] = (AB_PickPoint[1] offset by 5.00 towards (Facing of AB_PickedUnit[AB_Int]) degrees)
                    • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup[AB_Int]
                    • Unit - Move (Picked unit) instantly to AB_PickPoint[2], facing AB_TargetPoint[AB_Int]
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (AB_PickedUnit[AB_Int] is dead) Equal to True
                      • Then - Actions
                        • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                      • Else - Actions
                        • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                    • Custom script: call RemoveLocation(udg_AB_PickPoint[1])
                    • Custom script: call RemoveLocation(udg_AB_PickPoint[2])
                • Custom script: call DestroyGroup(udg_AB_Group[udg_AB_Int])
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • AB_Boolean[AB_Int] Equal to True
                  • Then - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • AB_PushingTime[AB_Int] Greater than or equal to 20.00
                      • Then - Actions
                        • Set AB_Boolean2[AB_Int] = True
                        • Custom script: set bj_wantDestroyGroup=true
                        • Unit Group - Pick every unit in AB_PickGroup[AB_Int] and do (Actions)
                          • Loop - Actions
                            • Unit - Turn collision for (Picked unit) On
                        • Custom script: call RemoveLocation(udg_AB_TargetPoint[udg_AB_Int])
                      • Else - Actions
                        • Set AB_PushingTime[AB_Int] = (AB_PushingTime[AB_Int] + 1.00)
                        • Set AB_Group[AB_Int] = (Units within 500.00 of AB_TargetPoint[AB_Int] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy
                        • Unit Group - Pick every unit in AB_Group[AB_Int] and do (Actions)
                          • Loop - Actions
                            • Set AB_PickedUnit[AB_Int] = (Picked unit)
                            • Set AB_PickPoint[1] = (Position of AB_PickedUnit[AB_Int])
                            • Set AB_PickPoint[2] = (AB_PickPoint[1] offset by -30.00 towards (Facing of AB_PickedUnit[AB_Int]) degrees)
                            • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup[AB_Int]
                            • Unit - Move (Picked unit) instantly to AB_PickPoint[2], facing AB_TargetPoint[AB_Int]
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (AB_PickedUnit[AB_Int] is dead) Equal to True
                              • Then - Actions
                                • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                              • Else - Actions
                                • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                            • Custom script: call RemoveLocation(udg_AB_PickPoint[1])
                            • Custom script: call RemoveLocation(udg_AB_PickPoint[2])
                        • Custom script: call DestroyGroup(udg_AB_Group[udg_AB_Int])
                  • Else - Actions
                    • Unit - Kill AB_Dummy[AB_Int]
                    • Special Effect - Create a special effect at AB_TargetPoint[AB_Int] using war3mapImported\AncientExplode.mdx
                    • Special Effect - Destroy (Last created special effect)
                    • Special Effect - Destroy AB_SFX[AB_Int]
                    • Set AB_Group[AB_Int] = (Units within 500.00 of AB_TargetPoint[AB_Int] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) belongs to an enemy
                    • Unit Group - Pick every unit in AB_Group[AB_Int] and do (Actions)
                      • Loop - Actions
                        • Set AB_PickedUnit[AB_Int] = (Picked unit)
                        • Unit Group - Add AB_PickedUnit[AB_Int] to AB_PickGroup[AB_Int]
                        • Unit - Cause AB_Caster[AB_Int] to damage AB_PickedUnit[AB_Int], dealing AB_Damage[AB_Int] damage of attack type Spells and damage type Normal
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (AB_PickedUnit[AB_Int] is dead) Equal to True
                          • Then - Actions
                            • Unit - Turn collision for AB_PickedUnit[AB_Int] On
                          • Else - Actions
                            • Unit - Turn collision for AB_PickedUnit[AB_Int] Off
                    • Custom script: call DestroyGroup(udg_AB_Group[udg_AB_Int])
                    • Set AB_Boolean[AB_Int] = True
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AB_Boolean2[AB_Int] Equal to True
              • Then - Actions
                • Set AB_Index[AB_IndexLoop] = AB_Index[AB_IndexSize]
                • Set AB_Index[AB_IndexSize] = AB_Int
                • Set AB_IndexSize = (AB_IndexSize - 1)
                • Set AB_IndexLoop = (AB_IndexLoop - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • AB_IndexSize Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                  • Else - Actions
              • Else - Actions
     
  8. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You want to save all units whose collision you have modified into AP_PickGroup. When the spell ends, turn the collision on for units in the group.

    Unit group arrays only have group for indexes 0 and 1 created by default, you need to create the rest yourself.

    You're destroying the groups, but never recreating them. You need to create the group when the spell is cast.
     
  9. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
  10. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
  11. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Thanks Maker,but i don't understand this action
    • Custom script: if udg_AB_PickGroup[udg_AB_Int] == null then

    what it mean?
     
  12. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    It checks that does the group exist. If it doesn't exist, it must be created.
     
  13. GangSpear

    GangSpear

    Joined:
    Oct 25, 2009
    Messages:
    971
    Resources:
    1
    Spells:
    1
    Resources:
    1
    So,after i destroy the group and check,and i recreate the group?