• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Any way to detect item slot change?

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
Over the weekend, I redid all the orb effects in my map - basically, you always have an orb effect and triggers detect which one to apply. The first item in your inventory that has an orb effect is used and it currently updates every time you pick up or drop an item. It would just be nice, mostly, if it would update when you reorder your inventory as well.

Now it's not really important since you don't really want to be getting more than one orb effect lol, but it would be kind of cool to be able to swap two orbs on the fly. Might make some new strategies or something.

Anyway, as the title says, is there some way to detect when an item changes slot?
 
Actually, yes, there is.
Swapping the position of items in the inventory is indeed an order, albeit not listed in GUI and it doesn't have an actual order string.

852002 to 852007 (moveslot): These are item targeted orders that move the target item to a certain inventory slot of the ordered hero. The id 852002 will move it to slot 1, the id 852003 will move it to slot 2 and so on.

I don't know which event you have to use to "detect" these orders (Immediate order? Target order? Try both!), but at least you know which order ID you need to check against.


... but if you really think about it: what prevents you from just periodically scanning the inventory positions of the used items? I think you are making this more complicated than it is.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
... but if you really think about it: what prevents you from just periodically scanning the inventory positions of the used items? I think you are making this more complicated than it is.
Yeah, its really that simple as Zwiebelchen imply. Just store the items in a variable and what slot and if it's not the same as before its detected you kinda detect item is moving.

As for event detection I haven't tested that as I use periodic checks myself. It could trigger unit order event maybe.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Ya I'll have to mess around with it.

The code to update what orb effect to apply just loops over the inventory until it finds an item that has an orb effect (just checks item IDs), so I can just rerun that code whenever I detect the item slot change. I mostly want to make sure I am not doing this all the time since it would be a waste of processing.
 
Status
Not open for further replies.
Top