• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Turning Collision Off not working

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I want to have two units right on top of each other while I move them around in a custom movement system. I need to be able to select one of them with a trigger, so they cannot both have the locust ability.

For some reason, I can't get collision to shut off...they still can't move over each other. I turned collision off on both units with a trigger, put their collision size to 0, made one of them flying and the other amphibious, and gave them both the Ghost ability. None of that fixed it.

I swear this can be done, what am I missing?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Any unit has at least 1 collision size, even if it's flying. Try setting the Movement Type of the Flying Unit to "None", that way it has no collision.
 
Level 14
Joined
Aug 30, 2004
Messages
909
The JASS community helpfully gave me the: call SetUnitX (udg_Controller, udg_x), script a while ago. I've been using that, but it's not working still.

I tried setting the flying unit's movement type to zero, giving it the storm crow form so I can assign it a flying height. It still is colliding with the other unit. I gave it locust as well, but that didn't work either.

I really don't understand... I thought when turned a unit's collision off it...well, turned off their collision.

I think I found a work around by just hiding one of the units and not forcing it follow the other around. Still, it's an odd limitation.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Here is the repeat trigger. It picks all the boats in the custom movement system (in unitGroup FliersUG) and then moves them all in the right direction and turns their facing based on their speed, the water current they're in, and so forth.

  • Basic Repeater
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- MOVE --------
      • Unit Group - Pick every unit in FliersUG and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • Set tempInteger = (Custom value of u)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Ballista
            • Then - Actions
              • Trigger - Run Ballista Move <gen> (checking conditions)
            • Else - Actions
              • Trigger - Run Current Move <gen> (checking conditions)
      • Custom script: set udg_x = GetUnitX(udg_Fliers[1])
      • Custom script: set udg_y = GetUnitY(udg_Fliers[1])
      • Custom script: call SetUnitX (udg_Controller, udg_x)
      • Custom script: call SetUnitY (udg_Controller, udg_y)
      • Unit - Set life of Controller to (Percentage life of Fliers[1])%
After the trigger "Run Current Move" moves the boats, the next four custom scripts move the dummy controller (the unit that doesn't have locust, that is controlled by the user) to the location of Fliers[1], the boat that is visible but doesn't receive orders.

My start up trigger contains:

  • Unit - Turn collision for Fliers[1] Off
  • Unit - Turn collision for Controller Off
The trigger that is called is given below, but it's a lot of text:

  • Current Move
    • Events
    • Conditions
    • Actions
      • Unit - Make u face FlierFacing[tempInteger] over 0.00 seconds
      • Custom script: set udg_x = GetUnitX(udg_u)
      • Custom script: set udg_y = GetUnitY(udg_u)
      • Set x = (x + ((Cos(CurrentWaterDirection[tempInteger])) x CurrentWaterSpeed[tempInteger]))
      • Set y = (y + ((Sin(CurrentWaterDirection[tempInteger])) x CurrentWaterSpeed[tempInteger]))
      • Set x = (x + ((Cos((Facing of Fliers[tempInteger]))) x FlierSpeed[tempInteger]))
      • Set y = (y + ((Sin((Facing of Fliers[tempInteger]))) x FlierSpeed[tempInteger]))
      • Set tempPoint = (Point(x, y))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at tempPoint of type Floatability is off) Equal to True
        • Then - Actions
          • -------- *******check point with polar offset, 90 degrees in both directions for pathability******** --------
          • Unit - Set life of u to ((Percentage life of u) - 5.00)%
        • Else - Actions
          • Custom script: call SetUnitX (udg_u, udg_x)
          • Custom script: call SetUnitY (udg_u, udg_y)
      • Custom script: call RemoveLocation (udg_tempPoint)
      • -------- ------- --------
      • -------- turn --------
      • -------- ------- --------
      • Set math_1 = (FlierTurn[tempInteger] - FlierFacing[tempInteger])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • math_1 Less than 0.00
        • Then - Actions
          • Set math_1 = (math_1 + 360.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • math_1 Less than 1.00
              • math_1 Greater than 359.00
        • Then - Actions
          • Set FlierFacing[tempInteger] = FlierTurn[tempInteger]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • math_1 Greater than 180.00
            • Then - Actions
              • Set FlierFacing[tempInteger] = (FlierFacing[tempInteger] - 1.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FlierFacing[tempInteger] Less than 0.00
                • Then - Actions
                  • Set FlierFacing[tempInteger] = (FlierFacing[tempInteger] + 360.00)
                • Else - Actions
            • Else - Actions
              • Set FlierFacing[tempInteger] = (FlierFacing[tempInteger] + 1.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FlierFacing[tempInteger] Greater than 360.00
                • Then - Actions
                  • Set FlierFacing[tempInteger] = (FlierFacing[tempInteger] - 360.00)
                • Else - Actions
      • -------- ------- --------
      • -------- adjust water current --------
      • -------- ------- --------
      • Set math_1 = (CurrentWaterDirection[tempInteger] - TargetWaterDirection[tempInteger])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Abs(math_1)) Less than 3.00
              • (Abs(math_1)) Greater than 357.00
        • Then - Actions
          • -------- current water = target --------
          • Set CurrentWaterDirection[tempInteger] = TargetWaterDirection[tempInteger]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • math_1 Less than 0.00
            • Then - Actions
              • Set math_1 = (math_1 + 360.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • math_1 Greater than 180.00
            • Then - Actions
              • Set CurrentWaterDirection[tempInteger] = (CurrentWaterDirection[tempInteger] + 2.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CurrentWaterDirection[tempInteger] Less than 0.00
                • Then - Actions
                  • Set CurrentWaterDirection[tempInteger] = (CurrentWaterDirection[tempInteger] + 360.00)
                • Else - Actions
            • Else - Actions
              • Set CurrentWaterDirection[tempInteger] = (CurrentWaterDirection[tempInteger] - 2.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CurrentWaterDirection[tempInteger] Greater than 360.00
                • Then - Actions
                  • Set CurrentWaterDirection[tempInteger] = (CurrentWaterDirection[tempInteger] - 360.00)
                • Else - Actions
      • -------- speed --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CurrentWaterSpeed[tempInteger] Greater than TargetWaterSpeed[tempInteger]
        • Then - Actions
          • Set CurrentWaterSpeed[tempInteger] = (CurrentWaterSpeed[tempInteger] - 0.05)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CurrentWaterSpeed[tempInteger] Less than TargetWaterSpeed[tempInteger]
            • Then - Actions
              • Set CurrentWaterSpeed[tempInteger] = (CurrentWaterSpeed[tempInteger] + 0.05)
            • Else - Actions
Anyway, I can work around it well enough I think, but I just don't understand how collision works if you can turn it off on two units and they still block each other.
 
Status
Not open for further replies.
Top