HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Catching targets of Item Abilities

11-09-2003, 02:04 PM#1
Reldan
Does anyone know how to catch the target of an item ability? I have no problem doing this with normally casted abilities, but items seem to work a bit different.

For a normal unit-casted ability I'd use a trigger like this:

Event:
Unit is issued an order targeting an object

Conditions:
Issued Order is equal to Order(spellorder)

Action:
Set SpellTarget = (Target unit of issued order)

And it would work fine.

I create an item that has the item ability Holybolt (item) with the use orderstring of 'holybolt' and the trigger as written above will not fire.

Feel free to give me a complicated answer as long as it IS an answer and not mere speculation about how to solve this. I've already tried most of the obvious solutions to no avail.
11-09-2003, 02:47 PM#2
Peppar
I believe that the target is easy to acquire with (Target unit of issued order), although how to know which ability has been cast can be more difficult. Lord Vexorian made a function named GetIssuedOrderItemTypeId over at The Jass Vault which returns the item type of the item that was cast. Copy this function, select the root item in the trigger editor and paste it there.

Create a temporary item-type variable, name it temp_itemtype or similar. Then add these actions to the beginning of the trigger:

Code:
My Own Trigger
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_temp_itemtype = GetIssuedOrderItemTypeId()
        If (temp_itemtype Not equal to (ITEMTYPE)) then do (Skip remaining actions) else do (Do nothing)
11-10-2003, 12:02 AM#3
Reldan
Thanks a lot, seems to work for me. I had noticed that the orderstrings of items ranged from 826008 to 826013, but didn't realize that the item would still be there to return it's type at the time that the order event went off, so didn't think something like this would work.

That Jass Vault site is pretty cool, I'll have to bookmark it.
11-10-2003, 11:31 AM#4
Vexorian
You are welcome
Yes that JASS function vault rocks
08-07-2004, 08:53 PM#5
Gramtorn
Whenever i put in the custom code: set udg_temp_itemtype = GetIssuedOrderItemTypeId()

It brings up an error saying "expecting name", what have i done wrong?

EDIT: Ok, i'm a bit of a noob but i didn't put it in the root, now i have it has compile errors, around 5000, i'm using unlimited editor, does that effect anything?
08-07-2004, 10:52 PM#6
Vexorian
this thread is pretty old, and that is no longer needed, cause item abilities have the same event responses as normal abilities (change in patch 1.13)