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

Will this work for multiple players?

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, as the title reads i wonder if this will work properly for multiple players or if it will cause problems.

  • Dialog1
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet LevelingHero = (Triggering unit)
      • Dialog - Clear Dialog
      • Dialog - Change the title of Dialog to Choose your attribu...
      • Dialog - Create a dialog button for Dialog labelled |cffff0000Strength ...
      • Set VariableSet Dialog_Str = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled |cff00ff00Agility |...
      • Set VariableSet Dialog_Agi = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled |cff8080ffIntellige...
      • Set VariableSet Dialog_Int = (Last created dialog Button)
      • Dialog - Show Dialog for (Owner of LevelingHero)
  • Choose1
    • Events
      • Dialog - A dialog button is clicked for Dialog
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Str
        • Then - Actions
          • Hero - Modify Strength of LevelingHero: Add 1.
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Agi
        • Then - Actions
          • Hero - Modify Agility of LevelingHero: Add 1.
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Int
        • Then - Actions
          • Hero - Modify Intelligence of LevelingHero: Add 1.
        • Else - Actions
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
How many heroes does every player have ? It should work fine if we assume that the heroes gain a level at different times, but if it happens on the same time it will be problematic... (LevelingHero will get overwritten) That's why you have to index them.
  • Leve Up Dialog
    • Events
      • Unit - A unit Gain a level
    • Conditions
      • ((Triggering unit) is Un hero) Equal to TRUE
    • Actions
      • Set Integer = (Integer + 1)
      • Set Hero[Integer] = (Triggering unit)
      • Dialog - Clear Dialog
      • Dialog - Change the title of Dialog to Attributes
      • Dialog - Create a dialog button for Dialog labelled Strength
      • Set Dialog_Str[Integer] = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled Agility
      • Set Dialog_Agi[Integer] = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled Intelligence
      • Set Dialog_Int[Integer] = (Last created dialog Button)
      • Dialog - Show Dialog for (Owner of (Triggering unit))
  • Dialog Click
    • Events
      • Dialog - A dialog button is clicked for Dialog
    • Conditions
    • Actions
      • Set Recycle = (Recycle + 1)
      • -------- Strength --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Str[Recycle]
        • Then - Actions
          • Hero - Modify Strength of Hero[Recycle]: Add 1
        • Else - Actions
      • -------- Agility --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Agi[Recycle]
        • Then - Actions
          • Hero - Modify Agility of Hero[Recycle]: Add 1
        • Else - Actions
      • -------- Intelligence --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Int[Recycle]
        • Then - Actions
          • Hero - Modify Intelligence of Hero[Recycle]: Ajouter 1
        • Else - Actions
      • -------- Reset Integers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Recycle Equal to Integer
        • Then - Actions
          • Set Integer = 0
          • Set Recycle = 0
        • Else - Actions
This should work if each player has only ONE hero.
 
Level 7
Joined
Feb 23, 2020
Messages
253
How many heroes does every player have ? It should work fine if we assume that the heroes gain a level at different times, but if it happens on the same time it will be problematic... (LevelingHero will get overwritten) That's why you have to index them.
  • Leve Up Dialog
    • Events
      • Unit - A unit Gain a level
    • Conditions
      • ((Triggering unit) is Un hero) Equal to TRUE
    • Actions
      • Set Integer = (Integer + 1)
      • Set Hero[Integer] = (Triggering unit)
      • Dialog - Clear Dialog
      • Dialog - Change the title of Dialog to Attributes
      • Dialog - Create a dialog button for Dialog labelled Strength
      • Set Dialog_Str[Integer] = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled Agility
      • Set Dialog_Agi[Integer] = (Last created dialog Button)
      • Dialog - Create a dialog button for Dialog labelled Intelligence
      • Set Dialog_Int[Integer] = (Last created dialog Button)
      • Dialog - Show Dialog for (Owner of (Triggering unit))
  • Dialog Click
    • Events
      • Dialog - A dialog button is clicked for Dialog
    • Conditions
    • Actions
      • Set Recycle = (Recycle + 1)
      • -------- Strength --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Str[Recycle]
        • Then - Actions
          • Hero - Modify Strength of Hero[Recycle]: Add 1
        • Else - Actions
      • -------- Agility --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Agi[Recycle]
        • Then - Actions
          • Hero - Modify Agility of Hero[Recycle]: Add 1
        • Else - Actions
      • -------- Intelligence --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Int[Recycle]
        • Then - Actions
          • Hero - Modify Intelligence of Hero[Recycle]: Ajouter 1
        • Else - Actions
      • -------- Reset Integers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Recycle Equal to Integer
        • Then - Actions
          • Set Integer = 0
          • Set Recycle = 0
        • Else - Actions
This should work if each player has only ONE hero.

oooh okay i see, thank you very much mate! And yes, each player have 1 hero only. :)

Edit: So the dialog should be own to "Triggering unit", and not the "Hero[Integer]"?
I also have 2 dialogs when leveling up, the first one which looks like this: "Choose your attribute 2/2" then -> "Choose your attribute 1/2". Should i just repeat the steps again?
 
Last edited:
Level 28
Joined
Feb 18, 2014
Messages
3,579
Edit: So the dialog should be own to "Triggering unit", and not the "Hero[Integer]"?
Yes, You can use "Triggering unit" since dialogs are displayed locally.
I also have 2 dialogs when leveling up, the first one which looks like this: "Choose your attribute 2/2" then -> "Choose your attribute 1/2". Should i just repeat the steps again?
You mean like 2 dialogs ? You pick an attribute then a second dialog pop out ? Yeah, I think you can repeat the steps but use different integers.
 
Level 7
Joined
Feb 23, 2020
Messages
253
Yes, You can use "Triggering unit" since dialogs are displayed locally.

You mean like 2 dialogs ? You pick an attribute then a second dialog pop out ? Yeah, I think you can repeat the steps but use different integers.
Yes exactly. Okay i will try this out thank you! :)
 
Status
Not open for further replies.
Top