| 11-01-2009, 01:31 PM | #1 |
What I mean is: when a hero begins cast a spell, certain conditions are check and if they are not matched, pause/stop/unpause the hero to "stop" him so I want to check some conditions before an item is used, but with the same event (A unit begins casting a spell), I can't "stop" the use of the item is there any way to solve this ? |
| 11-01-2009, 01:45 PM | #2 |
| 11-01-2009, 01:48 PM | #3 |
what conditions? you could replace the item with a disabled version of itself, while they are not meet. |
| 11-01-2009, 02:11 PM | #4 |
Use the ISSUED_ORDER events and detect when they are ordered to use an item, intercept it, done. |
| 11-01-2009, 02:20 PM | #5 | |
Quote:
When the USE_ITEM event fire, the item is already used, and there is no way to stop it. I haven't read, neither test grim001's code, but maybe it fires just before the item is used. Also simply check issue_order doesn't let you know if the unit use an item or one of his ability. |
| 11-01-2009, 02:25 PM | #6 |
>what conditions? you could replace the item with a disabled version of itself, while they are not meet. err.. so I have to un-do the replacement after that ? ( I mean replace the disable version with the enable version) |
| 11-01-2009, 02:29 PM | #7 | |
Quote:
|
| 11-01-2009, 02:44 PM | #8 |
The order event run first, but you can't directly stop the order. Indirectly we can catch witch item will be used with the order (as you know 852008 == first slot, and so one). But the only way i've found to avoid the use is to put the item on a map, wait a short time (for the test i used a TSA, but a Timer(0) should also work ) and give it back to the unit. I've tested it with a potion of invulnerability, a pretty common item. |
| 11-01-2009, 02:56 PM | #9 | |
Quote:
|
| 11-01-2009, 03:01 PM | #10 |
Ok, i have not mentioned i had already tried it, for me it's pretty obvious ^^ Test it, you will see what happens. (You would need the library OrderDebug ) It works but the trigger is evaluated many times, because the unit get the order many times, which is very lame. It seems to be the rule for all no target orders events. ProTip : Instead of "stop" i prefer 851973 , because it keeps the previous immediate order if the unit had one, like "holdposition" EDIT : Turn off/on the trigger doesn't help here. |
| 11-01-2009, 03:16 PM | #11 | |
I just tested it. You do properly stop the order, but the behavior of items is that they activate right away it seems. (So the events "run" sequentially, even if the Order event callback runs first) Quote:
|
| 11-01-2009, 03:17 PM | #12 | |
Quote:
can anyone tell me how to use "function interface" ? let say I have a function named "SpellStealPrecast" which have the same parameters as "function interface UseItemFunc", how do I make the system to call "SpellStealPrecast" ? sorry but I have read the JassHelperManual but I still don't get it please help |
| 11-01-2009, 03:17 PM | #13 |
i've edited my post. Also 851973 is the stunned order, that's why it preserve the previous (or let's say current) no target order. |
| 11-01-2009, 03:17 PM | #14 | |
Vex's Tutorial. Quote:
|
| 11-01-2009, 03:20 PM | #15 |
Just like you but instead of "stop", i use 851973. |
