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

[Trigger] Structure Trigger Help

Status
Not open for further replies.
Level 6
Joined
Jul 13, 2006
Messages
140
So, I'm trying to make a trigger that uses an ability based on charm that only works on buildings and changes the affected building (if it's the right type) to another building.

  • Ability
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ability
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Target unit of ability being cast)) Equal to Building1
              • (Unit-type of (Target unit of ability being cast)) Equal to Building2
              • (Unit-type of (Target unit of ability being cast)) Equal to Building3
        • Then - Actions
          • Unit - Replace (Target unit of ability being cast) with a Structure1 using The new unit's default life and mana
          • Unit - Remove (Casting unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Ability
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Target unit of ability being cast)) Equal to Building4
                  • (Unit-type of (Target unit of ability being cast)) Equal to Building5
                  • (Unit-type of (Target unit of ability being cast)) Equal to Building6
                  • (Unit-type of (Target unit of ability being cast)) Equal to Building7
            • Then - Actions
              • Unit - Replace (Target unit of ability being cast) with a Structure2 using The new unit's default life and mana
              • Unit - Remove (Casting unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Ability
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Target unit of ability being cast)) Equal to Building8
                      • (Unit-type of (Target unit of ability being cast)) Equal to Building9
                      • (Unit-type of (Target unit of ability being cast)) Equal to Building10
                      • (Unit-type of (Target unit of ability being cast)) Equal to Building11
                • Then - Actions
                  • Unit - Replace (Target unit of ability being cast) with a Structure3 using The new unit's default life and mana
                  • Unit - Remove (Casting unit) from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Ability being cast) Equal to Ability
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Unit-type of (Target unit of ability being cast)) Equal to Building12
                          • (Unit-type of (Target unit of ability being cast)) Equal to Building13
                          • (Unit-type of (Target unit of ability being cast)) Equal to Building14
                          • (Unit-type of (Target unit of ability being cast)) Equal to Building15
                    • Then - Actions
                      • Unit - Replace (Target unit of ability being cast) with a Structure4 using The new unit's default life and mana
                      • Unit - Remove (Casting unit) from the game
                    • Else - Actions
                      • If ((Ability being cast) Equal to Ability ) then do (Unit - Remove (Casting unit) from the game) else do (Do nothing)
This trigger doesn't work because it doesn't register a building being affected.
Building do count as units in triggers right?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Try changing the event "Unit - A unit Finishes casting an ability"
into "Unit - A unit starts the effect of an ability"

Also add "(Ability being cast) Equal to Ability" to the conditions rather than in the if/then/else actions. It'll make the trigger more efficiently as you'll only have to check this condition once instead of each action.

Also move the "Unit - Remove (Casting unit) from the game action" out of the if/then/else actions to the bottom of the trigger.
 
Level 6
Joined
Jul 13, 2006
Messages
140
Thanks for the help, it actually works now, although it seems to have created some lag when casting a spell but that isn't much of a worry.

Although for some reason, the effect of charm is nullified which is a major component in this ability.
Could someone care to explain why this is so?
 
Status
Not open for further replies.
Top