Detect Missile to Missile Collision (GUI)

maploxy

New Member
Reaction score
0
I am making a map where each player controls a unit that fires a missile in a direction. If the missile hits an enemy, that enemy and the missile are killed, and if it hits a missile, both missiles are killed. I have sorted out the missile to unit collision, but the missile to missile collision is something that I once to be easy but now proving quite challenging...

At the moment I am using a 'Time Periodic - every 0.01 seconds' to check the positions of every missile on the map and using the 'Math - Distance between points' to check if they are colliding. This is because I cannot use the 'Get Units in Range of Point' function as the missiles have the locust ability and apparently units with locust are not included in this function.

It seems that the collision is detected in part because one of the missiles always dies upon collision, but I cannot figure out how to kill both missiles.

PLEASE HELP!
 

vypur85

Hibernate
Reaction score
803
Locust units can be picked via 'Unit group - Units of Type'.
Use that and then check distance between missiles, and then kill both units upon detection.

Alternatively, you can add the missiles into Unit groups upon creation, and then check distance and kill both upon detection.

Either way would be fine. :)
 

Dirac

22710180
Reaction score
147
First increase the every 0.01 to 0.03.

Only one of the missiles is killed because when the first one picks the another one, it kills it, but then the other one already dead can't kill the original one

Make sure that every time your missile kills a missile it also kills itself
 

maploxy

New Member
Reaction score
0
Thanks guys but i think I have to give a bit more detail so you can really see the problem. Below is the trigger for projectile on projectile collision detection. Necrobolt is the name of spell and projectile and 'necrobolt_group' is the unit group that every projectile is placed in upon entering the map.

Code:
Events:
  - Time - Every 0.01 seconds of game time
Conditions:
Actions:
  - Set necrobolt_tempgroup = necrobolt_group
  - For each (Integer A) from 1 to (Number of units in necrobolt_tempgroup), do (Actions)
    - Loop - Actions
      - Set necrobolt_dummy = (Random unit from necrobolt_tempgroup)
      - Unit Group - Pick every unit in necrobolt_group and do (Actions)
        - Loop - Actions
          - If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            - If - Conditions
              - And - All (Conditions) are true
                - Conditions
                  - ((Picked unit) is alive) equal to true
                  - (Distance between (position of necrobolt_dummy) and (position of (picked unit))) Less than of equal to 40.00
                  - (Picked unit) not equal to necrobolt_dummy
              - Then - Actions
                - Unit - Kill (Picked unit)
                - Unit - Kill (necrobolt_dummy)
                - Unit Group - Remove necrobolt_dummy from necrobolt_group
                - Unit Group - Remove (Picked unit) from necrobolt_group
              - Else - Actions
      - Unit Group - Remove necrobolt_dummy from necrobolt_tempgroup

If there is an easier way to post GUI then please tell me!
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Go into the Trigger Editor.
Right-click on the name of the trigger, above 'Events'.
Select 'Copy As Text...'.

Come back here to the forums, and paste your code betweem [noparse]
Trigger:
[/noparse] tags.
 

maploxy

New Member
Reaction score
0
Go into the Trigger Editor.
Right-click on the name of the trigger, above 'Events'.
Select 'Copy As Text...'.

Come back here to the forums, and paste your code betweem [noparse]
Trigger:
[/noparse] tags.

thanks, ill remember that when i run into more problems :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top