| 04-13-2006, 03:32 PM | #1 |
i want to make it so items are impossible to give directly. trying to make a trigger like Trigger: what is the order code for giving an item? |
| 04-13-2006, 05:43 PM | #2 |
Disable the condition, and add Game - Text Message (OrderToString(Order Given)) Then just start the game, give an item to someone, and see what pops up. |
| 04-13-2006, 05:55 PM | #3 |
Advanced -> Gameplay constants -> Item give range Put that to 0, and you won't be able to give items. |
| 04-13-2006, 06:03 PM | #4 | |
Quote:
Ooh. That works too. I'm curious to see if his way works too though, because if so, then I could make it so only certain players can give items. [edit] I just tested it myself. No order event is generated whatsoever when you order anything to do with items. :( Also, setting the Give Item Range to 0 does not work at all. You can still give items to allied heroes. |
| 04-14-2006, 03:51 PM | #5 |
thanks alot |
| 04-14-2006, 07:27 PM | #6 | |
Quote:
But... It doesn't work. I'd really like to know how to do this too, because I want to prevent heroes from giving items in my tutorial and in my map. |
| 04-14-2006, 08:31 PM | #7 |
I seem to recall having problems with this too. One solution is certainly to detect when an item is given, and just give it back straight away. |
| 04-14-2006, 08:35 PM | #8 |
What about JASS:native SetItemDroppable takes item i, boolean flag returns nothing |
| 04-14-2006, 08:39 PM | #9 | |
Quote:
thats jass...my map is in GUI |
| 04-14-2006, 08:50 PM | #10 | |
Quote:
That just makes the item undroppable entirely, so you couldn't even throw it on the ground, let alone sell it back to a store. Okay, I used blu's idea to get it working, but it was much more complicated than I expected. There is no way to directly detect when an item is given. Thus to detect it indirectly, we need to figure out when item acquired and item dropped events fire simultaneously. Luckily, the game fires item lost events before item acquired events, so to detect this, when an item is dropped we momentarily set its custom value to 1. If an item is simultaneously acquired, its custom value will be 1, so we simply drop it again. Here are the triggers: Trigger: Trigger: If you use a custom item system, you'll need to combine the Unit Gains Item trigger with the item acquired trigger of your item system, otherwise they will conflict. This method will also allow you to customize who can give items and to whom. If you already use the item's custom value field, you could modify this code to use a game cache instead. Attached is a sample map. Should I write a tutorial about it, or is there a tidbits thread where I can post this? |
| 04-14-2006, 09:09 PM | #11 | |
Quote:
Equals: Trigger: Item - Make (Some Item) UndroppableAlthough Vuen's concern still applies, if that matters to you. |
| 04-14-2006, 10:14 PM | #12 |
A wait of 0.00 is >0.1 in reality. |
| 04-15-2006, 10:04 AM | #13 | |
Quote:
...So? I want the wait to be as short as possible, but for it to not be zero. The "unit loses item" fires, setting the custom value to 1. Then it hits the wait, so it defers. Then "unit acquires item" fires; it sees the custom value is 1, so it drops the item. Then WC3 finishes the triggers, calculates its stuff, and draws a frame. Then it checks if it's waited long enough. Did that take longer than 0 seconds? Yup, so set the custom value back to 0. This is why I call TriggerSleepAction(0) a "frameskip", because it makes the trigger skip a frame (in multiplayer, by frame I simply mean whatever the shortest unit is of whatever synchronization means it uses). I use TriggerSleepAction(0) all over the place in my maps. |
| 04-15-2006, 10:19 AM | #14 |
Well, it's quite possible to drop an item and pick it up in 0.1 seconds, and actually recommended so it doesn't get nicked. I'd personally use a timer to get the shortest time possible. |
| 04-15-2006, 01:33 PM | #15 | |
Quote:
well. i WANT to make the item droppable...just not being able to give directly. |
