• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Trigger Not Working When Event Occurs

Status
Not open for further replies.
Level 9
Joined
Jul 8, 2013
Messages
249
I have been struggling for hours with one trigger which is mysteriously not working all the time.


Basically the trigger is supposed to randomly spawn spiders when the player attacks egg sack or web destructibles. And it gives a warning the first time the player does this.

After noticing it didn't seem to work when it should, I added a line to give me a message whenever it procced. Sure enough, it wasn't being triggered all the times it was supposed to be.


  • Spawn Spiders from Eggs and Web
    • Events
      • Destructible - A destructible within (Playable map area) dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Destructible-type of (Dying destructible)) Equal to Web
          • (Destructible-type of (Dying destructible)) Equal to Web (Less Space Version)
          • (Destructible-type of (Dying destructible)) Equal to Egg Sack
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarnedAlready Equal to False
        • Then - Actions
          • Cinematic - Send transmission to (All players) from Galgarath named Galgarath: Play No sound and display Careful! There coul.... Modify duration: Set to 4.00 seconds and Don't wait
          • Set WarnedAlready = True
        • Else - Actions
      • Set TempInt = (Random integer number between 1 and 16)
      • Game - Display to (All players) the text: (String(TempInt))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInt Less than or equal to 2
        • Then - Actions
          • Set TempPoint = (Position of (Dying destructible))
          • Unit - Create 1 Cave Spiderling for Player 12 (Brown) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempInt Equal to 3
            • Then - Actions
              • Set TempPoint = (Position of (Dying destructible))
              • Unit - Create 1 Ebon Cave Spider for Player 12 (Brown) at TempPoint facing Default building facing degrees
              • Custom script: call RemoveLocation (udg_TempPoint)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt Equal to 4
                • Then - Actions
                  • Set TempPoint = (Position of (Dying destructible))
                  • Unit - Create 1 Emerald Spellslayer for Player 12 (Brown) at TempPoint facing Default building facing degrees
                  • Custom script: call RemoveLocation (udg_TempPoint)
                • Else - Actions

Sometimes this happens and sometimes it doesn't. I've done all kinds of tests to figure out why. As far as I can tell now, it only works on destructibles in certain parts of the map.

Does anyone know why that would be?
 
Level 18
Joined
May 11, 2012
Messages
2,103
"Sometimes this does not happen" because sometimes your random number between 1 and 16 isn't either 2 nor 3 nor 4.
You should put another action on else part of last ITE, so if neither of those numbers are hit, a unit will be created.
 
Level 9
Joined
Jul 8, 2013
Messages
249
No, that's obviously not it.

As I mentioned and as you can see, I put in a line messaging me what TempInt is so I can test if it's working. And in certain regions of the map that message doesn't appear at all, units are NEVER spawned, and even the initial warning never plays.
 
Level 28
Joined
Sep 26, 2009
Messages
2,556
There is only a limited number of destructibles that are add to the event. I dunno how much, but iirc it is 60 or far less.
You most likely have more than 60 destructibles in your entire map.
This is solved by manually picking all destructibles into destructible group and adding them through specific event into the trigger (use "Trigger - Add new event" action).

Something like:
Code:
Destructibles - Pick every destructible in entire map and do:
    if destructible == tree
        Trigger - Add new event (Picked destructible) dies to trigger XYZ
 
Level 9
Joined
Jul 8, 2013
Messages
249
There is only a limited number of destructibles that are add to the event. I dunno how much, but iirc it is 60 or far less.
You most likely have more than 60 destructibles in your entire map.
This is solved by manually picking all destructibles into destructible group and adding them through specific event into the trigger (use "Trigger - Add new event" action).

Something like:
Code:
Destructibles - Pick every destructible in entire map and do:
    if destructible == tree
        Trigger - Add new event (Picked destructible) dies to trigger XYZ

Could you clarify how I make sure all the destructibles are added? Wouldn't that trigger have the same issue with only adding a limited number?
 
Level 28
Joined
Sep 26, 2009
Messages
2,556
No it works differently.
I just checked it again. The event:
  • Destructible - A destructible within *region* dies
can hold up to 64 destructibles for specified *region*.
However the action
  • Destructible - Pick every destructible in *region* and do (Actions)
    • Loop - Actions
and the event
  • Destructible - *Specific destructible* dies
are not limited as the event above.

You can actually solve the problem yourself by dividing your map into smaller regions and refer to those regions (however each region must have a maximum of 64 trees of less, else some will be left out).

You can easily check this limit yourself. You will need 4 triggers and an integer variable. In my case, the variable is called "num".
In my test map, I placed 340 trees in it. Then I used this trigger to destroy all trees in map:
  • kill
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
and I had this trigger to write down how many trees got destroyed:
  • event type 1
    • Events
      • Destructible - A destructible within (Entire map) dies
    • Conditions
    • Actions
      • Set num = (num + 1)
      • Game - Display to (All players) the text: (String(num))
In this case, the number always stops at 64, even though all trees were destroyed. That means that out of the 340 trees that I placed in the map, only 64 were add upon map initialization into the event.

However when i disabled the trigger above and replaced it with these two triggers:
  • map ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Trigger - Add to event type 2 <gen> the event (Destructible - (Picked destructible) dies)
  • event type 2
    • Events
    • Conditions
    • Actions
      • Set num = (num + 1)
      • Game - Display to (All players) the text: (String(num))
It displays number 340. That means each destroyed tree was counted.

Note: In the map ini trigger, I did not use If/Then/Else to make sure that the destructible I picked is tree, since trees were the only type of destructible placed in map.
 
Last edited:
Level 9
Joined
Jul 8, 2013
Messages
249
No it works differently.
I just checked it again. The event:
  • Destructible - A destructible within *region* dies
can hold up to 64 destructibles for specified *region*.
However the action
  • Destructible - Pick every destructible in *region* and do (Actions)
    • Loop - Actions
and the event
  • Destructible - *Specific destructible* dies
are not limited as the event above.

You can actually solve the problem yourself by dividing your map into smaller regions and refer to those regions (however each region must have a maximum of 64 trees of less, else some will be left out).

You can easily check this limit yourself. You will need 4 triggers and an integer variable. In my case, the variable is called "num".
In my test map, I placed 340 trees in it. Then I used this trigger to destroy all trees in map:
  • kill
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
and I had this trigger to write down how many trees got destroyed:
  • event type 1
    • Events
      • Destructible - A destructible within (Entire map) dies
    • Conditions
    • Actions
      • Set num = (num + 1)
      • Game - Display to (All players) the text: (String(num))
In this case, the number always stops at 64, even though all trees were destroyed. That means that out of the 340 trees that I placed in the map, only 64 were add upon map initialization into the event.

However when i disabled the trigger above and replaced it with these two triggers:
  • map ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Trigger - Add to event type 2 <gen> the event (Destructible - (Picked destructible) dies)
  • event type 2
    • Events
    • Conditions
    • Actions
      • Set num = (num + 1)
      • Game - Display to (All players) the text: (String(num))
It displays number 340. That means each destroyed tree was counted.

Note: In the map ini trigger, I did not use If/Then/Else to make sure that the destructible I picked is tree, since trees were the only type of destructible placed in map.


Awesome, I'll try that.

Edit: it works! Thanks a lot, +Rep
 
Status
Not open for further replies.
Top