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

[Solved] Help: Faction warrior

Status
Not open for further replies.
Level 1
Joined
Apr 28, 2012
Messages
4
What have I done wrong here?
  • ContinueWarrior
    • Events
      • Dialog - A dialog button is clicked for Dialog
    • Conditions
      • (Clicked dialog button) Equal to WarriorButton
    • Actions
      • Unit - Create 1 Mountain King for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
      • Camera - Lock camera target for (Owner of (Last created unit)) to (Last created unit), offset by (0.00, 0.00) using Default rotation
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + has chosen the |cffff0000Warrior|r)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Set Player = (Owner of (Last created unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Last created unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Player Group - Add Player 1 (Red) to AllianceGroup
          • Set AllianceCreatedUnit = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Last created unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Player Group - Add Player 2 (Blue) to AllianceGroup
              • Set AllianceCreatedUnit = (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Last created unit)) Equal to Player 3 (Teal)
                • Then - Actions
                  • Player Group - Add Player 3 (Teal) to AllianceGroup
                  • Set AllianceCreatedUnit = (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Last created unit)) Equal to Player 4 (Purple)
                    • Then - Actions
                      • Player Group - Add Player 4 (Purple) to AllianceGroup
                      • Set AllianceCreatedUnit = (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Last created unit)) Equal to Player 5 (Yellow)
                        • Then - Actions
                          • Player Group - Add Player 5 (Yellow) to AllianceGroup
                          • Set AllianceCreatedUnit = (Last created unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Last created unit)) Equal to Player 8 (Pink)
                            • Then - Actions
                              • Player Group - Add Player 8 (Pink) to HordeGroup
                              • Set HordeCReatedUnit = (Last created unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Owner of (Last created unit)) Equal to Player 9 (Gray)
                                • Then - Actions
                                  • Player Group - Add Player 9 (Gray) to HordeGroup
                                  • Set HordeCReatedUnit = (Last created unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of (Last created unit)) Equal to Player 10 (Light Blue)
                                    • Then - Actions
                                      • Player Group - Add Player 10 (Light Blue) to HordeGroup
                                      • Set HordeCReatedUnit = (Last created unit)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Owner of (Last created unit)) Equal to Player 11 (Dark Green)
                                        • Then - Actions
                                          • Player Group - Add Player 11 (Dark Green) to HordeGroup
                                          • Set HordeCReatedUnit = (Last created unit)
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Owner of (Last created unit)) Equal to Player 12 (Brown)
                                            • Then - Actions
                                              • Player Group - Add Player 12 (Brown) to HordeGroup
                                              • Set HordeCReatedUnit = (Last created unit)
                                            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HordeCReatedUnit Equal to (Last created unit)
        • Then - Actions
          • Unit - Move HordeCReatedUnit instantly to (Center of StartPositionOrc <gen>)
          • Player Group - Make HordeGroup treat HordeGroup as an Ally with shared vision
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AllianceCreatedUnit Equal to (Last created unit)
            • Then - Actions
              • Unit - Move AllianceCreatedUnit instantly to (Center of StartPositionHuman <gen>)
              • Player Group - Make AllianceGroup treat AllianceGroup as an Ally with shared vision
            • Else - Actions
I have done the dialog and this is the button for the warrior class, I want to make it so when you have choosed warrior you will be telported and included in that faction.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'll answer your question: You're not letting the game think enough. You're telling the game exactly what to do. That takes more time, more code, is harder, and less efficient.

  • ContinueWarrior
  • Events
    • Dialog - A dialog button is clicked for Dialog
  • Conditions
    • (Clicked dialog button) Equal to WarriorButton
  • Actions
    • Set Player = (Triggering Player)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Player number of Player Less than or Equal to 5
      • Then - Actions
        • Player Group - Add Player to AllianceGroup
        • Set TPoint = (Center of StartPositionHuman <gen>)
      • Else - Actions
        • Player Group - Add Player to HordeGroup
        • Set TPoint = (Center of StartPositionOrc <gen>)
    • Unit - Create 1 Mountain King for Player at TPoint facing Default building facing degrees
    • Set TUnit = (Last created unit)
    • Camera - Lock camera target for Player to TUnit, offset by (0.00, 0.00) using Default rotation
    • Game - Display to (All players) the text: (Name of Player) + has chosen the |cffff0000Warrior|r)
    • Special Effect - Create a special effect attached to the overhead of TUnit using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
    • Special Effect - Destroy (last created special effect)
    • Custom script: call RemoveLocation(udg_TPoint)
Player Group - Make HordeGroup treat HordeGroup as an Ally with shared vision
^^ This is something you do on "Player Properties" in the map. Create the forces and set the alliance settings. Theres no need to trigger it every time a player picks a hero.

This trigger does the same yours do, but has no leaks, and, as you can see, is shorter and easier to do, and easier for the game to do it. If you have several heroes with the same actions you can mix every hero trigger in just 1 like this one i showed.
 
Level 1
Joined
Apr 28, 2012
Messages
4
I'll answer your question: You're not letting the game think enough. You're telling the game exactly what to do. That takes more time, more code, is harder, and less efficient.

  • ContinueWarrior
  • Events
    • Dialog - A dialog button is clicked for Dialog
  • Conditions
    • (Clicked dialog button) Equal to WarriorButton
  • Actions
    • Set Player = (Triggering Player)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Player number of Player Less than or Equal to 5
      • Then - Actions
        • Player Group - Add Player to AllianceGroup
        • Set TPoint = (Center of StartPositionHuman <gen>)
      • Else - Actions
        • Player Group - Add Player to HordeGroup
        • Set TPoint = (Center of StartPositionOrc <gen>)
    • Unit - Create 1 Mountain King for Player at TPoint facing Default building facing degrees
    • Set TUnit = (Last created unit)
    • Camera - Lock camera target for Player to TUnit, offset by (0.00, 0.00) using Default rotation
    • Game - Display to (All players) the text: (Name of Player) + has chosen the |cffff0000Warrior|r)
    • Special Effect - Create a special effect attached to the overhead of TUnit using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
    • Special Effect - Destroy (last created special effect)
    • Custom script: call RemoveLocation(udg_TPoint)
Player Group - Make HordeGroup treat HordeGroup as an Ally with shared vision
^^ This is something you do on "Player Properties" in the map. Create the forces and set the alliance settings. Theres no need to trigger it every time a player picks a hero.

This trigger does the same yours do, but has no leaks, and, as you can see, is shorter and easier.
Yes It was that thanks both of you.
 
Last edited:
Status
Not open for further replies.
Top