| 04-15-2011, 08:04 AM | #2 |
Trigger: ![]() Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[1]) ![]() Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[1] ![]() Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 secondsIt will basically keep waiting forever. DistanceAttack is only set once, unless some other unit is also ordered to attack (re-setting the variable and well that should key you in that it's not MUI nor MPI). You can use custom script to design your own loop that periodically resets DistanceAttack, but there are better ways. A periodic timer, combined with a decent indexing technique, can detect when the two units get within 100 distance of each other. |
| 04-16-2011, 08:11 AM | #3 |
The trigger will become a lot easier to debug if you use a loop instead of a bunch of IF- THEN - ELSE. (Integer A) is an integer value called "For Loop Integer A" in the list. Trigger: Now you have Target set up as a number between 1 and 6; and you can use Target instead of 1,2,3,4...
Thus, you don't need to repeat your trigger/code 6 times... (and it will become much more pleasant to work with / debug) Trigger: ![]() Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[Target]![]() Wait until ((Distance between ForestWarpLoc[7] and ForestWarpLoc[Target]) Less than or equal to 100.00), checking every 1.00 seconds![]() Unit - Order Mountain King 0009 <gen> to Stop![]() Unit - Order Mountain King 0009 <gen> to Attack BattleTarget[Target]![]() Wait 0.50 seconds![]() Unit - Order Mountain King 0009 <gen> to Stop![]() Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]![]() Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 secondsNotice how this is all the trigger code needed. No unecessary repetitions of trigger-actions. Also notice what Bribe said. My example trigger doesn't use DistanceAttack as a variable at all, solving your problem. You might also need to set the limit value higher than 100; depending on attack range and collision size. |
| 04-26-2011, 05:15 PM | #4 |
why do you even use that system to hit the unit ? use the order "attack once" goes like this: Code:
1. order unit a to attack once unit b 2. wait (distance / 100) seconds // (if your unit moves fast, change 100 to 150 or more, you'll find the correct number) 3. order unit a to move point your_point_away that's the idea, you solve the rest c ya |
