[Solved] Detect Trigger Research

Status
Not open for further replies.
Level 5
Joined
May 24, 2017
Messages
93
I just want to know how to detect in a triggers event when the level of an upgrade changes. Not "A unit finishes a research" I think because I would set the research with triggers so there is no unit. What is the best way to do this. Thanks
 
Level 5
Joined
Jul 31, 2020
Messages
103
There's no direct way to detect that if you're setting it in a trigger. But this begs the question; what stops you from doing whatever it is you're going to do where you set the tech level? And if that doesn't work, you can store the tech level in a variable, and utilize that. Such as saving it in a real variable, and using "Game - Value Of Real Variable" if everything else fails. It's hard to give a definitive answer with no information about what you're exactly trying to pull off.
 
Level 5
Joined
May 24, 2017
Messages
93
Basically, I want my heros to pick a talent when they level up. They pick 1 of 3 from a dialog that is randomized. I figured out the randomized dialog part. I thought the best way to effect the hero would be with upgrades. I apply the upgrade when the button is clicked and I wanted to effect the player that the upgrade effected. I thought that was the best way to keep track and apply the talents. This is what I have so far. With out effecting the hero in any way.

  • Show Level Dialog
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
      • (Unit-type of (Triggering unit)) Equal to Human (Player Character)
    • Actions
      • Multiboard - Set the text for Multiboard item in column 3, row ((Player number of (Owner of (Leveling Hero))) + 1) to (String((Player_Level[(Player number of (Owner of (Leveling Hero)))] + 1)))
      • Dialog - Clear Level_Dialog[(Player number of (Owner of (Triggering unit)))]
      • Dialog - Change the title of Level_Dialog[(Player number of (Owner of (Triggering unit)))] to |cffffff00Choose an...
      • Set VariableSet Advantage_select1[(Player number of (Owner of (Triggering unit)))] = (Random integer number between 1 and 6)
      • Set VariableSet Advantage_select2[(Player number of (Owner of (Triggering unit)))] = (Random integer number between 1 and 6)
      • Set VariableSet Advantage_select3[(Player number of (Owner of (Triggering unit)))] = (Random integer number between 1 and 6)
      • Dialog - Create a dialog button for Level_Dialog[(Player number of (Owner of (Triggering unit)))] labelled Advantages_Strings[Advantage_select1[(Player number of (Owner of (Triggering unit)))]]
      • Set VariableSet Level_Dialog_Button1[(Player number of (Owner of (Triggering unit)))] = (Last created dialog Button)
      • Dialog - Create a dialog button for Level_Dialog[(Player number of (Owner of (Triggering unit)))] labelled Advantages_Strings[Advantage_select2[(Player number of (Owner of (Triggering unit)))]]
      • Set VariableSet Level_Dialog_Button2[(Player number of (Owner of (Triggering unit)))] = (Last created dialog Button)
      • Dialog - Create a dialog button for Level_Dialog[(Player number of (Owner of (Triggering unit)))] labelled Advantages_Strings[Advantage_select3[(Player number of (Owner of (Triggering unit)))]]
      • Set VariableSet Level_Dialog_Button3[(Player number of (Owner of (Triggering unit)))] = (Last created dialog Button)
      • Dialog - Show Level_Dialog[(Player number of (Owner of (Triggering unit)))] for (Owner of (Triggering unit))
  • Button click
    • Events
      • Dialog - A dialog button is clicked for Level_Dialog[1]
      • Dialog - A dialog button is clicked for Level_Dialog[2]
      • Dialog - A dialog button is clicked for Level_Dialog[3]
      • Dialog - A dialog button is clicked for Level_Dialog[4]
      • Dialog - A dialog button is clicked for Level_Dialog[5]
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to Level_Dialog_Button1[(Integer A)]
            • Then - Actions
              • Player - Set the current research level of Random_Advantages[Advantage_select1[(Player number of (Triggering player))]] to ((Current research level of Random_Advantages[Advantage_select1[(Player number of (Triggering player))]] for (Triggering player)) + 1) for (Triggering player)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to Level_Dialog_Button2[(Integer A)]
                • Then - Actions
                  • Player - Set the current research level of Random_Advantages[Advantage_select2[(Player number of (Triggering player))]] to ((Current research level of Random_Advantages[Advantage_select2[(Player number of (Triggering player))]] for (Triggering player)) + 1) for (Triggering player)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Clicked dialog button) Equal to Level_Dialog_Button3[(Integer A)]
                    • Then - Actions
                      • Player - Set the current research level of Random_Advantages[Advantage_select3[(Player number of (Triggering player))]] to ((Current research level of Random_Advantages[Advantage_select3[(Player number of (Triggering player))]] for (Triggering player)) + 1) for (Triggering player)
                    • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Don't reference Integer A in your conditions:
  • (Clicked dialog button) Equal to Level_Dialog_Button3[(Integer A)]
Instead, reference the Player Number of the Triggering Player. The Loop isn't necessary.

Also, a nice shortcut in the future would be to use an Integer variable as your Player Number. This helps with visual clarity and makes it easier to work with:
  • Set VariableSet PN = Player number of (Owner of (Triggering unit))
  • Set VariableSet Advantage_select1[PN] = (Random integer number between 1 and 6)
  • Set VariableSet Advantage_select2[PN] = (Random integer number between 1 and 6)
  • Set VariableSet Advantage_select3[PN] = (Random integer number between 1 and 6)
 
Last edited:
Status
Not open for further replies.
Top