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

Dialog button help

Status
Not open for further replies.

S11

S11

Level 3
Joined
Apr 29, 2012
Messages
41
Need help fixing .omg's Moded stat system, +Rep will be given

So i asked .omg if i could mod his stat system to fix my liking and he had said yes so what i did was I Created this Dialog, with 4 options, str, int, agi, cancel.

What i need Help with is

-When you hit ESC it shows how many stat points you have in dialog box
-When you spend a point it deducts it from the dialog and shows the new available stat points
-Does not glitch out rapidly clicking esc
-Does not glitch out dieing while putting stats in


Problems with this Dialog button

-Rapidly press ESC, stat system breaks
-Die while doing stat points, Stat system yet again breaks

Here are the codes

  • Stats Ini
    • Events
      • Map intialization
    • Conditions
      • none
    • Actions
      • Set MaxPlayersCount = 10
      • Set Stats_UnitType=____
      • -----count of unspent points when lvlup------
      • For each (Integer Index)from 1 to MaxPlayersCount, do (actions)
      • Loop - Actions
        • Set UnsuspentSP[index] = UP_Number
        • Set HeroLevel[index] = 1
      • Set Stats_Text[1] = |c00FF0000Strength|r :
      • Set Stats_Text[2] = |c0017CB33Agility|r :
      • Set Stats_Text[3] = |c001407A6intelligence|r :
  • Selection Clearing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • UnsuspentSP[(Player number of (Triggering player))] Greater than 0
      • Stats_Hero[(Player number of (Triggering player))] Not equal to No unit
      • (Stats_Hero[(Player number of (Triggering player))] is alive) Equal to True
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[1]
        • Then - Actions
          • Set HeroStr[(Player number of (Triggering player))] = ((Strength of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
          • Floating Text - Change text of Str_Floating_Text[(Player number of (Triggering player))] to (String(HeroStr[(Player number of (Triggering player))])) using font size Stats_Size
          • -------- - --------
          • Hero - Modify Strength of Stats_Hero[(Player number of (Triggering player))]: Add 1
          • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using StrSP
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[2]
        • Then - Actions
          • Set HeroAg[(Player number of (Triggering player))] = ((Agility of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
          • Floating Text - Change text of Ag_Floating_Text[(Player number of (Triggering player))] to (String(HeroAg[(Player number of (Triggering player))])) using font size Stats_Size
          • -------- - --------
          • Hero - Modify Agility of Stats_Hero[(Player number of (Triggering player))]: Add 1
          • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using AgSP
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[3]
        • Then - Actions
          • Set HeroInt[(Player number of (Triggering player))] = ((Intelligence of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
          • Floating Text - Change text of Int_Floating_Text[(Player number of (Triggering player))] to (String(HeroInt[(Player number of (Triggering player))])) using font size Stats_Size
          • -------- - --------
          • Hero - Modify Intelligence of Stats_Hero[(Player number of (Triggering player))]: Add 1
          • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using IntSP
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[4]
        • Then - Actions
          • Dialog - Hide MyDialog for (Triggering player)
        • Else - Actions
      • Set UnsuspentSP[(Player number of (Triggering player))] = (UnsuspentSP[(Player number of (Triggering player))] - 1)
      • Floating Text - Change text of Floating_Text_Array_Unsuspent[(Player number of (Triggering player))] to (String(UnsuspentSP[(Player number of (Triggering player))])) using font size UnspentSize
      • -------- - --------
      • Skip remaining actions
    • Else - Actions
  • ESC Selection
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
    • Conditions
    • Actions
      • Wait 0.03 seconds
      • Dialog - Clear MyDialog
      • Dialog - Change the title of MyDialog to Upgrade Stats
      • Dialog - Create a dialog button for MyDialog labelled Str
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Agi
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Int
      • Set DialogButton[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Cancel
      • Set DialogButton[4] = (Last created dialog Button)
      • Dialog - Show MyDialog for (Triggering player)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
To prevent ESC bugging, use a boolean array. In ESC selection, check if boolean[plr number] == false. If it is false then do the actions and set the boolean to true. If the boolean was true, don't do any actions. When a player exits the dialog, set the boolean to false.
 
  • Like
Reactions: S11

S11

S11

Level 3
Joined
Apr 29, 2012
Messages
41
To prevent ESC bugging, use a boolean array. In ESC selection, check if boolean[plr number] == false. If it is false then do the actions and set the boolean to true. If the boolean was true, don't do any actions. When a player exits the dialog, set the boolean to false.

Thank you for that, but do you know how to make the number apear in the dialog box?

-edit-

i added in the boolean to esc selection and selection clearing and now when i click on a ablitly point to spend my ablity points it doesnt change my stats, and nor can i hit esc again ill show you the triggers

-edit-

i can spend the first 5 points and get my stats changed but once i spend all the points i can't hit essc anymore, even if i lvl, esc wont open dialog box

  • Selection Clearing Copy
    • Events
      • Dialog - A dialog button is clicked for MyDialog
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnsuspentSP[(Player number of (Triggering player))] Greater than 0
          • Stats_Hero[(Player number of (Triggering player))] Not equal to No unit
          • (Stats_Hero[(Player number of (Triggering player))] is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[1]
            • Then - Actions
              • Set Boolean[(Player number of (Triggering player))] = False
              • Set HeroStr[(Player number of (Triggering player))] = ((Strength of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
              • Floating Text - Change text of Str_Floating_Text[(Player number of (Triggering player))] to (String(HeroStr[(Player number of (Triggering player))])) using font size Stats_Size
              • -------- - --------
              • Hero - Modify Strength of Stats_Hero[(Player number of (Triggering player))]: Add 1
              • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using StrSP
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[2]
            • Then - Actions
              • Set Boolean[(Player number of (Triggering player))] = False
              • Set HeroAg[(Player number of (Triggering player))] = ((Agility of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
              • Floating Text - Change text of Ag_Floating_Text[(Player number of (Triggering player))] to (String(HeroAg[(Player number of (Triggering player))])) using font size Stats_Size
              • -------- - --------
              • Hero - Modify Agility of Stats_Hero[(Player number of (Triggering player))]: Add 1
              • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using AgSP
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[3]
            • Then - Actions
              • Set Boolean[(Player number of (Triggering player))] = False
              • Set HeroInt[(Player number of (Triggering player))] = ((Intelligence of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
              • Floating Text - Change text of Int_Floating_Text[(Player number of (Triggering player))] to (String(HeroInt[(Player number of (Triggering player))])) using font size Stats_Size
              • -------- - --------
              • Hero - Modify Intelligence of Stats_Hero[(Player number of (Triggering player))]: Add 1
              • Special Effect - Create a special effect attached to the PointSP of Stats_Hero[(Player number of (Triggering player))] using IntSP
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[4]
            • Then - Actions
              • Set Boolean[(Player number of (Triggering player))] = False
              • Dialog - Hide MyDialog for (Triggering player)
            • Else - Actions
          • Set UnsuspentSP[(Player number of (Triggering player))] = (UnsuspentSP[(Player number of (Triggering player))] - 1)
          • Floating Text - Change text of Floating_Text_Array_Unsuspent[(Player number of (Triggering player))] to (String(UnsuspentSP[(Player number of (Triggering player))])) using font size UnspentSize
          • -------- - --------
          • Skip remaining actions
        • Else - Actions
      • Selection - Select Stats_Hero[(Player number of (Triggering player))] for (Triggering player)
  • ESC Selection Copy
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
    • Conditions
      • Boolean[(Player number of (Triggering player))] Equal to False
    • Actions
      • Set Boolean[(Player number of (Triggering player))] = True
      • Wait 0.03 seconds
      • Dialog - Clear MyDialog
      • Dialog - Change the title of MyDialog to Upgrade Stats
      • Dialog - Create a dialog button for MyDialog labelled Str
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Agi
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Int
      • Set DialogButton[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled Cancel
      • Set DialogButton[4] = (Last created dialog Button)
      • Dialog - Show MyDialog for (Triggering player)
 
Last edited:
Level 19
Joined
Feb 25, 2009
Messages
2,004
Why do you re-create the dialog everytime you run it?
You need to make it only once, even in initialization trigger, for better.

Waits below 0.27 do not work, so you can remove that too.

  • Set HeroStr[(Player number of (Triggering player))] = ((Strength of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
Put that after all actions for Strenght and change it to:

  • Set HeroStr[(Player number of (Triggering player))] = (Strength of Stats_Hero[(Player number of (Triggering player)])
You can do it for all others as well.

Put an "Or - Any Conditions are True" here:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Clicked dialog button) Equal to DialogButton[4]
  • Then - Actions
  • Set Boolean[(Player number of (Triggering player))] = False
  • Dialog - Hide MyDialog for (Triggering player)
  • Else - Actions
And check when the player points are 0, this should fix the bug.
 

S11

S11

Level 3
Joined
Apr 29, 2012
Messages
41
Why do you re-create the dialog everytime you run it?
You need to make it only once, even in initialization trigger, for better.

Waits below 0.27 do not work, so you can remove that too.

  • Set HeroStr[(Player number of (Triggering player))] = ((Strength of Stats_Hero[(Player number of (Triggering player))] (Exclude bonuses)) + 1)
Put that after all actions for Strenght and change it to:

  • Set HeroStr[(Player number of (Triggering player))] = (Strength of Stats_Hero[(Player number of (Triggering player)])
You can do it for all others as well.

Put an "Or - Any Conditions are True" here:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Clicked dialog button) Equal to DialogButton[4]
  • Then - Actions
  • Set Boolean[(Player number of (Triggering player))] = False
  • Dialog - Hide MyDialog for (Triggering player)
  • Else - Actions
And check when the player points are 0, this should fix the bug.

What exactly do you mean check when player points are 0, oh do you know how i would put in player points into the dialog box?, and how would i make the diaglog box run only once
 

S11

S11

Level 3
Joined
Apr 29, 2012
Messages
41
You could check if the player has any points, so if there are no one left, close the dialog, instead of forcing the player to press the 'Cancel' button everytime.

hmm ill see what i can do with that , not exactly sure how to do that but ill try
 
Status
Not open for further replies.
Top