Spell Triggers not working

bumbaclo

New Member
Reaction score
3
So I made a tentative spell for an auto-cast target spell (based off cold arrows) that temporarily (10 sec) removes a target hero's agility by 5 each attack, stackable up to 15 times. The resulting triggers are kind of a hybrid of what I was able to gather from searching on forums:

To detect autocast turned on/off:
Trigger:
  • Autocast On
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(coldarrows))
    • Actions
      • Unit Group - Add (Triggering unit) to WeaknessStore


Trigger:
  • Autocast Off
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(uncoldarrows))
    • Actions
      • Unit Group - Remove (Triggering unit) from WeaknessStore


Now, the trigger, using the GDD damage detection system:
Trigger:
  • Weakness Test
    • Events
      • Game - GDD_Damage becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource is in WeaknessStore) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of GDD_DamagedUnit) Less than 15
        • Then - Actions
          • Unit - Set the custom value of GDD_DamagedUnit to ((Custom value of GDD_DamagedUnit) + 1)
          • Hero - Modify Agility of GDD_DamagedUnit: Subtract 5
          • Wait 10.00 seconds
          • Hero - Modify Agility of GDD_DamagedUnit: Add 5
          • Unit - Set the custom value of GDD_DamagedUnit to ((Custom value of GDD_DamagedUnit) - 1)
        • Else - Actions

For those who don't know how the GDD system works, whenever the variable GDD_Damage becomes 0, means damage is being detected. Also GDD_DamagedUnit is the damaged unit, replacing Event Response - Triggering Unit, while GDD_DamageSource is the damaging unit, replacing Event Response - Damage Source.

Ive tried testing different parts of the triggers to find the problem. It seems that for some reason the units are not being added to the unit group...yet the auto-cast detection triggers are firing. For the main trigger, if I remove the condition the unit still doesn't lose any agility. I have a feeling there is more than 1 mess up in my triggers, but I can't seem to understand where. Any help please?
 

GooS

Azrael
Reaction score
154
First of, why use GDD instead of unit is attacked event?

Anyway, did you also test the Custom value condition, making sure that their custom value isn't either higher than 15 at start or something like null so it cannot make that comparison?

//==GooS
 

bumbaclo

New Member
Reaction score
3
yea i would have, except i have (or at least i think) experimentally determined that world editor doesnt consider attacking while in auto-cast either regular attacking or casting a spell, which is why i had to resort to doing this. I haven't touched the custom value of units before this and im assuming the default is 0. If it isn't is there a way to set to 0?
 

Laiev

Hey Listen!!
Reaction score
188
test if the first trigger work and if some unit is in group, this condition is much strang
 

Dave312

Censored for your safe viewing
Reaction score
269
I used these triggers and the ability worked fine.

AutoCast On/Off
Trigger:
  • Turn On AutoCast
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(coldarrows))
    • Actions
      • Game - Display to (All players) the text: Unit Turned On AutoCast
      • Unit Group - Add (Ordered unit) to WeaknessStore

Trigger:
  • Turn Off AutoCast
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(uncoldarrows))
    • Actions
      • Game - Display to (All players) the text: Unit Turned Off AutoCast
      • Unit Group - Remove (Ordered unit) from WeaknessStore


On Map Initialization I set all starting heroes on the map to have a custom value of zero.
Trigger:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in (Entire map) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in TempUnitGroup and do (Unit - Set the custom value of (Picked unit) to 0)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)


Any heroes revived or trained would also have their custom value set to zero (You could do this as separate triggers but this should work fine).
Trigger:
  • Hero Revived Spawned
    • Events
      • Unit - A unit Finishes reviving
      • Unit - A unit Finishes training a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Reviving Hero) is A Hero) Equal to True
          • ((Trained unit) is A Hero) Equal to True
    • Actions
      • Unit - Set the custom value of (Reviving Hero) to 0
      • Unit - Set the custom value of (Trained unit) to 0


And finally the trigger that reduces the agility of the hero. Note that I also included to check to ensure the hero had enough agility for it to be reduced.
Trigger:
  • Cast Weakness
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) is A Hero) Equal to True
      • ((Attacking unit) is in WeaknessStore) Equal to True
      • (Custom value of (Attacked unit)) Less than 15
      • (Agility of (Attacked unit) (Exclude bonuses)) Greater than 5
    • Actions
      • Game - Display to (All players) the text: Hero Weakened
      • Unit - Set the custom value of (Attacked unit) to ((Custom value of (Attacked unit)) + 1)
      • Hero - Modify Agility of (Attacked unit): Subtract 5
      • Wait 10.00 game-time seconds
      • Unit - Set the custom value of (Attacked unit) to ((Custom value of (Attacked unit)) - 1)
      • Hero - Modify Agility of (Attacked unit): Add 5


The Game-Text Message Actions are only there for debugging so I could tell if the triggers were actually running and are not required.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
For those who don't know how the GDD system works, whenever the variable GDD_Damage becomes 0, means damage is being detected.
GDD_Event, not GDD_Damage. :eek: I've made that mistake myself.

Also GDD_DamagedUnit is the damaged unit, replacing Event Response - Triggering Unit, while GDD_DamageSource is the damaging unit, replacing Event Response - Damage Source.
True, but in this particular case you might want to do something different. GDD's event response variables don't work with waits, like you're using. However, you can still use Triggering Unit for the damaged unit, and it will work after a wait.

(I didn't document it because waits are imprecise and generally should be avoided, but in this case, it's reasonable. Also, you might want to consider using a unit auto-indexer such as AIDS and an integer array, instead of custom value.)

Ive tried testing different parts of the triggers to find the problem. It seems that for some reason the units are not being added to the unit group...yet the auto-cast detection triggers are firing.
That'd be because the Weakness Test trigger isn't running (due to aforementioned Damage/Event mixup.) Also, testing for the presence of a buff is preferable to testing whether the unit has autocast enabled, because, for example, the trigger will inappropriately run for spell damage dealt by the unit, and won't run if the player switches off autocasting before the unit's projectile hits.


Trigger:
  • Unit - A unit Is attacked
A Unit Is Attacked is not a good event to use for abilities, because it can be abused by rapidly ordering a unit to stop and therefore firing many attack events - because that event is for when a unit starts to try to attack, not when the attack hits - thus the popularity of damage detection.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top