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

Issue with my trigger

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
It's supposed to if a unit carries the Hellfire item not allow building that structure on top or near them. Tested but it didn't work, any idea what the issue is?

  • Disable boxes near hellfire
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Ancient Vampire
                  • (Unit-type of (Picked unit)) Equal to Ancient Vampire
                  • (Unit-type of (Picked unit)) Equal to Ancient Vampiress
            • Then - Actions
              • Set FeedingBlockDistance = (Distance between (Position of (Picked unit)) and (Position of (Constructing structure)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FeedingBlockDistance Less than 100.00
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Item-type of (Item carried by (Picked unit) in slot 1)) Equal to Gauntlets of Hellfire
                      • (Item-type of (Item carried by (Picked unit) in slot 2)) Equal to Gauntlets of Hellfire
                      • (Item-type of (Item carried by (Picked unit) in slot 3)) Equal to Gauntlets of Hellfire
                      • (Item-type of (Item carried by (Picked unit) in slot 4)) Equal to Gauntlets of Hellfire
                      • (Item-type of (Item carried by (Picked unit) in slot 5)) Equal to Gauntlets of Hellfire
                      • (Item-type of (Item carried by (Picked unit) in slot 6)) Equal to Gauntlets of Hellfire
                  • Or - Any (Conditions) are true
                    • Conditions
                  • (Unit-type of (Constructing structure)) Equal to Blood Box
                  • (Unit-type of (Constructing structure)) Equal to Feeding Block
                • Then - Actions
                  • Unit - Remove (Constructing structure) from the game
                • Else - Actions
            • Else - Actions
  • /[trigger]
 
Level 13
Joined
May 10, 2009
Messages
868
Both latter conditions should be in the last "Or" block. Otherwise, it will always return false.

Another thing that could help improve a bit of game performance is enumerating units at a certain point instead of them all.
  • Events
    • Unit - A unit Begins construction
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Unit-type of (Constructing structure)) Equal to Blood Box
        • (Unit-type of (Constructing structure)) Equal to Feeding Block
  • Actions
    • Set point = (Position of (Constructing structure))
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 100.00 of point) and do (Actions)
      • Loop - Actions
        • Set tunit = (Picked unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (tunit belongs to an enemy of (Triggering player)) Equal to True
            • (tunit has an item of type Gauntlets of Hellfire) Equal to True
          • Then - Actions
            • Unit - Kill (Constructing structure)
          • Else - Actions
    • Custom script: call RemoveLocation(udg_point)
Also, the "Hero - Hero has item of type" function does basically what you did with those 6 "lines of condition". It returns true once it finds a specific item type in a unit's inventory slot.
 
Level 4
Joined
Sep 2, 2016
Messages
48
@Rugarus
I think the problem is that you didn't place conditions:
Unit Type of (Constructing Structure) equal to Blood Box
Unit Type of (Constructing Structure) equal to Feeding Block
in the "Or" condition, but AFTER it. So the script checks if the Constructing Structure is Blood Box "And" Feeding Block. But it can not be both, right?
Just drag the conditions under the "Conditions" of "Or".

Do you see it?
 
Level 12
Joined
Dec 2, 2016
Messages
733
@Rugarus
I think the problem is that you didn't place conditions:
Unit Type of (Constructing Structure) equal to Blood Box
Unit Type of (Constructing Structure) equal to Feeding Block
in the "Or" condition, but AFTER it. So the script checks if the Constructing Structure is Blood Box "And" Feeding Block. But it can not be both, right?
Just drag the conditions under the "Conditions" of "Or".

Do you see it?
ah yes that must of been it thx
@Rugarus
I think the problem is that you didn't place conditions:
Unit Type of (Constructing Structure) equal to Blood Box
Unit Type of (Constructing Structure) equal to Feeding Block
in the "Or" condition, but AFTER it. So the script checks if the Constructing Structure is Blood Box "And" Feeding Block. But it can not be both, right?
Just drag the conditions under the "Conditions" of "Or".

Do you see it?
thanks! I noticed you didn't add a custom script to erase the unit leak, does the "set bj_wantDestroyGroup = true" remove the unit group and also remove the unit leak?
 
Status
Not open for further replies.
Top