• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Solved] Auto-Pick Trigger not Worked propely

Status
Not open for further replies.
Level 10
Joined
Mar 19, 2010
Messages
622
I had this trigger in my map to let it automatically choose hero for players, including Computer players, who had not yet choose a hero. But the problem is it just creates one hero, like it just run once and stopped.
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Players_Heroes[(Integer B)] Equal to No unit
            • Then - Actions
              • Set Players_TempIndex = (Player number of (Player((Integer B))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Players_Hero_PlaChosen Equal to False
                • Then - Actions
                  • Unit - Create 1 Paladin for (Player((Integer B))) at (Random point in Player Spawn <gen>) facing Default building facing degrees
                  • Set Players_Heroes[Players_TempIndex] = (Last created unit)
                  • Set Players_IsPlaying[Players_TempIndex] = True
                  • Set Players_IsRage[Players_TempIndex] = False
                  • Set Players_IsSpell[Players_TempIndex] = True
                  • Set Players_IsPhy[Players_TempIndex] = False
                  • Set Players_Spellpower[Players_TempIndex] = 0.00
                  • Set Players_Physical[Players_TempIndex] = 0.00
                  • Set Players_HealerCount = (Players_HealerCount + 1)
                  • Set Players_TankCount = (Players_TankCount + 1)
                  • Set Players_Hero_PlaChosen = True
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Players_Hero_ArcChosen Equal to False
                    • Then - Actions
                      • Unit - Create 1 Archer for (Player((Integer B))) at (Random point in Player Spawn <gen>) facing Default building facing degrees
                      • Set Players_Heroes[Players_TempIndex] = (Last created unit)
                      • Set Players_IsPlaying[Players_TempIndex] = True
                      • Set Players_IsRage[Players_TempIndex] = False
                      • Set Players_IsSpell[Players_TempIndex] = False
                      • Set Players_IsPhy[Players_TempIndex] = True
                      • Set Players_Spellpower[Players_TempIndex] = 0.00
                      • Set Players_Physical[Players_TempIndex] = 0.00
                      • Set Players_DDealerCount = (Players_DDealerCount + 1)
                      • Set Players_Hero_ArcChosen = True
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Players_Hero_DkChosen Equal to False
                        • Then - Actions
                          • Unit - Create 1 Deathknight for (Player((Integer B))) at (Random point in Player Spawn <gen>) facing Default building facing degrees
                          • Set Players_Heroes[Players_TempIndex] = (Last created unit)
                          • Set Players_IsPlaying[Players_TempIndex] = True
                          • Set Players_IsRage[Players_TempIndex] = True
                          • Set Players_IsSpell[Players_TempIndex] = False
                          • Set Players_IsPhy[Players_TempIndex] = True
                          • Set Players_Spellpower[Players_TempIndex] = 0.00
                          • Set Players_Physical[Players_TempIndex] = 0.00
                          • Set Players_TankCount = (Players_TankCount + 1)
                          • Set Players_Hero_DkChosen = True
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Players_Hero_RogChosen Equal to False
                            • Then - Actions
                              • Unit - Create 1 Rouge for (Player((Integer B))) at (Random point in Player Spawn <gen>) facing Default building facing degrees
                              • Set Players_Heroes[Players_TempIndex] = (Last created unit)
                              • Set Players_IsPlaying[Players_TempIndex] = True
                              • Set Players_IsRage[Players_TempIndex] = False
                              • Set Players_IsSpell[Players_TempIndex] = False
                              • Set Players_IsPhy[Players_TempIndex] = True
                              • Set Players_Spellpower[Players_TempIndex] = 0.00
                              • Set Players_Physical[Players_TempIndex] = 0.00
                              • Set Players_DDealerCount = (Players_DDealerCount + 1)
                              • Set Players_Hero_RogChosen = True
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Players_Hero_ShmChosen Equal to False
                                • Then - Actions
                                  • Unit - Create 1 Shaman for (Player((Integer B))) at (Random point in Player Spawn <gen>) facing Default building facing degrees
                                  • Set Players_Heroes[Players_TempIndex] = (Last created unit)
                                  • Set Players_IsPlaying[Players_TempIndex] = True
                                  • Set Players_IsRage[Players_TempIndex] = False
                                  • Set Players_IsSpell[Players_TempIndex] = True
                                  • Set Players_IsPhy[Players_TempIndex] = False
                                  • Set Players_Spellpower[Players_TempIndex] = 0.00
                                  • Set Players_Physical[Players_TempIndex] = 0.00
                                  • Set Players_HealerCount = (Players_HealerCount + 1)
                                  • Set Players_Hero_ShmChosen = True
                                • Else - Actions
I just copy this part of trigger out because I think that this is the main problem source, so cant anyone help me by pointing out my mistakes?

Thanks in advance, will +rep for those who helped.
 
Last edited:
Level 17
Joined
Feb 11, 2011
Messages
1,860
You have lots of location leaks. Do this:

  • Set Temp_Point = (Random point in Player Spawn <gen>)
  • Unit - Create 1 Shaman for (Player((Integer B))) at (Temp_Point) facing Default building facing degrees
  • Custom script: RemoveLocation(udg_Temp_Point)
 
Level 10
Joined
Mar 19, 2010
Messages
622
@Lembidi: As I mentioned below my triggers, I just post this part as I think it is where the problems is.

@Mr Bean987: Thanks, fixed.

Edit: Found the bug that caused this trigger not to work properly, thanks guys. +rep to you two. =)
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Improve the trigger via skipping actions inside 'if' which can be attached outside it - ofcourse if you can find any formula.
Get rid of Integer B - it isn't bugfree. Replace it will custom integer.

(Random point in Player Spawn <gen>) leaks. Use:
  • Set p = (Random point in Player Spawn <gen>)
  • // actions related to p here
  • Custom script: call RemoveLocation(udg_p)
To get rid of leak =)
 
Last edited:
Status
Not open for further replies.
Top