• 🏆 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!

Item casting activated trigger

Status
Not open for further replies.
Level 2
Joined
Aug 12, 2017
Messages
4
So this is something that I had solved before but was lost with my map with the patch in aug, I'm looking for a simple trigger (nothing fancy) that activates for example when casting. Allowing items to have custom passives, like when casting and wearing specific item you gain mana or another effect happens, in this case creating a dummy that casts an ability.
If I recall correctly I used two conditions for it to work, one I'm pretty sure being: (Item-type of (Item being manipulated)) Equal to |c0000FF00Cursed Talisman|r |c00640000(Cursed)|r

  • Cursed Talisman Aoe
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Triggering unit) Equal to (Hero manipulating item)
      • (Item-type of (Item being manipulated)) Equal to |c0000FF00Cursed Talisman|r |c00640000(Cursed)|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 35
        • Then - Actions
          • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Cursed Talisman (Dummy) to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives.
        • Else - Actions
 
Last edited by a moderator:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Events and Event Responses go together:
A unit dies -> Dying unit / Killing unit
A unit enters a region -> Entering unit
A unit spawns a summoned unit -> Summoning unit / Summoned unit

So your Event is A unit Begins casting an ability which means that the Event Responses that go along with it are all ability related:
Ability being cast, Casting unit, Target unit of ability being cast, Target point of ability being cast
(some of these depend on the type of ability being cast)

Your Event has nothing to do with an Item so item related Event Responses won't work here and if they do work it's for the wrong reason.

The fix is simple, use the correct Events/Event Responses:
  • Cursed Talisman Aoe
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YourItemAbility
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 35
        • Then - Actions
          • Set Variable CTA_Point = (Position of (Casting unit))
          • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at CTA_Point facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_CTA_Point)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Cursed Talisman (Dummy) to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives.
        • Else - Actions
Note the Events/Conditions have changed and I got rid of the Point memory leak. Using an Item ability is the same as using any other kind of ability.

Also, the If Then Else isn't needed, you could move the Random Number condition so it happens after the Ability Being Cast condition. If you wanted something special to happen if you fail the dice roll then it would make more sense to have it.
 
Last edited:
Level 2
Joined
Aug 12, 2017
Messages
4
Thanks Uncle, I appreciate the help and the knowledge, but I fear I didn't convey what exactly I needed help with. The item doesn't have an active ability but a passive one, being: "When casting there is a chance 35% chance to create dummy that casts fan of knives"
Like if a hero where to have a buff the event would be "A unit starts the effect of an ability" and the condition would be"(casting unit) has buff).
But instead of a buff enabling the passive, I'm looking for the correct condition for enabling the hero to just be wearing the item to be able to have this passive effect; "When casting there is a chance 35% chance to create dummy that casts fan of knives".

Casting could of course be substituted with attacking or attacked etc, I'm specifically looking for trigger/condition that enables custom passives to work on items.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Thanks Uncle, I appreciate the help and the knowledge, but I fear I didn't convey what exactly I needed help with. The item doesn't have an active ability but a passive one, being: "When casting there is a chance 35% chance to create dummy that casts fan of knives"
Like if a hero where to have a buff the event would be "A unit starts the effect of an ability" and the condition would be"(casting unit) has buff).
But instead of a buff enabling the passive, I'm looking for the correct condition for enabling the hero to just be wearing the item to be able to have this passive effect; "When casting there is a chance 35% chance to create dummy that casts fan of knives".

Casting could of course be substituted with attacking or attacked etc, I'm specifically looking for trigger/condition that enables custom passives to work on items.
Delete the (Ability being cast) Condition and add a new Condition to check if the (Casting unit) has the required Item. It should be a Boolean comparison with the name "Hero has item of type". Those should be the only changes needed to get it working how you want.

Remember, there are Units and Items and Unit-Types and Item-Types. A Unit or Item is an entity that exists in the game world, like something you can physically click with your mouse, and a Type is what you create inside of the Object Editor, which is like the blueprint that Units and Items are based on. For specific things you're often dealing with a Unit/Item where as more generic stuff often revolves around Unit-Types/Item-Types.

In this case it's a Boolean comparison to check if a Unit has an Item of a given Type rather than an Item comparison/Item-Type comparison which often throws people off.
 
Last edited:
Level 2
Joined
Aug 12, 2017
Messages
4
That's it! Thank you, you just saved me time and headache.
And thank you for the added wisdom, you strongly give of Jackie Chan's uncle movie vibes.
 
Status
Not open for further replies.
Top