| 07-31-2004, 03:09 PM | #1 |
This sounds almost criminally simple to do, but I'm at my wits' end. All I'm looking to do is have one unit exactly mirror the location of another. Let's call 'em A and B. SetUnitPosition(A, GetUnitX(B), GetUnitY(B)), looped every 25th of a second, should do the trick, right? Unofrtunately, I can never pursuade A to arrive in the same position as B. It's as if it's suffering from collision problems, but I've specially modifed A so that it has no coliision radius, movement speed or movement type, has the ghost(visible) ability and unit collision turned off, not to mention being classified as walkable. What am I doing wrong? |
| 08-01-2004, 10:40 PM | #2 |
Try making the following unit flying, just to see. |
| 08-01-2004, 11:08 PM | #3 | |
Quote:
I did experiment with a peasant and dragonhawk rider. The position matched up as perfectly as I could see, but only roughly every 3rd of a second. I reckon this is because the game engine itself only updates internal data on the unit's position every 3rd of a second. |
| 08-01-2004, 11:24 PM | #4 |
Ahhh, I may know what your problem is. Waits have a minimum duration of .25 seconds, 1/4 of one second. If you want something to happen more frequently than that, you need to use a repeating timer or a trigger event. |
| 08-02-2004, 09:40 AM | #5 | |
Quote:
I see. I rigged up a timer handler function to do this and the matchup was smooth- thanks for that. Unfortunately, the following unit is still offset slightly, and I set the movement type to fly (though the movement height is zero.) I'll have to do some more experiments with ordinary flying units. |
| 08-04-2004, 03:13 PM | #6 |
Strangely enough, setting the collision radius for the followed unit to 0 fixes the problem- though since the following unit ignores unit collisions, this baffles me. |
| 08-04-2004, 04:08 PM | #7 | |
Quote:
|
| 08-04-2004, 07:10 PM | #8 | |
Quote:
If you mean that you turned its collision off, that probably only applies when the unit is walking--not when it's moved to a specific point. |
| 08-05-2004, 09:03 AM | #9 | |
Quote:
That's what I did, yes, as I mentioned in my first post. In that case, though, why is it ignoring the Fly movement type? I mean, it also has the ghost ability, so in theory the followed unit shouldn't worry about collision with the folowing unit either way. |
