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

Trigger which detects when a spell is autocast.

Status
Not open for further replies.
Level 7
Joined
Sep 9, 2007
Messages
253
I want to use a variable to keep track of how many times searing arrows has been cast. Using "Unit - A unit Starts the effect of an ability" I am able to detect when the user manually cast but I don't know how to make a trigger recognize the autocast of the spell.

The reason I am trying to do this is to make a system similar to a rogue in WoW so that the unit can build up to 5 combo points by using searing arrows. It would be ideal if the autocast arrows could also be detected by a trigger.
 
  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability (this is for non-autocast)
  • Conditions
    • (Ability being cast) Equal to Searing Arrows
  • Actions
    • Set Integer1[Player Number of (Owner of (Triggering unit))] = ((Integer1[Player Number of (Owner of (Triggering unit))]) + 1)
    • If (All Conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • Integer1[Player Number of (Owner of (Triggering unit))] Equal to 5
      • Then - Actions
        • <Do the combo actions here>
      • Else - Actions
  • Trigger2
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
    • (Issued order) Equal to (order(flamingarrows))
  • Actions
    • Set FlamingArrowsOn[Player Number of (Owner of (Triggering unit))] = True
  • Trigger3
  • Events
    • Unit - A unit is attacked
  • Conditions
    • FlamingArrowsOn[Player Number of (Owner of (Attacking unit))] Equal to True
  • Actions
    • Set Integer1[Player Number of (Owner of (Attacking unit))] = (Integer1[Player Number of (Owner of (Attacking unit))]) + 1))
    • If (All Conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • Integer1[Player Number of (Owner of (Attacking unit))] Equal to 5
      • Then - Actions
        • <Combo actions here>
      • Else - Actions
  • Trigge4
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
    • (Issued order) Equal to (order(unflamingarrows))
  • Actions
    • Set FlamingArrowsOn[Player Number of (Owner of (Triggering unit))] = False
 
Level 7
Joined
Sep 9, 2007
Messages
253
After testing this... If the unit is out of mana, the ability won't work but the trigger will still fire.

Would it be sloppy to simply set the boolean variable to false if the unit's mana drops below the required amount to use the spell? problem with this would be that autocast is still active. I'm kind of imagining of a way around this using a chain of triggers and variables.

Can you think of a more efficient method than a chain of triggers?
 
In the third trigger, add this condition: (Mana of (Attacking unit)) Greater than or Equal to <mana cost of the Searing Arrows>
(Like this:)
  • Trigger3
  • Events
    • Unit - A unit is attacked
  • Conditions
    • FlamingArrowsOn[Player Number of (Owner of (Attacking unit))] Equal to True
    • (Mana of (Attacking unit)) Greater than or Equal to <mana cost of the Searing Arrows>
  • Actions
    • Set Integer1[Player Number of (Owner of (Attacking unit))] = (Integer1[Player Number of (Owner of (Attacking unit))]) + 1))
    • If (All Conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • Integer1[Player Number of (Owner of (Attacking unit))] Equal to 5
      • Then - Actions
        • <Combo actions here>
      • Else - Actions
 
Level 11
Joined
Feb 16, 2009
Messages
760
All these ways can be exploited with attack/stop spamming, allowing you to get the triggered effect without manacost and/or cooldown.

Implent a damage detection system(See the spells section), add a buff to seering arrows and check for the buff in your trigger.
 
Actually the event "A unit is attacked" fires before the attack has damaged the enemy, it is when actually the order was transmitted to the attacking unit. So, you did it this way and.. it didn't work? It actually checks if the autocast is on and if there is enough mana, so that it detects whether the attacked unit was hit by single attack or by an attack, enhanced with the bonus damage of the searing arrows.
 
Level 7
Joined
Sep 9, 2007
Messages
253
Hmm, I probably wouldn't go so far as to implement a JASS system.

- I don't necessarily need the spell to be autocast, the main thing I want is for an ability which replaces the normal attack, as far as I know they are all autocast? Given that I have to use an autocast ability I want to make the autocast work properly, otherwise it would be sloppy.

- The unit should be melee only. As searing arrows is a ranged spell I was simply going to give it a short range so that it appears melee.

- Here is the trigger I used. I was surprised but yes it doesn't work when the unit is close to 600 mana. when exactly does "a unit is attacked" fire? because if the attacking unit uses mana for the attack before the trigger is fired then it shouldn't work. The fact that it sometimes works and sometimes doesn't is strange to me, I can set it up on a test map and show you?


  • DSW Savage Strike autocast
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Mana of (Attacking unit)) Greater than or equal to 600.00
      • (Unit-type of (Attacking unit)) Equal to Darkspear Warrior
      • savage_strike_autocast Equal to True
    • Actions
      • Set temppoint = (Position of (Attacking unit))
      • Floating Text - Create floating text that reads WORKING above (Attacking unit) with Z offset 0.00, using font size 10.00, color (20.00%, 80.00%, 20.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
      • Custom script: call RemoveLocation(udg_temppoint)
This is the trigger I am using currently. I haven't set up actions yet, just using floating text while I test the events and conditions.
 
Last edited:
Then, if it was that simple, you don't need Searing Arrows ability, when you don't need any projectile changed. Now, you can do this:
  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
  • Actions
    • Set AbilityOn[Player Number of (Owner of (Triggering unit))] = True
  • Trigger2
  • Events
    • Unit - A unit is attacked
  • Conditions
    • (AbilityOn[Player Number of (Owner of (Attacking unit))] Equal to True
  • Actions
    • Set Integer1[Player Number of (Owner of (Attacking unit))] = ((Integer1[Player Number of (Owner of (Attacking unit))]) + 1)
    • Unit - Cause (Attacked unit) to damage (Attacked unit) dealing X damage of attack type y and damage type z //This will deal the extra damage you want. DON'T cause Attacking unit to damage Attacked unit, cause it will bug; use Attacked unit to damage Attacked unit.
    • If (All Conditions Are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Integer1[Player Number of (Owner of (Attacking unit))]) Equal to 5
      • Then - Actions
        • Set Integer1[Player Number of (Owner of (Attacking unit))] = 0
        • <Combo actions here!>
 
Level 11
Joined
Feb 16, 2009
Messages
760
Greenwhy, a damage detection system can be done in GUI.
Just use:
Events
Map init
A unit enters (Playable map area

Conditions

Actions
Trigger- Add to (Your trigger) the event: (Triggering unit) takes damage
If Mapinit(A boolean variable) is equal to true then:
Set TempGroup = Units in (Playable Map area)
Pick every unit in TempGroup and Trigger- Add to (Your trigger) the event: (Picked unit) takes damage
Else

Set MapInit = False.

Didn't make it in World Editor but it works.
 
Level 15
Joined
Aug 14, 2007
Messages
936
That was what I was going to say M4stah.. anyway yea
it's pretty easy to use damage detection

Just pick all units and do this action
Add to TRIGGER an event of PICKED UNIT TAKES DAMAGE
>>the above line actually add an event using a trigger with specific unit event that actually enables the use of TAKES DAMAGE
 
Status
Not open for further replies.
Top