| 02-21-2004, 05:27 PM | #1 |
In order for a hero in my game to use certain abilities, he needs to have a certain charged-item in his inventory. Now, using the event "Unit loses an item" seems to actually fire before the item is actually lost (I use a loop to print the name of each item in his inventory, and the item is certainly there). Using the variable-naming exploit, I can get this to work by inserting a 0.01 second wait just after assigning the name of the unit -- but does anyone know a better way? |
| 02-21-2004, 05:50 PM | #2 |
Ok, this aroused my curiosity, so I ran a test case in the world editor for myself. Sure enough, it fires before the unit acutally loses the item. But I think I might know why. It responds to the order, not the actual event. So, when you order your unit to drop an item, the trigger runs. The item may still be in the invetory. Now, my question to you is, what problem is this causing? EDIT: NM, that doesnt seem right either. the trigger wont run if you give the drop order for a spot on the other side of the map. it must then be a delay in clearing out some stored data in the code, which your "display game text" trigger is outpacing the software on. so yeah, just add a short delay before running your actions. |
| 02-21-2004, 10:12 PM | #3 |
You don't need local variables, just add a Wait 0 seconds and done, (triggering unit and item being manipulated will still work) |
| 02-21-2004, 10:29 PM | #4 | |
Quote:
Not for me. Using wait 0.01 as the first line of code works though, but I don't trust it. |
| 02-22-2004, 12:37 AM | #5 |
unfortuantly a wait of 0 seconds is quite a big amount of time. The best way to do is a timer of zero seconds. If you'd like to see implementation as to how i did it or so check drag and drop backpack. |
