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

King of the Hill check trigger solution??

Status
Not open for further replies.
I have this triigger that is supposed to check every second, is a player in the region 'Hill' alone (there are no enemy players also inside of it).

and if so, score points for the player.
But it's not working and I have no idea what else to do to make it work.

  • KOTH Periodiic
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set KOTH_Gr = (Units in Hill <gen> matching (((Owner of (Matching unit)) Not equal to Neutral Hostile) and ((Owner of (Matching unit)) Not equal to Neutral Passive)))
      • Unit Group - Pick every unit in KOTH_Gr and do (Actions)
        • Loop - Actions
          • Set TempPlayer = (Owner of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Score_KOTHChecked[(Player number of TempPlayer)] Equal to False
            • Then - Actions
              • -------- ------------------------------------ --------
              • Set KOTHGrCheckFriends = (Units in Hill <gen> matching (((Owner of (Matching unit)) is an ally of TempPlayer) Equal to True))
              • Set KOTHGrCheckEnemies = (Units in Hill <gen> matching (((Owner of (Matching unit)) is an enemy of TempPlayer) Equal to True))
              • -------- ------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in KOTHGrCheckEnemies) Equal to 0
                • Then - Actions
                  • Set TempPlayer = (Owner of (Picked unit))
                  • Set Score_KOTH[(Player number of TempPlayer)] = (Score_KOTH[(Player number of TempPlayer)] + 50)
                  • Leaderboard - Change the value for TempPlayer in ExtraModeLeaderboard to Score_KOTH[(Player number of TempPlayer)]
                  • Leaderboard - Sort ExtraModeLeaderboard by Value in Descending order
                  • -------- ------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Score_KOTH[(Player number of TempPlayer)] Equal to 10000
                    • Then - Actions
                      • Player Group - Pick every player in (All allies of TempPlayer) and do (Actions)
                        • Loop - Actions
                          • Game - Victory (Picked player) (Show dialogs, Show scores)
                      • Player Group - Pick every player in (All enemies of TempPlayer) and do (Actions)
                        • Loop - Actions
                          • Game - Defeat (Picked player) with the message: Defeat!
                    • Else - Actions
                • Else - Actions
              • Set Score_KOTHChecked[(Player number of TempPlayer)] = True
            • Else - Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Score_KOTHChecked[(Player number of TempPlayer)] = False
      • Custom script: call DestroyGroup(udg_KOTHGrCheckFriends)
      • Custom script: call DestroyGroup(udg_KOTHGrCheckEnemies)
      • Custom script: call DestroyGroup(udg_KOTH_Gr)
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
I don't know where is the problem, but I must point:

  1. Is every second or every 5 seconds?
  2. This must be inside the If/Then/Else
    • Custom script: call DestroyGroup(udg_KOTHGrCheckFriends)
    • Custom script: call DestroyGroup(udg_KOTHGrCheckEnemies)
  3. Why you use this condition?
    • Score_KOTHChecked[(Player number of TempPlayer)] Equal to False
    If later you have this:
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Set Score_KOTHChecked[(Player number of TempPlayer)] = False
  4. You didn't even use this variable:
    • Set KOTHGrCheckFriends = (Units in Hill <gen> matching (((Owner of (Matching unit)) is an ally of TempPlayer) Equal to True))
  5. You must use
    • Set TempInt = (Player number of TempPlayer)
  6. Is necessary have this inside the Unit group loop?
    • Leaderboard - Sort ExtraModeLeaderboard by Value in Descending order
 
  • KOTH Periodiic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set KOTH_Gr = (Units in Hill <gen> matching (((Owner of (Matching unit)) Not equal to Neutral Hostile) and ((Owner of (Matching unit)) Not equal to Neutral Passive)))
      • Unit Group - Pick every unit in KOTH_Gr and do (Actions)
        • Loop - Actions
          • Set TempPlayer = (Owner of (Picked unit))
          • Set TempInt = (Player number of TempPlayer)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Score_KOTHChecked[TempInt] Equal to False
            • Then - Actions
              • -------- ------------------------------------ --------
              • Set KOTHGrCheckEnemies = (Units in Hill <gen> matching (((Owner of (Matching unit)) is an enemy of TempPlayer) Equal to True))
              • -------- ------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in KOTHGrCheckEnemies) Equal to 0
                • Then - Actions
                  • Set Score_KOTH[TempInt] = (Score_KOTH[TempInt] + 50)
                  • Leaderboard - Change the value for TempPlayer in ExtraModeLeaderboard to Score_KOTH[TempInt]
                  • -------- ------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Score_KOTH[TempInt] Equal to 10000
                    • Then - Actions
                      • Player Group - Pick every player in (All allies of TempPlayer) and do (Actions)
                        • Loop - Actions
                          • Game - Victory (Picked player) (Show dialogs, Show scores)
                      • Player Group - Pick every player in (All enemies of TempPlayer) and do (Actions)
                        • Loop - Actions
                          • Game - Defeat (Picked player) with the message: Defeat!
                    • Else - Actions
                • Else - Actions
              • Set Score_KOTHChecked[TempInt] = True
              • Custom script: call DestroyGroup(udg_KOTHGrCheckEnemies)
            • Else - Actions
      • Leaderboard - Sort ExtraModeLeaderboard by Value in Descending order
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Score_KOTHChecked[(Player number of TempPlayer)] = False
      • Custom script: call DestroyGroup(udg_KOTH_Gr)
still not working. his SCORE does not change at all. When i test..
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
It is inside the outter loop.

Loop 1 -
---set player = (picked player)
---Loop 2 -
------do something with player <---- player will always be the same in this case, so you have to use (picked player) or define the variable inside "Loop 2"
 
Status
Not open for further replies.
Top