• 🏆 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] Why does this trigger work only once?!

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
332
After I got rampage it won't work again!
  • Bonus Killing
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in PlayerGroup_Hunters) Equal to (==) True
        • Multiple ConditionsOr - Any (Conditions) are true
          • Conditions
            • (Unit-type of (Dying unit)) Equal to (==) Peasant
            • (Unit-type of (Dying unit)) Equal to (==) Peasant [Female]
    • Actions
      • Set Integers_BonusKill[(Player number of (Owner of (Killing unit)))] = (Integers_BonusKill[(Player number of (Owner of (Killing unit)))] + 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_BonusKill[(Player number of (Owner of (Killing unit)))] Equal to (==) 2
          • Then - Actions
            • Sound - Play DoubleKill1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Double Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_BonusKill[(Player number of (Owner of (Killing unit)))] Equal to (==) 3
          • Then - Actions
            • Sound - Play triplekill1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Triple Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_BonusKill[(Player number of (Owner of (Killing unit)))] Equal to (==) 4
          • Then - Actions
            • Sound - Play UltraKillSmall1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Ultra Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_BonusKill[(Player number of (Owner of (Killing unit)))] Equal to (==) 5
          • Then - Actions
            • Sound - Play RampageSmall1 <gen>
            • Player - Add 40 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Rampage|r (+40 gold))
          • Else - Actions
 
Level 10
Joined
Jun 20, 2017
Messages
332
yes here
  • Reset Kill bonuses
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Reals_TimeEnd[(Number of players in PlayerGroup_Hunters)] = (Reals_TimeEnd[(Number of players in PlayerGroup_Hunters)] - 1.00)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Reals_TimeEnd[(Number of players in PlayerGroup_Hunters)] Less than or equal to (<=) 0.00
          • Then - Actions
            • Set Integers_BonusKill[(Number of players in PlayerGroup_Hunters)] = 0
          • Else - Actions
      • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Teleport [Dummy]))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_UnitGroup)
 
You're resetting Integers_BonusKill only for one array index, and I don't understand why the index is Number of players in PlayerGroup_Hunters.

You need to create a loop over all players. For each player, check whether that player is in PlayerGroup_Hunters, and if so, reset Integer_BonusKill (array index = loop index), to 0.
Edit: I'm stupid, just loop over the player group.
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
332
and I don't understand why the index is Number of players in PlayerGroup_Hunters.
I think that means a few players are in a group!

Should these 2 work?!
  • Reset Kill Bonuses
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • ((Triggering player) is in PlayerGroup_Hunters) Equal to (==) True
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 10 to 12, do (Actions)
        • Loop - Actions
          • Set Integers_KillBonuses[(Player number of (Triggering player))] = 0
  • Reset Kill Bonuses Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in PlayerGroup_Hunters and do (Actions)
        • Loop - Actions
          • Set Integers_KillBonuses[(Player number of (Triggering player))] = 0
 
In the second example, you have to change Triggering Player to Picked Player, then it should work.

Triggering Player returns the player for an event such as "Player types a chat message" or "Player selects a unit." Your event is Every 1.00 seconds of game time, so Triggering Player will return nothing.

Picked Player is used inside "Pick every player and do Actions."
 
Level 10
Joined
Jun 20, 2017
Messages
332
wtf it does not work anymore ;d
  • Kill Bonuses
    • Events
      • Unit - A unit Dies
    • Conditions
      • Multiple ConditionsAnd - All (Conditions) are true
        • Conditions
          • ((Owner of (Killing unit)) is in PlayerGroup_Hunters) Equal to (==) True
            • Multiple ConditionsOr - Any (Conditions) are true
              • Conditions
                • (Unit-type of (Dying unit)) Equal to (==) Peasant
                • (Unit-type of (Dying unit)) Equal to (==) Peasant [Female]
    • Actions
      • Set Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] = (Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] + 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 2
          • Then - Actions
            • Sound - Play DoubleKill1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Double Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 3
          • Then - Actions
            • Sound - Play triplekill1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Triple Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 4
          • Then - Actions
            • Sound - Play UltraKillSmall1 <gen>
            • Player - Add 20 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Ultra Kill|r (+20 gold))
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 5
          • Then - Actions
            • Sound - Play RampageSmall1 <gen>
            • Player - Add 40 to (Owner of (Killing unit)) Current gold
            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Rampage|r (+40 gold))
          • Else - Actions
  • Reset Kill Bonuses
    • Events
      • Time - Timer_ResetKillBonuses expires
    • Conditions
    • Actions
      • Player Group - Pick every player in PlayerGroup_Hunters and do (Actions)
        • Loop - Actions
          • Set Integers_KillBonuses[(Player number of (Picked player))] = 0
      • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Teleport [Dummy]))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_UnitGroup)
  • Timer Income
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Timer_ResetKillBonuses as a Repeating timer that will expire in 1.00 seconds
 
Last edited:
Well, you're setting it to 0 every 1 seconds. Is that intentional? I can only help you with your triggers, but not with your logic.

You can print out your variable to see what's going on and help you fix your trigger faster:

  • Actions
    • Game - Display to (All players) the text: (String(Integers_KillBonuses[<Player Number of your test player>]))
 
Level 10
Joined
Jun 20, 2017
Messages
332
So I figured it out like this, but the problem is when I got rampage and when the next farmer dies the rampage isn't work again, but after 15 seconds the killing system is restart at 0
  • Kill Bonuses
    • Events
      • Unit - A unit Dies
    • Conditions
      • Multiple ConditionsOr - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to (==) Peasant
          • (Unit-type of (Dying unit)) Equal to (==) Peasant [Female]
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) is in PlayerGroup_Hunters) Equal to (==) True
        • Then - Actions
          • Set Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] = (Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] + 1)
          • Set Reals_TimeEnd[(Player number of (Owner of (Killing unit)))] = 15.00
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 2
              • Then - Actions
                • Sound - Play DoubleKill1 <gen>
                • Player - Add 20 to (Owner of (Killing unit)) Current gold
                • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Double Kill|r (+20 gold))
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 3
                  • Then - Actions
                    • Sound - Play triplekill1 <gen>
                    • Player - Add 20 to (Owner of (Killing unit)) Current gold
                    • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Triple Kill|r (+20 gold))
                  • Else - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 4
                      • Then - Actions
                        • Sound - Play UltraKillSmall1 <gen>
                        • Player - Add 20 to (Owner of (Killing unit)) Current gold
                        • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Ultra Kill|r (+20 gold))
                      • Else - Actions
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 5
                          • Then - Actions
                            • Sound - Play RampageSmall1 <gen>
                            • Player - Add 40 to (Owner of (Killing unit)) Current gold
                            • Game - Display to (All players) the text: (Strings_PlayerColors[(Player number of (Owner of (Killing unit)))] + |cffffcc00Rampage|r (+40 gold))
                          • Else - Actions
        • Else - Actions
  • Reset Kill Bonuses
    • Events
      • Time - Timer_ResetKillBonuses expires
    • Conditions
    • Actions
      • Set Reals_TimeEnd[10] = (Reals_TimeEnd[10] - 1.00)
      • Set Reals_TimeEnd[11] = (Reals_TimeEnd[11] - 1.00)
      • Set Reals_TimeEnd[12] = (Reals_TimeEnd[12] - 1.00)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Reals_TimeEnd[10] Less than or equal to (<=) 0.00
          • Then - Actions
            • Set Integers_KillBonuses[10] = 0
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Reals_TimeEnd[11] Less than or equal to (<=) 0.00
          • Then - Actions
            • Set Integers_KillBonuses[11] = 0
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Reals_TimeEnd[12] Less than or equal to (<=) 0.00
          • Then - Actions
            • Set Integers_KillBonuses[12] = 0
          • Else - Actions
      • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Teleport [Dummy]))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_UnitGroup)
But I wanna something like this, shorter trigger
  • Reset Kill Bonuses Copy
    • Events
      • Time - Timer_ResetKillBonuses expires
    • Conditions
    • Actions
      • Set Reals_TimeEnd[(Player number of (Triggering player))] = (Reals_TimeEnd[(Player number of (Triggering player))] - 1.00)
        • Do Multiple ActionsFor each (Integer A) from 10 to 12, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Reals_TimeEnd[(Player number of (Triggering player))] Less than or equal to (<=) 0.00
              • Then - Actions
                • Set Integers_KillBonuses[(Player number of (Triggering player))] = 0
              • Else - Actions
      • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Teleport [Dummy]))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_UnitGroup)
 
  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 10 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Reals_TimeEnd[A] Less than or Equal to 0.00
          • Then - Actions
            • Set Integers_KillBonuses[A] = 0
          • Else - Actions
Search for "For Loop Integer A" while setting the Array index.

Regarding the rampage bug, I don't know if I understand it correctly, but it seems to me that this could just be fixed by replacing the
  • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Equal to (==) 5
with
  • Integers_KillBonuses[(Player number of (Owner of (Killing unit)))] Greater than or Equal to (>=) 5
 
Level 10
Joined
Jun 20, 2017
Messages
332
As you said, ty:thumbs_up:
  • Reset Kill Bonuses
    • Events
      • Time - Timer_ResetKillBonuses expires
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 10 to 12, do (Actions)
        • Loop - Actions
          • Set Reals_TimeEnd[(Player number of (Player((Integer A))))] = (Reals_TimeEnd[(Player number of (Player((Integer A))))] - 1.00)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Reals_TimeEnd[(Player number of (Player((Integer A))))] Less than or equal to (<=) 0.00
              • Then - Actions
                • Set Integers_KillBonuses[(Player number of (Player((Integer A))))] = 0
              • Else - Actions
      • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Teleport [Dummy]))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup(udg_UnitGroup)
 
Status
Not open for further replies.
Top