• 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.

[Solved] Some pretty weird trigger issues (sorry for being unspecific)

Status
Not open for further replies.
Level 9
Joined
Jul 30, 2018
Messages
445
So, I've suddenly ran into a few problems, and I just don't understand what's wrong. Especially since they seem to have appeared out of nowhere and I'm sure they have worked before.

1st problem: (solved) Player loop not detecting any other players other than player 1.

Here's the trigger:
  • Initialization
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Misc_DebugMode Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Running trigger: + (Name of the current trigger))
        • Else - Actions
      • Visibility - Disable fog of war
      • Visibility - Enable black mask
      • Selection - Select Control Panel (Main) 0003 <gen> for Player 1 (Red)
      • Selection - Select Control Panel (Main) 0026 <gen> for Player 2 (Blue)
      • Selection - Select Control Panel (Main) 0029 <gen> for Player 3 (Teal)
      • Selection - Select Control Panel (Main) 0032 <gen> for Player 4 (Purple)
      • Game - Set the time of day to 6.00
      • Countdown Timer - Start Turns_Timer as a One-shot timer that will expire in 60.00 seconds
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Set Player_Count = (Player_Count + 1)
              • Player - Set the current research level of A new day (Control Panel) to 1 for (Player((Integer A)))
              • Player - Set (Player((Integer A))) Current gold to 10000
              • Player - Set (Player((Integer A))) Food cap to 7
            • Else - Actions
              • Unit - Change ownership of Player_StartingCityBuild[(Integer A)] to Player 21 (Coal) and Change color
              • Unit - Change ownership of Player_StartingCityHeroes[(Integer A)] to Player 21 (Coal) and Change color
              • Unit - Change ownership of Player_StartingCitySpells[(Integer A)] to Player 21 (Coal) and Change color
              • Unit - Change ownership of Player_StartingCityUnits[(Integer A)] to Player 21 (Coal) and Change color
              • Unit - Change ownership of Player_StartingCityDefenses[(Integer A)] to Player 21 (Coal) and Change color
              • Unit - Change ownership of Player_StartingHero[(Integer A)] to Player 21 (Coal) and Change color
              • Hero - Create Skeletal Orcs|n|cffFA5858Tier 1|r and give it to City_IndexDefense[(Integer A)]
              • Hero - Create Skeletal Orc Grunts|n|cffFA5858Tier 2|r and give it to City_IndexDefense[(Integer A)]
              • Hero - Create Necrolytes|n|cffFA5858Tier 3|r and give it to City_IndexDefense[(Integer A)]

So, there problem is with the last loop: it seems to only detect player 1 (red). If I start the game as any other color than red the player count is zero. The upgrade "A new day" won't be increased, I get no money, there's no food cap and so on. Also, strangely enough, neither the "else" function works as the ownership of the buildings are not changed (except for red player, of course).

Also, I know the variables work, as they initialized in another trigger and the other variables work.

2nd problem might or might not be related, but it feels like the (triggering player) is not working for other players, other than again red player 1.

Here's the trigger:
  • Treasure Chest PickUp
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Treasure Chest
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Misc_DebugMode Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Running trigger: + (Name of the current trigger))
        • Else - Actions
      • Set Item_TreasureLevel[(Player number of (Triggering player))] = (Random integer number between 1 and 3)
      • Set Item_TreasureHero[(Player number of (Triggering player))] = (Hero manipulating item)
      • Dialog - Clear Item_TreasureDialog[(Player number of (Triggering player))]
      • Dialog - Change the title of Item_TreasureDialog[(Player number of (Triggering player))] to Do you wis...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_TreasureLevel[(Player number of (Triggering player))] Equal to 1
        • Then - Actions
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled 1000 Gold
          • Set Item_TreasureDialogButtonG[(Player number of (Triggering player))] = (Last created dialog Button)
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled |cffffffff500 Exper...
          • Set Item_TreasureDialogButtonE[(Player number of (Triggering player))] = (Last created dialog Button)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_TreasureLevel[(Player number of (Triggering player))] Equal to 2
        • Then - Actions
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled 1500 Gold
          • Set Item_TreasureDialogButtonG[(Player number of (Triggering player))] = (Last created dialog Button)
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled |cffffffff1000 Expe...
          • Set Item_TreasureDialogButtonE[(Player number of (Triggering player))] = (Last created dialog Button)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_TreasureLevel[(Player number of (Triggering player))] Equal to 3
        • Then - Actions
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled 2000 Gold
          • Set Item_TreasureDialogButtonG[(Player number of (Triggering player))] = (Last created dialog Button)
          • Dialog - Create a dialog button for Item_TreasureDialog[(Player number of (Triggering player))] labelled |cffffffff1500 Expe...
          • Set Item_TreasureDialogButtonE[(Player number of (Triggering player))] = (Last created dialog Button)
        • Else - Actions
      • Dialog - Show Item_TreasureDialog[(Player number of (Triggering player))] for (Triggering player)

The dialog does not open up if I start the game as any other than red player, but works fine with with red player. I thought that the trigger would be conflicting with the other item pickup-triggers, but the conditions don't seem to make any difference.

3rd problem is regarding the damage detection system I'm using, Damage Engine 3.8.0.0.

Here's the trigger:
  • Conquer
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Misc_DebugMode Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Running trigger: + (Name of the current trigger))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Greater than (Life of DamageEventTarget)
          • (Owner of DamageEventTarget) Not equal to (Owner of DamageEventSource)
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of DamageEventTarget) Equal to Ship (Haven)
              • (Unit-type of DamageEventTarget) Equal to Ship (Iron Cove)
              • (Unit-type of DamageEventTarget) Equal to Ship (The Lost Port)
              • (Unit-type of DamageEventTarget) Equal to Ship (Moonshadow)
              • (Unit-type of DamageEventTarget) Equal to Zeppelin (Dragon Rock)
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Set Temp_UnitGroup[0] = (Units owned by (Owner of DamageEventTarget) matching (((Matching unit) is loaded into DamageEventTarget) Equal to True))
          • Unit Group - Pick every unit in Temp_UnitGroup[0] and do (Actions)
            • Loop - Actions
              • Set Temp_Integer[0] = (1000 x (Number of units in Temp_UnitGroup[0]))
              • Hero - Add Temp_Integer[0] experience to DamageEventSource, Show level-up graphics
              • Unit - Kill (Picked unit)
          • Custom script: call DestroyGroup(udg_Temp_UnitGroup[0])
          • Set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
          • Floating Text - Create floating text that reads Transport captured! at Temp_Point[1] with Z offset 0.00, using font size 11.00, color (100.00%, 80.00%, 0.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_Temp_Point[1])
          • Set Temp_Point[2] = ((Position of DamageEventSource) offset by ((Random real number between -25.00 and 25.00), (Random real number between -20.00 and 20.00)))
          • Floating Text - Create floating text that reads (+ + (String(Temp_Integer[0]))) at Temp_Point[2] with Z offset 0.00, using font size 10.00, color (83.00%, 35.00%, 97.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_Temp_Point[2])
          • Unit - Change ownership of DamageEventTarget to (Owner of DamageEventSource) and Change color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Greater than (Life of DamageEventTarget)
          • (DamageEventTarget is A structure) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DamageEventTarget) Not equal to (Owner of DamageEventSource)
            • Then - Actions
              • For each (Integer A) from 0 to (City_Count - 1), do (Actions)
                • Loop - Actions
                  • Set DamageEventAmount = 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DamageEventTarget Equal to City_IndexDefense[(Integer A)]
                    • Then - Actions
                      • Set City_ConquerIndex = (Integer A)
                      • Unit - Change ownership of City_IndexBuild[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexHeroes[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexSpells[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexUnits[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • For each (Integer B) from 1 to 16, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of City_IndexBuild[(Integer B)]) Equal to (Player((Integer A)))
                            • Then - Actions
                              • Multiboard - Set the text for Multiboard_Main item in column 2, row 3 to (Player_Colors[(Integer B)] + (Name of (Player((Integer B)))))
                            • Else - Actions
                      • Player - Set the current research level of City_TechGreatHall[City_ConquerIndex] to (Current research level of City_TechGreatHall[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechDefenses[City_ConquerIndex] to (Current research level of City_TechDefenses[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTavern[City_ConquerIndex] to (Current research level of City_TechTavern[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechShipyard[City_ConquerIndex] to (Current research level of City_TechShipyard[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechBarracks[City_ConquerIndex] to (Current research level of City_TechBarracks[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechMageGuild[City_ConquerIndex] to (Current research level of City_TechMageGuild[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTier3Units[City_ConquerIndex] to (Current research level of City_TechTier3Units[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTier4Units[City_ConquerIndex] to (Current research level of City_TechTier4Units[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Unit - Change ownership of City_IndexDefense[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Hero - Add 3500 experience to DamageEventSource, Show level-up graphics
                      • Set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
                      • Floating Text - Create floating text that reads City captured! at Temp_Point[1] with Z offset 0.00, using font size 11.00, color (100.00%, 80.00%, 0.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_Temp_Point[1])
                      • Set Temp_Point[2] = (Position of DamageEventTarget)
                      • Special Effect - Create a special effect at Temp_Point[2] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Temp_Point[2])
                    • Else - Actions
            • Else - Actions
              • Set DamageEventAmount = 0.00
        • Else - Actions

This is strange, as, again, I am sure the trigger has worked before, but at some point recently, it suddenly doesn't work. Seems as though the trigger didn't run at all. The mana is not draining, the floating text is not showing (which is done in the "DamageEvent" trigger), also the structure is eventually always destroyed, instead of preventing the damage and changing owner.

-----

Sorry for the long post, and sorry if the triggers seem a bit messy. I am still trying to figure this all out myself, but I've become a bit frustrated so I thought if someone could lend me hand. I'll also post the whole map if you want to take a closer look and test it your yourself.

Thanks already in advance!
 

Attachments

  • Heroes of War and Craft.w3x
    1 MB · Views: 16
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
1st trigger: Try changing the loop to use a specific variable instead of Integer A. I suspect one of the actions you're doing for P1 triggers another trigger that also uses Integer A and the loop gets messed up from that.

2nd trigger: Dialogs have always been weird for me. Put more debug messages in between parts of the actions so you can be sure of how much is actually running. Otherwise a shot in the dark: try hiding it right before showing it at the end?

3rd trigger: Seems straightforward, I don't get why it doesn't work (like 2nd). More debug messages. You're leaking a point in this line: set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
 
Level 9
Joined
Jul 30, 2018
Messages
445
Thanks for the reply!

1st trigger: Try changing the loop to use a specific variable instead of Integer A. I suspect one of the actions you're doing for P1 triggers another trigger that also uses Integer A and the loop gets messed up from that.

Yay! That worked!

2nd trigger: Dialogs have always been weird for me. Put more debug messages in between parts of the actions so you can be sure of how much is actually running. Otherwise a shot in the dark: try hiding it right before showing it at the end?

This is weird... I put up more messages, it seems as the trigger is running all the way through; all the conditions work, Player number is inserted correctly and it recognizes the Triggering Player correctly. There should be no conflicts with the temp variables... The dialog just doesn't show up.

3rd trigger: Seems straightforward, I don't get why it doesn't work (like 2nd). More debug messages. You're leaking a point in this line: set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))

Here, the problem seems to be that the trigger is not ran at all. I have that debug message right at the start (I did, just in case, add more messages inside the trigger too), but it is not showing up. I have to two triggers regarding attacking:

  • Conquer
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Misc_DebugMode Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Running trigger: + (Name of the current trigger))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Greater than (Life of DamageEventTarget)
          • (Owner of DamageEventTarget) Not equal to (Owner of DamageEventSource)
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of DamageEventTarget) Equal to Ship (Haven)
              • (Unit-type of DamageEventTarget) Equal to Ship (Iron Cove)
              • (Unit-type of DamageEventTarget) Equal to Ship (The Lost Port)
              • (Unit-type of DamageEventTarget) Equal to Ship (Moonshadow)
              • (Unit-type of DamageEventTarget) Equal to Zeppelin (Dragon Rock)
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Set Temp_UnitGroup[0] = (Units owned by (Owner of DamageEventTarget) matching (((Matching unit) is loaded into DamageEventTarget) Equal to True))
          • Unit Group - Pick every unit in Temp_UnitGroup[0] and do (Actions)
            • Loop - Actions
              • Set Temp_Integer[0] = (1000 x (Number of units in Temp_UnitGroup[0]))
              • Hero - Add Temp_Integer[0] experience to DamageEventSource, Show level-up graphics
              • Unit - Kill (Picked unit)
          • Custom script: call DestroyGroup(udg_Temp_UnitGroup[0])
          • Set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
          • Floating Text - Create floating text that reads Transport captured! at Temp_Point[1] with Z offset 0.00, using font size 11.00, color (100.00%, 80.00%, 0.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_Temp_Point[1])
          • Set Temp_Point[2] = ((Position of DamageEventSource) offset by ((Random real number between -25.00 and 25.00), (Random real number between -20.00 and 20.00)))
          • Floating Text - Create floating text that reads (+ + (String(Temp_Integer[0]))) at Temp_Point[2] with Z offset 0.00, using font size 10.00, color (83.00%, 35.00%, 97.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_Temp_Point[2])
          • Unit - Change ownership of DamageEventTarget to (Owner of DamageEventSource) and Change color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Greater than (Life of DamageEventTarget)
          • (DamageEventTarget is A structure) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Misc_DebugMode Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Condition passed
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DamageEventTarget) Not equal to (Owner of DamageEventSource)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Misc_DebugMode Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: Condition passed
                • Else - Actions
              • For each (Integer A) from 0 to (City_Count - 1), do (Actions)
                • Loop - Actions
                  • Set DamageEventAmount = 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DamageEventTarget Equal to City_IndexDefense[(Integer A)]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Misc_DebugMode Equal to True
                        • Then - Actions
                          • Game - Display to (All players) the text: ( Loop + ((String((Integer A))) + Condition passed))
                        • Else - Actions
                      • Unit - Change ownership of City_IndexBuild[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexHeroes[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexSpells[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Unit - Change ownership of City_IndexUnits[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • For each (Integer B) from 1 to 4, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of City_IndexBuild[(Integer A)]) Equal to (Player((Integer B)))
                            • Then - Actions
                              • Multiboard - Set the text for Multiboard_Main item in column 2, row ((Integer A) + 2) to (Player_Colors[(Integer B)] + (Name of (Player((Integer B)))))
                            • Else - Actions
                      • Set City_ConquerIndex = (Integer A)
                      • Player - Set the current research level of City_TechGreatHall[City_ConquerIndex] to (Current research level of City_TechGreatHall[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechDefenses[City_ConquerIndex] to (Current research level of City_TechDefenses[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTavern[City_ConquerIndex] to (Current research level of City_TechTavern[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechShipyard[City_ConquerIndex] to (Current research level of City_TechShipyard[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechBarracks[City_ConquerIndex] to (Current research level of City_TechBarracks[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechMageGuild[City_ConquerIndex] to (Current research level of City_TechMageGuild[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTier3Units[City_ConquerIndex] to (Current research level of City_TechTier3Units[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Player - Set the current research level of City_TechTier4Units[City_ConquerIndex] to (Current research level of City_TechTier4Units[City_ConquerIndex] for (Owner of DamageEventTarget)) for (Owner of DamageEventSource)
                      • Unit - Change ownership of City_IndexDefense[(Integer A)] to (Owner of DamageEventSource) and Change color
                      • Hero - Add 3500 experience to DamageEventSource, Show level-up graphics
                      • Set Temp_Point[1] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
                      • Floating Text - Create floating text that reads City captured! at Temp_Point[1] with Z offset 0.00, using font size 11.00, color (100.00%, 80.00%, 0.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_Temp_Point[1])
                      • Set Temp_Point[2] = (Position of DamageEventTarget)
                      • Special Effect - Create a special effect at Temp_Point[2] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Temp_Point[2])
                    • Else - Actions
            • Else - Actions
              • Set DamageEventAmount = 0.00
        • Else - Actions
And the event when the target unit is actually damaged:

  • Attack
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Misc_DebugMode Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Running trigger: + (Name of the current trigger))
        • Else - Actions
      • -------- Mana Cost --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsDamageSpell Not equal to True
        • Then - Actions
          • Unit - Set mana of DamageEventSource to ((Mana of DamageEventSource) - (15.00 + ((Max mana of DamageEventSource) x 0.30)))
        • Else - Actions
      • -------- Floating Text --------
      • Set Temp_Point[5] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
      • Floating Text - Create floating text that reads (String((Integer(DamageEventAmount)))) at Temp_Point[1] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.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 3.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 64.00 towards 90.00 degrees
      • Custom script: call RemoveLocation(udg_Temp_Point[5])
      • -------- Kill Units --------
      • Set Item_KilledUnits = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by DamageEventTarget in slot (Integer A)) Not equal to No item
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventAmount Greater than or equal to ((Real((Item level of (Item carried by DamageEventTarget in slot (Integer A))))) x 10.00)
                • Then - Actions
                  • Set Item_DamageOver = ((Integer(DamageEventAmount)) - ((Item level of (Item carried by DamageEventTarget in slot (Integer A))) x 10))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Item_DamageOver Less than 0
                    • Then - Actions
                      • Set Item_DamageOver = 0
                    • Else - Actions
                  • Set Temp_Integer[6] = (Random integer number between 0 and 1000)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Integer[6] Less than (250 + (Item_DamageOver x 5))
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Owner of DamageEventTarget) is an enemy of (Owner of DamageEventSource)) Equal to True
                        • Then - Actions
                          • Hero - Add ((19 + (Hero level of DamageEventTarget)) - (Integer((Current life of (Item carried by DamageEventTarget in slot (Integer A)))))) experience to DamageEventSource, Show level-up graphics
                        • Else - Actions
                      • Item - Set charges remaining in (Item carried by DamageEventTarget in slot (Integer A)) to ((Charges remaining in (Item carried by DamageEventTarget in slot (Integer A))) - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Charges remaining in (Item carried by DamageEventTarget in slot (Integer A))) Equal to 0
                        • Then - Actions
                          • Item - Remove (Item carried by DamageEventTarget in slot (Integer A))
                        • Else - Actions
                      • Set Item_KilledUnits = (Item_KilledUnits + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item_KilledUnits Greater than 0
        • Then - Actions
          • -------- Raise Dead --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DamageEventSource has an item of type Necromancers|n|cffFA5858Tier 2|r) Equal to True
            • Then - Actions
              • Set Temp_Integer[2] = (Random integer number between (Item_KilledUnits x -1) and Item_KilledUnits)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Integer[2] Greater than 0
                • Then - Actions
                  • Set Temp_Point[3] = ((Position of DamageEventSource) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
                  • Item - Create Skeletons|n|cffFA5858Tier 1|r at Temp_Point[2]
                  • Item - Set charges remaining in (Last created item) to Temp_Integer[2]
                  • Hero - Give (Last created item) to DamageEventSource
                  • Floating Text - Create floating text that reads ((String(Temp_Integer[2])) + skeletons raised) at Temp_Point[2] with Z offset 0.00, using font size 10.00, color (80.00%, 25.00%, 100.00%), and 0.00% transparency
                  • Set Temp_FloatingText[2] = (Last created floating text)
                  • Floating Text - Change Temp_FloatingText[2]: Disable permanence
                  • Floating Text - Change the lifespan of Temp_FloatingText[2] to 4.00 seconds
                  • Floating Text - Change the fading age of Temp_FloatingText[2] to 1.00 seconds
                  • Floating Text - Set the velocity of Temp_FloatingText[2] to 32.00 towards 90.00 degrees
                  • Custom script: call RemoveLocation(udg_Temp_Point[3])
                • Else - Actions
            • Else - Actions
          • -------- Kills --------
          • Set Temp_Point[4] = ((Position of DamageEventTarget) offset by ((Random real number between -50.00 and 40.00), (Random real number between -10.00 and 10.00)))
          • Floating Text - Create floating text that reads ((String(Item_KilledUnits)) + kills) at Temp_Point[1] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set Temp_FloatingText[1] = (Last created floating text)
          • Floating Text - Change Temp_FloatingText[1]: Disable permanence
          • Floating Text - Change the lifespan of Temp_FloatingText[1] to 4.00 seconds
          • Floating Text - Change the fading age of Temp_FloatingText[1] to 1.00 seconds
          • Floating Text - Set the velocity of Temp_FloatingText[1] to 32.00 towards 90.00 degrees
          • Custom script: call RemoveLocation(udg_Temp_Point[4])
          • Set Item_Hero = DamageEventTarget
          • Custom script: call WaitGameTime(0.1)
          • Trigger - Run Apply Unit Stats General <gen> (checking conditions)
        • Else - Actions

These both triggers are ran when attacking a normal unit, as is supposed to (the "Conquer" just doesn't pass any conditions), but neither of the triggers are ran when attacking a building... Which is just super weird, because there are no conditions that would prevent the trigger to be run, instead the conditions are inside the Actions, so the trigger should be ran, even if it didn't pass any single condition under Actions, right?
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,010
For the 2nd problem, trying creating another dialog variable and add buttons for that dialog and all actions refering to that variable. I remember once I had a simple trigger all it did was teleport a unit to somewhere else, the trigger was all fine but the variable unit apparently wasn't working. Somehow duplicating the variable and using that one instead worked. So it probably can be that bug in your case too.
 
Level 6
Joined
Jul 7, 2006
Messages
25
For the 2nd trigger for some reason unlike other variable types the array size for dialogue variables matter and if u just kept array size to default 1 it will only work for player one like you are experiencing, so just increasing the number to how many players in your map should fix it.

For the 3rd trigger sounds like a problem in the DDS or unit indexer excluding structures, check to make sure the following isn't enabled in the damage engine config.
  • (UDexUnits[UDex] is A structure) Equal to False
 
Level 9
Joined
Jul 30, 2018
Messages
445
Oh my gosh, guys, thank you! Everything's fixed!

I just tested out that myself thinking that maybe arrays don't work with dialogs, so I tested with a non-array variable and it worked. Glad that increasing the array size manually works too!

And that unit indexer condition was indeed exactly the problem. I remember turning it on at some point thinking that it was supposed to be turned on, without really thinking about what it actually did in the first place (even though it's quite self-explanatory :p). Good to know that too!
 
Last edited:
Status
Not open for further replies.
Top