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

[Trigger] Only working for player 1?

Status
Not open for further replies.
Level 11
Joined
Jun 30, 2008
Messages
580
What is wrong with this?
It only works for player 1 for some reason and not player 2??? Why?

  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetBuyingUnit()) then
      • Quest - Enable Quest[A_QuestOther_ARRAY]
      • Custom script: endif
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Quest_Integer = (Quest_Integer + 1)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set A_ARRAY = ((Player number of (Picked player)) + (10 x Quest_Integer))
          • Quest - Create a Required quest titled Message with the description Bring it to the Bla..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
          • Quest - Disable (Last created quest)
          • Set Quest[A_ARRAY] = (Last created quest)
Idk what is the problem?
 
Level 8
Joined
Aug 4, 2006
Messages
357
  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetBuyingUnit()) then
      • Quest - Enable Quest[A_QuestOther_ARRAY]
      • Custom script: endif
This will Enable the Quest[...] for the owner of the buying unit and no one else. This means that if Player 1 triggers this event, the quest will only be enabled for Player 1. If you want it to enable the quest for all players, take out the custom script.

I'm not quite sure what the problem is. What is only working for player 1? Can you be more specific? Have you actually tried having player 2 sell a unit from a unit?
 
Level 11
Joined
Jun 30, 2008
Messages
580
Im trying to make a quest be created to only one player. Ive tried this online and for some reason when player 2 buys a unit nothing happens for them....
I want the quest show in the quest dialog only for the player who has the quest. For some reason it works for player red but not for any other player. l
Like Player 1 gets the quest and it only shows in his quest dialog but when player 2 gets the quest nothing is shown in their quest dialog but it still shows in player 1's
 
Level 8
Joined
Aug 4, 2006
Messages
357
Assuming Quest_Integer for this quest is 1, try this:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Quest_Integer = (Quest_Integer + 1)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set A_ARRAY = ((Player number of (Picked player)) + (100 x Quest_Integer))
          • Quest - Create a Required quest titled Message with the description Bring it to the Bla..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
          • Quest - Disable (Last created quest)
          • Set Quest[A_ARRAY] = (Last created quest)
I changed it to 100 x Quest_Integer so that it will not screw up for players 10, 11, or 12.
  • Enable Quest 1
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetBuyingUnit()) then
      • Quest - Enable Quest[((Player number of (Owner of (Buying Unit))) + (100))]
      • Custom script: endif
This should enable a different quest for each player, even though they all have the same description. I think the problem was that you tried to enable the same quest twice for two different players. I'm not sure. Remember to add a condition to this trigger so it won't go off for every unit selling event.
 
Level 11
Joined
Jun 30, 2008
Messages
580
I took the other code out of a code im using so you dont get confused with the other stuff.
I am realizing somehting
Can it be being in a integer have anyhting to do with it? Here is the whole code

  • QuestOther
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Enquire Quest
    • Actions
      • For each (Integer Loop[1]) from 1 to Quest_Integer, do (Actions)
        • Loop - Actions
          • Set A_QuestOther_ARRAY = ((Player number of (Owner of (Buying unit))) + (10 x Loop[1]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest_Level_Petty[A_QuestOther_ARRAY] Equal to Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Quest_Type_Other[A_QuestOther_ARRAY] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Selling unit) Equal to Quest_Unit[A_QuestOther_ARRAY]
                      • Quest_Int[A_QuestOther_ARRAY] Not equal to Loop[1]
                    • Then - Actions
                      • Custom script: if GetLocalPlayer() == Player(0) then
                      • Quest - Enable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Custom script: if GetLocalPlayer() == Player(1) then
                      • Quest - Enable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Set Quest_Int[A_QuestOther_ARRAY] = Loop[1]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Update message: Quest_Message[A_QuestOther_ARRAY]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Selling unit)) Equal to (Unit-type of Quest_Target[A_QuestOther_ARRAY])
                      • Quest_Int_2[A_QuestOther_ARRAY] Not equal to Loop[1]
                      • Quest_Int[A_QuestOther_ARRAY] Equal to Loop[1]
                    • Then - Actions
                      • Set Quest_Int_2[A_QuestOther_ARRAY] = Loop[1]
                      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetBuyingUnit()) then
                      • Quest - Disable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Completed message: Quest_Message_Complete[A_QuestOther_ARRAY]
                      • Player - Add Quest_Reward_Copper[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current gold
                      • Player - Add Quest_Reward_Silver[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current lumber
                      • Hero - Add Quest_Reward_Exp[A_QuestOther_ARRAY] experience to PlayerUnits[(Player number of (Owner of (Buying unit)))], Hide level-up graphics
                      • Hero - Create Quest_Reward_Item[A_QuestOther_ARRAY] and give it to PlayerUnits[(Player number of (Owner of (Buying unit)))]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the New Item Received message: ((String(Quest_Reward_Copper[A_QuestOther_ARRAY])) + (Gold, + ((String(Quest_Reward_Silver[A_QuestOther_ARRAY])) + (Lumber, + ((String(Quest_Reward_Exp[A_QuestOther_ARRAY])) + (Exp, and + ((Name of (Last created item)) + recieved!)))))))
                      • Set Quest_Level_Petty[A_QuestOther_ARRAY] = (Quest_Level_Petty[A_QuestOther_ARRAY] + 1)
                      • Set Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))] = (Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))] + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
      • For each (Integer Loop[2]) from 1 to Quest_Integer, do (Actions)
        • Loop - Actions
          • Set A_QuestOther_ARRAY = ((Player number of (Owner of (Buying unit))) + (10 x Loop[2]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest_Level_Epic[A_QuestOther_ARRAY] Equal to Quest_Level_Epic_Player[(Player number of (Owner of (Buying unit)))]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Quest_Type_Other[A_QuestOther_ARRAY] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Selling unit) Equal to Quest_Unit[A_QuestOther_ARRAY]
                      • Quest_Int[A_QuestOther_ARRAY] Not equal to Loop[2]
                    • Then - Actions
                      • Set Quest_Int[A_QuestOther_ARRAY] = Loop[2]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Update message: Quest_Message[A_QuestOther_ARRAY]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Selling unit)) Equal to (Unit-type of Quest_Target[A_QuestOther_ARRAY])
                      • Quest_Int_2[A_QuestOther_ARRAY] Not equal to Loop[2]
                      • Quest_Int[A_QuestOther_ARRAY] Equal to Loop[2]
                    • Then - Actions
                      • Set Quest_Int_2[A_QuestOther_ARRAY] = Loop[2]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Completed message: Quest_Message_Complete[A_QuestOther_ARRAY]
                      • Player - Add Quest_Reward_Copper[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current gold
                      • Player - Add Quest_Reward_Silver[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current lumber
                      • Hero - Add Quest_Reward_Exp[A_QuestOther_ARRAY] experience to PlayerUnits[(Player number of (Owner of (Buying unit)))], Hide level-up graphics
                      • Hero - Create Quest_Reward_Item[A_QuestOther_ARRAY] and give it to PlayerUnits[(Player number of (Owner of (Buying unit)))]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the New Item Received message: ((String(Quest_Reward_Copper[A_QuestOther_ARRAY])) + (Gold, + ((String(Quest_Reward_Silver[A_QuestOther_ARRAY])) + (Lumber, + ((String(Quest_Reward_Exp[A_QuestOther_ARRAY])) + (Exp, and + ((Name of (Last created item)) + recieved!)))))))
                      • Set Quest_Level_Epic[A_QuestOther_ARRAY] = (Quest_Level_Epic[A_QuestOther_ARRAY] + 1)
                      • Set Quest_Level_Epic_Player[(Player number of (Owner of (Buying unit)))] = (Quest_Level_Epic_Player[(Player number of (Owner of (Buying unit)))] + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
      • For each (Integer Loop[3]) from 1 to Quest_Integer, do (Actions)
        • Loop - Actions
          • Set A_QuestOther_ARRAY = ((Player number of (Owner of (Buying unit))) + (10 x Loop[3]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest_Level_Story[A_QuestOther_ARRAY] Equal to Quest_Level_Story_Player[(Player number of (Owner of (Buying unit)))]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Quest_Type_Other[A_QuestOther_ARRAY] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Selling unit) Equal to Quest_Unit[A_QuestOther_ARRAY]
                      • Quest_Int[A_QuestOther_ARRAY] Not equal to Loop[3]
                    • Then - Actions
                      • Set Quest_Int[A_QuestOther_ARRAY] = Loop[3]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Update message: Quest_Message[A_QuestOther_ARRAY]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Selling unit)) Equal to (Unit-type of Quest_Target[A_QuestOther_ARRAY])
                      • Quest_Int_2[A_QuestOther_ARRAY] Not equal to Loop[3]
                      • Quest_Int[A_QuestOther_ARRAY] Equal to Loop[3]
                    • Then - Actions
                      • Set Quest_Int_2[A_QuestOther_ARRAY] = Loop[3]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Completed message: Quest_Message_Complete[A_QuestOther_ARRAY]
                      • Player - Add Quest_Reward_Copper[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current gold
                      • Player - Add Quest_Reward_Silver[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current lumber
                      • Hero - Add Quest_Reward_Exp[A_QuestOther_ARRAY] experience to PlayerUnits[(Player number of (Owner of (Buying unit)))], Hide level-up graphics
                      • Hero - Create Quest_Reward_Item[A_QuestOther_ARRAY] and give it to PlayerUnits[(Player number of (Owner of (Buying unit)))]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the New Item Received message: ((String(Quest_Reward_Copper[A_QuestOther_ARRAY])) + (Gold, + ((String(Quest_Reward_Silver[A_QuestOther_ARRAY])) + (Lumber, + ((String(Quest_Reward_Exp[A_QuestOther_ARRAY])) + (Exp, and + ((Name of (Last created item)) + recieved!)))))))
                      • Set Quest_Level_Story[A_QuestOther_ARRAY] = (Quest_Level_Story[A_QuestOther_ARRAY] + 1)
                      • Set Quest_Level_Story_Player[(Player number of (Owner of (Buying unit)))] = (Quest_Level_Story_Player[(Player number of (Owner of (Buying unit)))] + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Level 8
Joined
Aug 4, 2006
Messages
357
I am sorry, but that code is way too huge and convoluted for me to understand. Could you put it in hidden tags? Maybe an expert at GUI can help you. I'd suggest disabling that huge trigger, testing to see if my small triggers work for more than player 1, and then rebuilding your big trigger around my triggers. Also, I have no idea what you mean by "it be being in a integer".
 
Level 11
Joined
Jun 30, 2008
Messages
580
Integer Array... Sorry
Here
  • QuestOther
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Enquire Quest
    • Actions
      • For each (Integer Loop[1]) from 1 to Quest_Integer, do (Actions)
        • Loop - Actions
          • Set A_QuestOther_ARRAY = ((Player number of (Owner of (Buying unit))) + (10 x Loop[1]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Quest_Level_Petty[A_QuestOther_ARRAY] Equal to Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Quest_Type_Other[A_QuestOther_ARRAY] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Selling unit) Equal to Quest_Unit[A_QuestOther_ARRAY]
                      • Quest_Int[A_QuestOther_ARRAY] Not equal to Loop[1]
                    • Then - Actions
                      • Custom script: if GetLocalPlayer() == Player(0) then
                      • Quest - Enable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Custom script: if GetLocalPlayer() == Player(1) then
                      • Quest - Enable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Set Quest_Int[A_QuestOther_ARRAY] = Loop[1]
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Update message: Quest_Message[A_QuestOther_ARRAY]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Selling unit)) Equal to (Unit-type of Quest_Target[A_QuestOther_ARRAY])
                      • Quest_Int_2[A_QuestOther_ARRAY] Not equal to Loop[1]
                      • Quest_Int[A_QuestOther_ARRAY] Equal to Loop[1]
                    • Then - Actions
                      • Set Quest_Int_2[A_QuestOther_ARRAY] = Loop[1]
                      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetBuyingUnit()) then
                      • Quest - Disable Quest[(Player number of (Owner of (Buying unit)))]
                      • Custom script: endif
                      • Cinematic - Clear the screen of text messages for (Player group((Owner of (Buying unit))))
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Hint message: Quest_Name[A_QuestOther_ARRAY]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the Quest Completed message: Quest_Message_Complete[A_QuestOther_ARRAY]
                      • Player - Add Quest_Reward_Copper[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current gold
                      • Player - Add Quest_Reward_Silver[A_QuestOther_ARRAY] to (Owner of (Buying unit)) Current lumber
                      • Hero - Add Quest_Reward_Exp[A_QuestOther_ARRAY] experience to PlayerUnits[(Player number of (Owner of (Buying unit)))], Hide level-up graphics
                      • Hero - Create Quest_Reward_Item[A_QuestOther_ARRAY] and give it to PlayerUnits[(Player number of (Owner of (Buying unit)))]
                      • Quest - Display to (Player group((Owner of (Buying unit)))) the New Item Received message: ((String(Quest_Reward_Copper[A_QuestOther_ARRAY])) + (Gold, + ((String(Quest_Reward_Silver[A_QuestOther_ARRAY])) + (Lumber, + ((String(Quest_Reward_Exp[A_QuestOther_ARRAY])) + (Exp, and + ((Name of (Last created item)) + recieved!)))))))
                      • Set Quest_Level_Petty[A_QuestOther_ARRAY] = (Quest_Level_Petty[A_QuestOther_ARRAY] + 1)
                      • Set Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))] = (Quest_Level_Petty_Player[(Player number of (Owner of (Buying unit)))] + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Status
Not open for further replies.
Top