• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Collision Problem

Status
Not open for further replies.
Level 13
Joined
Oct 25, 2009
Messages
995
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:
  • 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
  • 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
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
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.
 
Level 13
Joined
Oct 25, 2009
Messages
995
But it still doesn't work,here the trigger how it look like:
  • 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])
  • 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
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
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.
 
Status
Not open for further replies.
Top