• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Easy one for you guyz!

Status
Not open for further replies.
Level 4
Joined
Sep 14, 2011
Messages
47
Hey friends & mappers,

Is there an easy & reliable way of retrieving the source item for an item ability that is cast and detected via "A Unit Starts the Effect of an Ability" (because I need the target unit of that ability)? Or vice-versa (get the target unit somehow via "A Unit uses an Item").

The "Unit Starts the Effect" event happens before "Unit uses an Item". So I could theoretically save the target unit in a global with the first event, but I'm worried that it will not be MUI because time might pass in between the two events - or will it?

Thanks brothers! +REP for any help offered
 
Level 4
Joined
Sep 14, 2011
Messages
47
Thanks! But this didn't do exactly what I need. To be clear I need either of these:

1. A unit uses an item - Target unit of that item ability
OR
2. A unit starts the effect of an ability - The exact item that the unit used
 
Level 4
Joined
Sep 14, 2011
Messages
47
The reason is that a hero might carry two of the same type of item, but each item is not technically the same because of my game mechanics (my items gain XP and levels via hashtables).
 
Level 5
Joined
Jan 17, 2014
Messages
131
This is just a quick test map to give you the idea how to make yours. Anyway here it is:
 

Attachments

  • Test Map for Bad_Avatar.w3x
    14.2 KB · Views: 42
Last edited:
Level 2
Joined
Sep 21, 2013
Messages
22
Indexing seems so much easier.

Depends, really. If you're associating values with a specific unit, for instance, and don't want the unit to have multiple indexes in your trigger (Say, a passive that has a cooldown), then hashtables are easier (Primarily because the handle IDs of the objects can sometimes exceed the size limit of an array).

An indexing system can bypass this, but I believe indexing systems use hashtables anyway, although there may be one out there that doesn't. I'm not really sure myself.
 
Level 5
Joined
Jan 17, 2014
Messages
131
Depends, really. If you're associating values with a specific unit, for instance, and don't want the unit to have multiple indexes in your trigger (Say, a passive that has a cooldown), then hashtables are easier (Primarily because the handle IDs of the objects can sometimes exceed the size limit of an array).

An indexing system can bypass this, but I believe indexing systems use hashtables anyway, although there may be one out there that doesn't. I'm not really sure myself.

I'm sure that hashtables could be a lot easier depending on the situation. All I'm saying is, that indexing seems much more straightforward. Oh, and haven't learned how to use hashtables yet :D.
 
Level 5
Joined
Jan 17, 2014
Messages
131
Unless your map is meant to be unplayable, it shouldnt contain over 8192 units and/or items at the same time, thus indexing seems fine. Whatmore, many indexers offer option to switch to hashtable version of indexing (you can use set/get UserData safely depending on your own needs without worring about possible data changes).

Well, when the item and taeget action is finished, they can be released from the index freeing the space in the array that they were holding. Therefore for the map to be unplayable there will have to be over 1350 heroes with their inventory full with an item of 1 type and each hero using all 6 items at the same time.
 
Status
Not open for further replies.
Top