HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Stopping a unit from dropping items?

05-28-2006, 02:20 AM#1
weaaddar
The three standard order types you can detect are targetless,targetting a point, targetting a widget.

This is all well and good, but the type of "dropitem" is InstantTargetOrder/InstantPointOrder (that is a target/point and a widget which is the instanttarget) the same type as a ship dropping a unit. You can't detect this type of order using one of the standard three events.

The only way to even know this stupid order even exists is get the current order of the triggering unit when he drops an item, or a periodic monitor a single unit's order and then have it printed.

My question is how do I stop a unit in his tracks from dropping a specific item? (that is to pause him and issue an error). I want the item to still have mobility in the inventory, but I don't want you to be able to drop it.
05-28-2006, 03:34 AM#2
Pheonix-IV
wait for him to drop the item, then use triggers put it back into his inventory and issue the error. Thats the only way i can think of if you still want to be able to move the item around.
05-28-2006, 03:36 AM#3
BDSM
Yeah, that's the method I've been using. Catch the drop event then add the item back with a timer of 0 duration.
05-28-2006, 03:51 AM#4
MysticGeneral
I don't know the JASS function, but couldn't you do something like:

Events - A unit is issued an order targeting a point
Condition - Issued order is equal to "dropitem"
Action - Issue ordered unit to stop. Call SimError.

Is that what you're looking for? I don't quite understand the question.

EDIT: Just read your post a bazillion times. You can't pickup the event when a unit is issued an order to drop an item? Odd. I'll test some stuff out for ya.

EDIT2: Just tried every event (literally) to pickup when a unit is issued an order to drop an item. Nothing is working. I guess the only thing you can do is when "A unit loses an item". You just won't be able to stop him, as you already know.
05-28-2006, 04:13 AM#5
Vexorian
When units lose items I use timers to regive the item to them. And that prevents dropping. I think I was not able to avoid selling though.
05-28-2006, 04:15 AM#6
MysticGeneral
Quote:
When units lose items I use timers to regive the item to them. And that prevents dropping. I think I was not able to avoid selling though.

Thing is, is that Weaaddar wants to know the exact time they were issued the order to drop the item. Not when they drop the item itself. He wants to stop the unit from even moving when he is ordered to drop the item. Since he can't detect this, the player will always move no matter what.
05-28-2006, 04:16 AM#7
Vexorian
well that's it, no event = no blockage
05-28-2006, 04:19 AM#8
MysticGeneral
Huh?..
05-28-2006, 04:37 AM#9
BDSM
Quote:
Originally Posted by Vexorian
I think I was not able to avoid selling though.

Well, you should just be able to detect the pawn event (EVENT_PLAYER_UNIT_PAWN_ITEM) and check the sold item and the unit who sold it. Edit#2 - What Pheonix said below. Didn't even think about that; shows how long it's been since I worked with items.

Edit - even if you can't stop the actual order you can still clean up after it, albeit with a few quirks. If the player knows no better, then you were successful.
05-28-2006, 04:44 AM#10
Pheonix-IV
If you don't want an item to be sellable, just check the correct box in it's properties. You could do the same to make the item undroppable, but then you couldn't move the item around in your inventory, with sellability though, it doesn't affect anything else.
05-28-2006, 04:54 AM#11
Vexorian
Quote:
Originally Posted by MysticGeneral
Huh?..
You can't block something you can't detect, and unless we find a bug taht allows us to detect drop item orders, we can't block them

--

I just use a trigger to make an item unsellable . The problem is when you want an item to be sellable only on certain conditions, that becomes an issue
05-28-2006, 06:05 AM#12
Pheonix-IV
Make a duplicate item thats unsellable and swap between them?
05-28-2006, 03:23 PM#13
weaaddar
unfortuantly, it becomes very difficult and it seems the method of merely readding after a timer of zero can cause bugs. I've been using it for a long time, (since dt4a original) I was hoping there would be a better way. I was excited to discover that as soon as your character was on his marry way to drop an item he gets the order 852001 (which is drop item), but I couldn't find a way to get his instanttarget (the item he's dropping).

The only thing I'm thinking of doing is just changing it from cancel being droppable to double right click to exit an item from the bag.
05-28-2006, 03:31 PM#14
Vexorian
Well if the unit is close to the other unit then it wouldn't have to move to drop the item.

And if the unit is far then you can stop it.

Let's say what if while the Cancel button is in inventory you have some timer that set's it undroppable each 1 second, in a way that isn't noticeable for the player unless he tries to give the item to another unit
05-29-2006, 12:26 AM#15
SentryIII
Use the following actions in a trigger, changing (Last created item) to refer to the item in question:

Trigger:
Item - Make (Last created item) Unpawnable
Item - Make (Last created item) Undroppable