• 🏆 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!

[Trigger] Bug with dummy unit collisions

Status
Not open for further replies.
Does anyone know why moving the locations would not work 100% when creating and destroying then recreating and destroying seems to work better? Will likely just finish converting the system to coordinates however I was wondering how this as it is wouldn't work all the time.



What happens here is units being moved faster then the basic max of 522ms usually known as projectiles or beams being moved and then clashing/colliding with each other however the bug is no clash/collision at all dealing full damage to the main units instead of being reduced or fully clashed/0'd.


[trigger=]
improved ClashSystem
Events
Time - Every 0.06 seconds of game time
Conditions
(Number of units in CollisionGroup) Greater than 0
Actions
Unit Group - Pick every unit in CollisionGroup and do (Actions)
Loop - Actions
Set Collition1 = (Picked unit)
Custom script: call MoveLocation(udg_DatClashLoc1,GetUnitX(udg_Collition1),GetUnitY(udg_Collition1))
Unit Group - Pick every unit in CollisionGroup and do (Actions)
Loop - Actions
Set Collition2 = (Picked unit)
Custom script: call MoveLocation(udg_DatClashLoc2,GetUnitX(udg_Collition2),GetUnitY(udg_Collition2))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Collition1 Not equal to Collition2
((Owner of Collition1) is an ally of (Owner of Collition2)) Equal to False
(Collition1 is alive) Equal to True
(Collition2 is alive) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between DatClashLoc1 and DatClashLoc2) Less than or equal to 400.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Mana of Collition1) Greater than or equal to (Mana of Collition2)
Then - Actions
Unit - Set mana of Collition1 to ((Mana of Collition1) - (Mana of Collition2))
Unit - Set mana of Collition2 to 0.00
Unit - Kill Collition2
Else - Actions
Unit - Set mana of Collition2 to ((Mana of Collition2) - (Mana of Collition1))
Unit - Set mana of Collition1 to 0.00
Unit - Kill Collition1
Else - Actions
Else - Actions
[/trigger]
 
Did you create these points anywhere?
You cannot move null points, in the same way you cannot move a unit using an empty unit variable.

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set DatClashLoc1 = (Point(0.00, 0.00))
      • Set DatClashLoc2 = (Point(0.00, 0.00))

Yup which is why I have no idea why it fails from time to time, at least it is a bit rare...

  • Starter
  • Events
    • Time - Elapsed game time is 1.00 seconds
  • Conditions
  • Actions
  • Set DatClashLoc1 = (Center of (Playable map area))
  • Set DatClashLoc2 = (Center of (Playable map area))
 
Level 39
Joined
Feb 27, 2007
Messages
5,011
It's possible I don't understand your triggers/post, but you're saying this is for units moving faster than 522 right? How are they moving that fast? Surely you must have another system that is picking everything in CollisionGroup and moving them around. It is possible that your triggers are not in sync and if you aren'r interpolating additional points along the path of fast moving objects they can be moved past each other fast enough that they are never within 400.00 range to trigger a collision.

Think about 2 units directly approaching each other at 402 distance per tick (per 0.06 if the move tick rate is the same as above). If on tick A they are 401 distance apart they won't collide on that tick, then next they are moved each forward 402 distance. If they started x=0 and x=401 on A this puts them at x=402 and x=-1 on tick B, which will also fail the collision test.

If objects are moving faster than <collision radius> / <tick rate> then you will need to interpolate collisions along the way, else some can fail like the (albeit contrived) example I detailed.
 
Level 39
Joined
Feb 27, 2007
Messages
5,011
Okay well that's likely not it then. It's probably an in-sync thing then if your movement is every 0.04 but your collision is every 0.06. Humor me and try 2 different things:
  • Set the tick rate to be the same for both triggers, disable them by default, and do something like this to start them in-sync:
    • Events
      • Time - Elapsed game-time is 1.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on Trig1
      • Trigger - Turn on Trig2
  • Put the collision detection in the same trigger as the movement trigger so they definitely run at the same time. I presume you didn't do this because you might hit the OP limit with your recursive unit group loops and many units that need to be checked for collision. If you do hit that it'll be obvious because the units will stop moving and you can just reduce the total number of units temporarily for this test.
 
Level 15
Joined
Aug 14, 2007
Messages
936
Error detected: It should not be possible to use unit group within a unit group as world editor will assume that there is a chance for endless looping and thus, might cause the whole system to stop at some point. Also the editor should not be able to pinpoint which picked unit you are refering to, may be JASS might have some answers to this. How I solved this problem in the pass is by using hashtable and integer loop for the first check then unit group for the second layer check. Loops and unit group works because it does not require two picked units reference which the editor cannot know for certain since both unit groups are under the same loop much like integer loop A and integer loop A don't work on each other. (Solution to that is by using integer loop A and integer loop B or integer loop variable, if two loops are the same, the same error will come)

Judging by the video, FINAL FLASH did not collide due to this error I believe it only pushes Frieza out of the way and did not do what it was intended to do.

I also realized that you used the first unit group as the projectile and the second as the actual check, I want you to try the following.

Trigger kamehameha
Event
A unit cast an ability

Action
create missile fired
set tracker to tracker +1
set missilegroup [tracker] to last created unit

Trigger collisiondetector
Event
Every 0.03 second of the game

Action
For loop integer A, 1 to tracker
Unitgroup pick units in 300 range of missilegroup[for loop integer A] do actions
if distance between missilegroup[tracker] and picked unit less than 300 then
collision detected.
else do nothing.
 
Last edited:
Status
Not open for further replies.
Top