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

Variable "Overlapping Issue" Testmap Included

Status
Not open for further replies.
Level 12
Joined
Feb 5, 2018
Messages
521
So im making achievements for my map and the issue is that if more than one player is killing units at the same time, the _Integer Variable_ runs more than once. So I tried with player 1 and player 2 killing units at the same time. And the achievements procced more than one time. Player 1 got rank 1 achievement 3 times. EDIT: Added test map to advert the issue more clearly.
  • Gnoll Killer
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Gnoll
          • (Unit-type of (Triggering unit)) Equal to Gnoll Poacher
          • (Unit-type of (Triggering unit)) Equal to Gnoll Mage
          • (Unit-type of (Triggering unit)) Equal to Gnoll Assassin
          • (Unit-type of (Triggering unit)) Equal to Gnoll Brute
          • (Unit-type of (Triggering unit)) Equal to Gnoll Lord
          • (Owner of (Killing unit)) Not equal to Player 9 (Gray)
    • Actions
      • If ((Owner of (Killing unit)) Equal to Player 1 (Red)) then do (Set GnollKiller_Ach[1] = (GnollKiller_Ach[1] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 2 (Blue)) then do (Set GnollKiller_Ach[2] = (GnollKiller_Ach[2] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 3 (Teal)) then do (Set GnollKiller_Ach[3] = (GnollKiller_Ach[3] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 4 (Purple)) then do (Set GnollKiller_Ach[4] = (GnollKiller_Ach[4] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 5 (Yellow)) then do (Set GnollKiller_Ach[5] = (GnollKiller_Ach[5] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 6 (Orange)) then do (Set GnollKiller_Ach[6] = (GnollKiller_Ach[6] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 7 (Green)) then do (Set GnollKiller_Ach[7] = (GnollKiller_Ach[7] + 1)) else do (Do nothing)
      • If ((Owner of (Killing unit)) Equal to Player 8 (Pink)) then do (Set GnollKiller_Ach[8] = (GnollKiller_Ach[8] + 1)) else do (Do nothing)
      • Trigger - Run Gnoll Killer Check <gen> (checking conditions)
  • Gnoll Killer Check
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[1] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 1 (Red)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 1 (Red) Current lumber
          • Player - Add 150 to Player 1 (Red) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[1] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 1 (Red)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 1 (Red) Current lumber
              • Player - Add 200 to Player 1 (Red) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[1] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 1 (Red)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 1 (Red) Current lumber
                  • Player - Add 300 to Player 1 (Red) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[2] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 2 (Blue)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 2 (Blue) Current lumber
          • Player - Add 150 to Player 2 (Blue) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[2] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 2 (Blue)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 2 (Blue) Current lumber
              • Player - Add 200 to Player 2 (Blue) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[2] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 2 (Blue)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 2 (Blue) Current lumber
                  • Player - Add 300 to Player 2 (Blue) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[3] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 3 (Teal)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 3 (Teal) Current lumber
          • Player - Add 150 to Player 3 (Teal) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[3] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 3 (Teal)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 3 (Teal) Current lumber
              • Player - Add 200 to Player 3 (Teal) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[3] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 3 (Teal)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 3 (Teal) Current lumber
                  • Player - Add 300 to Player 3 (Teal) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[4] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 4 (Purple)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 4 (Purple) Current lumber
          • Player - Add 150 to Player 4 (Purple) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[4] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 4 (Purple)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 4 (Purple) Current lumber
              • Player - Add 200 to Player 4 (Purple) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[4] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 4 (Purple)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 4 (Purple) Current lumber
                  • Player - Add 300 to Player 4 (Purple) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[5] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 5 (Yellow)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 5 (Yellow) Current lumber
          • Player - Add 150 to Player 5 (Yellow) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[5] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 5 (Yellow)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 5 (Yellow) Current lumber
              • Player - Add 200 to Player 5 (Yellow) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[5] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 5 (Yellow)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 5 (Yellow) Current lumber
                  • Player - Add 300 to Player 5 (Yellow) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[6] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 6 (Orange)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 6 (Orange) Current lumber
          • Player - Add 150 to Player 6 (Orange) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[6] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 6 (Orange)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 6 (Orange) Current lumber
              • Player - Add 200 to Player 6 (Orange) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[6] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 6 (Orange)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 6 (Orange) Current lumber
                  • Player - Add 300 to Player 6 (Orange) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[7] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 7 (Green)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 7 (Green) Current lumber
          • Player - Add 150 to Player 7 (Green) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[7] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 7 (Green)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 7 (Green) Current lumber
              • Player - Add 200 to Player 7 (Green) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[7] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 7 (Green)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 7 (Green) Current lumber
                  • Player - Add 300 to Player 7 (Green) Current gold
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[8] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Player 8 (Pink)))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Player 8 (Pink) Current lumber
          • Player - Add 150 to Player 8 (Pink) Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[8] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Player 8 (Pink)))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Player 8 (Pink) Current lumber
              • Player - Add 200 to Player 8 (Pink) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[8] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Player 8 (Pink)))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Player 8 (Pink) Current lumber
                  • Player - Add 300 to Player 8 (Pink) Current gold
                • Else - Actions
 

Attachments

  • TestMap.w3x
    25.1 KB · Views: 18
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Yeah, that's because the second trigger is a bit generic and isn't distinguishing which player has just killed any of those units. So, if player 1 achieves "Gnoll Killer Rank 1", and then player 2 kills multiple units, player 1 will be stuck in that situation until another unit be killed by them (player 1).

Well, I suggest that you merge both triggers into one, and use a few extra functions in your favor so that you get rid of that bloated code, and fix the issue at once. There's a function which retrieves/returns which player triggered the event and another one which gets the player number. Combining both functions will get rid of the need of checking all players' individual score in order to reward them.

  • Gnoll Killer
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Gnoll Poacher
          • (Unit-type of (Triggering unit)) Equal to Gnoll Assassin
          • (Unit-type of (Triggering unit)) Equal to Gnoll
          • (Unit-type of (Triggering unit)) Equal to Gnoll Brute
          • (Unit-type of (Triggering unit)) Equal to Gnoll Warden
          • (Unit-type of (Triggering unit)) Equal to Gnoll Overseer
          • (Owner of (Killing unit)) Not equal to Player 9 (Gray)
    • Actions
      • -------- Identify which player killed the gnoll, and store their number into a temporary variable --------
      • Set Killer = (Owner of (Killing unit))
      • Set PNumber = (Player number of Killer)
      • -------- Increase their score --------
      • Set GnollKiller_Ach[PNumber] = (GnollKiller_Ach[PNumber] + 1)
      • -------- Unlock achievements --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GnollKiller_Ach[PNumber] Equal to 10
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 1 for player + (Name of Killer))
          • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+150 Gold...
          • Player - Add 1 to Killer Current lumber
          • Player - Add 150 to Killer Current gold
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GnollKiller_Ach[PNumber] Equal to 25
            • Then - Actions
              • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 2 for player + (Name of Killer))
              • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+200 Gold...
              • Player - Add 1 to Killer Current lumber
              • Player - Add 200 to Killer Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GnollKiller_Ach[PNumber] Equal to 50
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: (|c0020C000Achievement Unlocked:|r Gnoll Killer Rank 3 for player + (Name of Killer))
                  • Game - Display to (All players) for 10.00 seconds the text: |c00FFFC01+300 Gold...
                  • Player - Add 1 to Killer Current lumber
                  • Player - Add 300 to Killer Current gold
                • Else - Actions
By doing this, there won't be a player's score interfering with one another. Also, the trigger will look way simpler/easier to read.
 

Attachments

  • TestMap.w3x
    20.9 KB · Views: 20
Level 12
Joined
Feb 5, 2018
Messages
521
Thank you very much :) I will try this asap. Also if I use another achievement for a different unit type, like trolls for example. Will I just do the same trigger and they can run without bugging one another?
 
Status
Not open for further replies.
Top