• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

I have problems with 2 passive Abilities

Level 3
Joined
Nov 1, 2023
Messages
18
I have a problem with this trigger, sometimes when I kill 50 enemies it gives me one agility, sometimes it doesn't. Is it a bug or is there something wrong with the trigger?

  • Agility Bonus On Kills
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Kills_Count[1] = 0
      • Set VariableSet Kills_Count[2] = 0
      • Set VariableSet Kills_Count[3] = 0
      • Set VariableSet Kills_Count[4] = 0
      • Set VariableSet Kills_Count[5] = 0
      • Set VariableSet Kills_Count[6] = 0
  • Add Agility On 50 Kills
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Devotion Aura X for (Killing unit)) Greater than 0
      • ((Killing unit) is A Hero) Equal to True
      • ((Killing unit) belongs to an ally of (Triggering player).) Equal to True
    • Actions
      • Set VariableSet TempUnit = (Killing unit)
      • Set VariableSet Kills_Count[(Player number of (Owner of TempUnit))] = (Kills_Count[(Player number of (Owner of TempUnit))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills_Count[(Player number of (Owner of TempUnit))] Greater than or equal to 50
        • Then - Actions
          • Hero - Modify Agility of TempUnit: Add 1.
          • Set VariableSet Kills_Count[(Player number of (Owner of TempUnit))] = 0
          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Floating Text - Create floating text that reads +|cff00ffff1|r |cff... above TempUnit with Z offset 50.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 1.00% transparency
          • Wait 2.00 game-time seconds
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Destroy (Last created floating text)
        • Else - Actions

I made a trigger where you have a 30% chance of a meteorite falling on 4 random enemies within a radius of 1000, the problem is that it doesn't show me the effect of the meteorite falling on their heads and I don't understand why.

  • Meteor Passive
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Devotion Aura X for (Attacking unit)) Greater than 0
      • (Random real number between 1.00 and 100.00) Less than or equal to 30.00
    • Actions
      • Set VariableSet Meteor_Caster = (Attacking unit)
      • Set VariableSet Meteor_Target = (Attacked unit)
      • Set VariableSet Meteor_Group = (Units within 1000.00 of (Position of Meteor_Target) matching ((((Matching unit) belongs to an enemy of (Owner of Meteor_Caster).) Equal to True) and (((Matching unit) is alive) Equal to True)).)
      • For each (Integer Meteor_Loop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set VariableSet Meteor_RandomUnit = (Random unit from Meteor_Group)
          • If (Meteor_RandomUnit Not equal to No unit) then do (Set VariableSet Meteor_Point = (Position of Meteor_RandomUnit)) else do (Do nothing)
          • Special Effect - Create a special effect at Meteor_Point using Abilities\Spells\Other\Meteor\MeteorMissile.mdl
          • Unit - Create 1 Dummy[Meteor] for (Owner of Meteor_Caster) at (Meteor_Point offset by (0.00, 0.00)) facing Default building facing degrees
          • Unit - Cause Meteor_Caster to damage Meteor_RandomUnit, dealing 30.00 damage of attack type Chaos and damage type Universal
          • Custom script: call RemoveLocation(udg_Meteor_Point)
          • Unit Group - Remove Meteor_RandomUnit from Meteor_Group.
      • Custom script: call DestroyGroup(udg_Meteor_Group)
 
Last edited:
Level 32
Joined
Aug 29, 2012
Messages
1,460
For the 1st trigger, ((Killing unit) belongs to an ally of (Triggering player).) Equal to True means that it only works when you kill an ally unit, is that what you really want?

For the second, does the damage portion work but no effect is shown, or does nothing work at all? You could create the effect at the origin of the affected unit instead of relying on points to see if that's any better.
 
Level 12
Joined
Aug 24, 2022
Messages
438
Does your meteor trigger works? I mean, just the special effect doesn’t play?

I suggest changing “unit is attacked” to “unit takes damage”, since the first one can be triggered without finishing the attack.

Did you try to remove the integer 1 to 4? Check if it works completely with only one target.

I didn’t see anything wrong for now, so my suggestion is to cut your trigger line by line and test it until it works entirely.



EDIT: I also suggest to insert “Game Message” below each line of your spell, to print on the screen if the correct value is being set. Like that random number between 1 and 100. With this, you’ll have a visual feedback about how your trigger is working.
 
Last edited:
Level 3
Joined
Nov 1, 2023
Messages
18
I modified the trigger and now I have 2 problems :)) I use damage engie and I thought it would be better to integrate it into the triggers I hope I did the right thing :D

1. The text with 30 damage appears and after it appears a second later the effect appears.

2. If the unit is moving when it falls the effect falls behind it does not follow it :(


  • Meteor Passive
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of Devotion Aura X for DamageEventSource) Greater than 0
      • IsDamageRanged Equal to True
    • Actions
      • Set VariableSet Meteor_Caster = DamageEventSource
      • Set VariableSet Meteor_Target = DamageEventTarget
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Meteor_Caster has an item of type Boots of Speed) Equal to True
        • Then - Actions
          • Set VariableSet Meteor_Chance = 40.00
          • Set VariableSet Meteor_Damage = 40.00
        • Else - Actions
          • Set VariableSet Meteor_Chance = 30.00
          • Set VariableSet Meteor_Damage = 30.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to Meteor_Chance
        • Then - Actions
          • Set VariableSet Meteor_Group = (Units within 1000.00 of (Position of Meteor_Target) matching ((((Matching unit) belongs to an enemy of (Owner of Meteor_Caster).) Equal to True) and (((Matching unit) is alive) Equal to True)).)
          • For each (Integer Meteor_Loop) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set VariableSet Meteor_RandomUnit = (Random unit from Meteor_Group)
              • If (Meteor_RandomUnit Not equal to No unit) then do (Set VariableSet Meteor_Point = (Position of Meteor_RandomUnit)) else do (Do nothing)
              • Special Effect - Create a special effect at Meteor_Point using Abilities\Spells\Demon\RainOfFire\RainOfFireTarget.mdl
              • Unit - Cause Meteor_Caster to damage Meteor_RandomUnit, dealing Meteor_Damage damage of attack type Chaos and damage type Universal
              • Custom script: call RemoveLocation(udg_Meteor_Point)
              • Unit Group - Remove Meteor_RandomUnit from Meteor_Group.
          • Custom script: call DestroyGroup(udg_Meteor_Group)
        • Else - Actions
 
Last edited:
Level 3
Joined
Nov 1, 2023
Messages
18
I believe what you wanted is ((Killing unit) belongs to an enemy of (Triggering player) instead, that's an easy fix for the 1st trigger :)

I did as you said and it doesn't work as I want.
I would like it to give me 1 agility if an ally kills 50 enemies, I don't have to kill them myself. It should work like 25 for me to kill and 25 for an ally. I hope it's clear what I want.

  • Add Agility On 50 Kills
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Devotion Aura X for (Killing unit)) Greater than 0
      • ((Killing unit) is A Hero) Equal to True
      • ((Killing unit) belongs to an enemy of (Triggering player).) Equal to True
    • Actions
      • Set VariableSet TempUnit = (Killing unit)
      • Set VariableSet Kills_Count[(Player number of (Owner of TempUnit))] = (Kills_Count[(Player number of (Owner of TempUnit))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills_Count[(Player number of (Owner of TempUnit))] Greater than or equal to 50
        • Then - Actions
          • Hero - Modify Agility of TempUnit: Add 1.
          • Set VariableSet Kills_Count[(Player number of (Owner of TempUnit))] = 0
          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Floating Text - Create floating text that reads +|cff00ffff1|r |cff... above TempUnit with Z offset 50.00, using font size 6.00, color (100.00%, 100.00%, 100.00%), and 1.00% transparency
          • Wait 2.00 game-time seconds
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Destroy (Last created floating text)
        • Else - Actions
 
Level 12
Joined
Aug 24, 2022
Messages
438
1. The text with 30 damage appears and after it appears a second later the effect appears.
Is it the same floating text? If not, maybe you have another trigger that is printing the damage for you with the new damage system.

2. If the unit is moving when it falls the effect falls behind it does not follow it
Your location variable is being set on "position of unit", which is fixed. Try setting your variable in the unit itself, like this:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Damage Target) using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
      • Special Effect - Destroy (Last created special effect)
Note: Even destroying the special effect right away it is created, it'll still play until the end.

I would like it to give me 1 agility if an ally kills 50 enemies, I don't have to kill them myself. It should work like 25 for me to kill and 25 for an ally. I hope it's clear what I want.
Your problem, I think is your Kills_Count variable. It is adressed to each player (Owner of Temp_Unit), which means if the killing unit is player 2, Kills_Count[2] is being updated, not the variable from the hero with this ability. I don't know exactly how your ability works in-game, but if ALL heroes have this ability, you can use a "Integer 1 to 6" to add the value to all adressed Kills_Count. If not, I think you'll have to define a specific variable for the chosen hero, and activate the trigger only when the game has this hero (to prevent executions without necessity).
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,947
Just adding some random info:

1) Do not use "Temp" variables in any triggers that have the A unit Dies Event. Instead, use unique variables created specifically for that trigger. This is because the Event breaks the trigger queue rules and runs it's actions immediately. This makes overwriting the values of shared global variables a common problem.

2) Quoting Barbafire:
Note: Even destroying the special effect right away it is created, it'll still play until the end.
This is true, MOST of the time. Not every Model in the game will follow these rules. It depends if the model has a Death animation or not. This thread contains an example of handling cases where a Special Effect needs to have it's destruction delayed in order to avoid issues like this (scroll down to see my reply + a demo map).

3) Waits are almost always a "nooby trap" that get used because they're quick and convenient but cause tons of bugs if not handled carefully. This is NOT safe:
  • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIem\AIemTarget.mdl
  • Floating Text - Create floating text that reads +|cff00ffff1|r |cff... above TempUnit with Z offset 50.00, using font size 6.00, color (100.00%, 100.00%, 100.00%), and 1.00% transparency
  • Wait 2.00 game-time seconds
  • Special Effect - Destroy (Last created special effect)
  • Floating Text - Destroy (Last created floating text)
(Last created special effect) and (Last created floating text) quite literally mean the most recent of these to be created. This means that any other trigger that creates a Sfx/Floating Text during those 2.00 seconds will become the new "Last created...". This can result in your old Sfx/Floating Text sticking around permanently while your newer ones are destroyed too early.

There's a bunch of ways to fix this problem:
  • Local variables. They cannot be changed by outside sources and are unique to the instance of the trigger that created them. Not so easy in GUI.
  • Global arrays using clever indexing techniques. The techniques depend on the situation. I have links in my signature.
  • Sometimes there are built-in solutions, Floating Text in particular has Actions to automate the destruction process. Search Hive for an example.
  • Use a solution like the one in the thread I linked. Systems can often automate these processes and make your life a lot easier.

4) Your "Meteor_Loop" should avoid ALL of the logic when there's no random unit, not just the creation of the Point:
  • For each (Integer Meteor_Loop) from 1 to 4, do (Actions)
    • Loop - Actions
      • Set VariableSet Meteor_RandomUnit = (Random unit from Meteor_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Meteor_RandomUnit Not equal to No Unit
        • Then - Actions
          • Unit Group - Remove Meteor_RandomUnit from Meteor_Group.
          • Special Effect - Create a special effect attached to the origin of Meteor_RandomUnit using Abilities\Spells\Demon\RainOfFire\RainOfFireTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause Meteor_Caster to damage Meteor_RandomUnit, dealing Meteor_Damage damage of attack type Chaos and damage type Universal
        • Else - Actions
Note that I changed the Special Effect to be attached to the unit. I also organized the Actions so that damage is dealt last which was very intentional. By doing this I can help avoid the issues I described in #1 about "A unit Dies". Understand that the damage could be lethal and kill the unit, so by ensuring that your variables and other important data is handled beforehand can prevent this data from getting overwritten too early. This is more of a safety precaution and not a guaranteed solution.
 
Last edited:
Top