HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Discluding Item abilities from ability cast conditions

11-15-2006, 11:31 PM#1
Pyrogasm
Hi there, I have a trigger that runs when a unit casts a spell within 650 distance of the hero, but I'm having trouble excluding item abilites (like when a unit uses a healing potion) from the conditions. I know I could just use the "Ability being cast not equal to ITEM ABILITY" condition multiple times, but I would like to find a more universal solution, and I'm wondering what type of condition I should use to do this. This is what I have so far:
Trigger:
Collapse Events
Unit - A unit Starts the effect of an ability
Conditions
Collapse Actions
Set TempPoint[1] = (Position of (Triggering unit))
Set TempPoint[2] = (Position of Planar_Mage)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Triggering unit) Not equal to Planar_Mage
((Triggering unit) is A Hero) Equal to True
(Integer((Distance between TempPoint[1] and TempPoint[2]))) Less than or equal to 650
Collapse Then - Actions
Set Force_Supression_Real = 15.00
-------- Buffs, Sound, and SFX --------
Unit - Create 1 Dummy for (Owner of Planar_Mage) at TempPoint[2] facing Default building facing degrees
Set Force_Suppression_Dummy = (Last created unit)
Unit - Add Suppression Buff to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy Planar_Mage
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Sound - Play SpellbreakerYesAttack3 <gen> at 100.00% volume, attached to Planar_Mage
Unit - Create 1 Dummy for (Owner of Planar_Mage) at TempPoint[2] facing Default building facing degrees
Unit - Add Suppression SFX to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Triggering unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Collapse Else - Actions
Do nothing
Custom script: call RemoveLocation( udg_TempPoint[1] )
Custom script: call RemoveLocation( udg_TempPoint[2] )

Should I be using the "Hero Manipulating Item" condition in there somewhere, or is there something obvious that I have missed?
11-16-2006, 12:57 AM#2
Daxtreme
You could add a trigger which detects when a unit uses an item, and sets a boolean variable with array of his player number to true, waits like 1 second and set it to false.

The above trigger could check if that boolean variable is true, and if it is it doesn't run.
11-16-2006, 05:52 AM#3
Pyrogasm
Hmmm... I see what you're saying, but that seems like it would be quite messy. If, for instance, a unit used an item and then another unit used an ability at almost the same instant, or even a little bit afterwards, the real trigger wouldn't run because the boolean would still be false. Might something like this work:
Trigger:
Collapse Trigger to Exclude Items
Collapse Events
Unit - A unit uses an item
Conditions
Collapse Actions
Set Item_Used = True
Wait .01 seconds
Set Item_Used = False
Collapse Trigger for when a Hero Casts a Spell
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
Item_Used = False
Collapse Actions
Set TempPoint[1] = (Position of (Triggering unit))
Set TempPoint[2] = (Position of Planar_Mage)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Triggering unit) Not equal to Planar_Mage
((Triggering unit) is A Hero) Equal to True
(Integer((Distance between TempPoint[1] and TempPoint[2]))) Less than or equal to 650
Collapse Then - Actions
Set Force_Supression_Real = 15.00
-------- Buffs, Sound, and SFX --------
Unit - Create 1 Dummy for (Owner of Planar_Mage) at TempPoint[2] facing Default building facing degrees
Set Force_Suppression_Dummy = (Last created unit)
Unit - Add Suppression Buff to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy Planar_Mage
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Sound - Play SpellbreakerYesAttack3 <gen> at 100.00% volume, attached to Planar_Mage
Unit - Create 1 Dummy for (Owner of Planar_Mage) at TempPoint[2] facing Default building facing degrees
Unit - Add Suppression SFX to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Triggering unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Collapse Else - Actions
Do nothing
Custom script: call RemoveLocation( udg_TempPoint[1] )
Custom script: call RemoveLocation( udg_TempPoint[2] )
Would that work, or should the time be longer?

There's got to be an easier way to do this because it's implemented in many AoS maps. Tides of Blood, for example, has a spell that triggers when a unit casts a spell in range of the hero Ash, which doesn't trigger on items. But that's probably all JASS, I woud suspect. If there's a JASS way to do this that can be explained/implemented in GUI talk, I would sure like to know about it.
11-16-2006, 12:35 PM#4
Daxtreme
I gave a 1 second wait because the boolean variable I used had an array, with the player number of the owner of the unit using the item.

Since you can't cast 2 abilities at the same time with a single unit (There's got to be a casting delay set to your unit), this shouldn't interfere.

Oh and 0.1 second can be enough too. Only testing will tell you :P

use this though:

Set Item_Used[Player number of (Owner of (Triggering unit))] = True

and check that same variable if it is false in the other trigger.
11-16-2006, 02:10 PM#5
Naakaloh
The Tides of Blood method determines if mana was used, it doesn't care about items. An interesting fact: the ToB triggers for Inquisition have nothing to do with checking mana and the ability is Devotion aura which acts only as a dummy.

Edit: Oh, sorry to answer your question. The first thing that comes to mind is generating an array or list of all the item ability IDs and then using a condition IsAbilityItemAbility or something of that sort that loops through and makes a comparison against each returning true if it finds a match.
11-16-2006, 03:12 PM#6
BertTheJasser
When item abilities are cast, the units current order is not the order of that spell, but 852008-825013 (depending on slot). So You only have to compare the current order to be smaller than or equal to 852013 and greater or equal 852008 and then skip the remaining actions. (corrected)
11-16-2006, 11:23 PM#7
Pyrogasm
Oh, why thank you for the replies. I'm glad I got this question answered, 'cause it had been giving me a problem. Daxtreme's suggestion seems to make the most sense to me, but I seem to be missing exactly what it is you're saying BertTheJasser... I'm using GUI, and item abilities don't have numbers (as far as I know), so unless you're speaking JASS (which, judging by your name, you probably are) I don't understand what you're getting at.
11-16-2006, 11:33 PM#8
TaintedReality
Every ability has an order which must be issued to use that ability. These are represented by strings in the World Editor ("thunderbolt", "slow", etc.), but in reality are long numbers. Each item slot has it's own order number - slots 1 - 6. These numbers are 852002-852007. So, you can check if the unit's last order was one of those numbers. If they were ordered one of those things, that means they used an item slot.

Quote:
I'm using GUI, and item abilities don't have numbers (as far as I know)

They actually are numbers, but that doesn't matter for this situation, Bert was talking about the orders I explained above.
11-17-2006, 06:40 AM#9
Pyrogasm
I see, well I should have thought about that. What do I have to do to find the number value of a given spell/ability? I know that Cmd + D puts the data into "Raw Data" mode, but that's not what you're saying I need to find (I'm on a Mac, but equivilent PC shortcuts will suffice). Is this information only easily accessable in WEU or other advanced editors? More information on this subject would be greatly appreciated, but if you don't have the heart to answer my new queries, then I thank you for trying anyway.
11-17-2006, 11:16 AM#10
AceHart
> What do I have to do to find the number value of a given spell/ability?


Ask the game:

Events
- Unit - A unit owned by Player 1 (Red) Is issued an order with no target
Conditions
Actions
- Custom script: call BJDebugMsg( I2S( GetIssuedOrderId() ) )


Same for the other orders.
11-17-2006, 02:30 PM#11
BertTheJasser
YOu do not have to find any numbers. It must be dynamical (except if you want to exclude some spells). You do not even have to know any of ther orderids (except the item orderids).
11-18-2006, 12:29 AM#12
Pyrogasm
Ok, I understand how this is working now, but when I used the debug message to show what orders were being issued, I got the values 852008-825013 instead. Something wrong, perhaps?
11-18-2006, 02:37 PM#13
BertTheJasser
Ohh.. sorry , you are right, I was wrong. The correct numbers are 852008 to 825013.
EDIT:852002 to 825007 are darg&drop orders.