| 03-06-2008, 02:51 AM | #1 |
Trigger: Any reason why this code might not work? Using the game display I see that indeed the trigger runs when I right click but the unit doesn't stop moving. Any reason why "Unit - Order (Ordered unit) to hold Position" wouldn't work. If so, any other suggestions would be greatly appreciated. |
| 03-06-2008, 02:57 AM | #2 |
It seems to require that you wait 0.0 seconds before it allows you to immediately cancel the order. Some other people have recently been encountering a similar problem, though I haven't WE or WC3 handy to test it myself. Just run the following code on a 0.00 second timer callback. JASS:call PauseUnit(MyUnit, true) call IssueImmediateOrder(MyUnit, "holdposition") //Don't quote me on that orderstring, check for yourself to be sure call PauseUnit(MyUnit, false) |
| 03-06-2008, 03:13 AM | #3 | |
Quote:
Your post both gave me some very interesting results and also didn't work out quite as I hoped: It did work, in that commands no longer work, however the chat message seems to spam endlessly when I just put pause, unpause like you did there. My question is: What did you mean by a 0.00 second timer callback? Also: Why does it go through the trigger many times? The last thing is that this actually had a very good and strange effect. In my map arrow key movement causes the unit to ignore units and destructible but when it spams hold position the unit tends to now get blocked. I believe the same effect occurs each time I use a spell. Whenever I use my attack spell or another spells (based off of fan of knives if that means anything) and i am inside of a unit or destruct. it teleports my unit to the nearest clear spot. I am hoping I can exploit this to create a sort of collision system for my map without checking for units in the path of the unit. Any help on this subject as well would be great. |
| 03-06-2008, 03:27 AM | #4 | |||
Quote:
Quote:
B) Pause/HoldPosition/Unpause the specified unit in the function that is run by the timer. Might not be handy since you'd need to store the unit to the timer somehow, but if it only works for one unit (Which your code suggests) then just use the global. Quote:
|
| 03-06-2008, 12:43 PM | #5 |
I'm not sure but in a similar trigger that i'm making now and from recent experience that i got from it the order hold position is also a targetint a point order so if it works it will go to an endless loop on this trigger. You better do what rising_dusk told me in a thread with a similar question. Pause the unit then add a waiting action (for 0.01) after order the unit to stop and the unpause the unit. It won't move at all. The only problem (not serius one) is that for about half second you loose the commands of the unit from the command card. But it's only visual problem, it works fine!!!! |
| 03-06-2008, 12:47 PM | #6 |
You could fix that 'lose command ability' by simply doing what I'm suggesting and running a 0.0 second timer and pausing/holding/unpausing in the timer callback. It'll eliminate that problem entirely at virtually no extra cost to you, it just runs into possible conflicts if you use a single global variable, since 0.0 second timers aren't entirely reliable. |
| 03-09-2008, 03:38 PM | #8 |
instead of order "stop", "holdposition" or an other immediate order you can use that : JASS:call IssueImmediateOrderById(<yourUnit>,851973) 851973 is the order when a unit is pause or stun for the "first" time (if she is not already stuned or paused). when the unit is paused, it receive an location order (0,0), and when she is stuned it receive an widget order (who stun the unit). The advantage is that the unit keep his immediate order if she had one. But you need to check the order given by the pause of the unit (851973) |
| 03-09-2008, 06:38 PM | #9 |
i attach a sample map. EDIT : do you know the jass or must i be more clear ? |
| 03-09-2008, 07:08 PM | #10 |
I would suggest to do as i did a simple code Trigger: Then - Actions
![]() Unit - Pause (Ordered unit)
![]() Unit - Order (Ordered unit) to Stop
![]() Unit - Unpause (Ordered unit) |
| 03-09-2008, 07:57 PM | #11 |
Sas's Example is what I basically did, and for the most part it works out perfectly. And it seems that it might also give me a sort of collision system. My theory is that the collision size of the units is making it look weird, today I plan to change all the units C-size to a low number -50 that way I can see if this collision system could work. The great thing is it's only 3 actions in a repeating trigger and obviously it's only nessicary for arrow key movements system or to make objects using "Set X / Set Y" code to actual collide. |
