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

Triggered XP System Issues

Status
Not open for further replies.
Level 6
Joined
Jan 8, 2009
Messages
140
I'm trying to have a triggered XP system for 10 levels with custom level brackets, however I can't get the bracket or level to update correctly.

  • Initialisation
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- XP Setup --------
      • Set XPBrackets[1] = 20
      • Set XPBrackets[2] = 50
      • Set XPBrackets[3] = 95
      • Set XPBrackets[4] = 145
      • Set XPBrackets[5] = 220
      • Set XPBrackets[6] = 340
      • Set XPBrackets[7] = 480
      • Set XPBrackets[8] = 630
      • Set XPBrackets[9] = 800
      • Set XPBrackets[10] = 1000
  • XP Update
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 1 (Red)
    • Actions
      • Set XP = (XP + ((Level of (Dying unit)) x 2))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • XP Greater than or equal to XPBrackets[Level]
          • Level Less than 10
        • Then - Actions
          • Set Level = (Level + 1)
          • Multiboard - Set the text for Multiboard item in column 2, row 2 to (String(Level))
          • Multiboard - Set the text for Multiboard item in column 3, row 5 to (|cffffcc00[|r + ((String(XP)) + (|cffffcc00/|r + ((String(XPBrackets[Level])) + |cffffcc00]|r))))
        • Else - Actions
      • Multiboard - Set the text for Multiboard item in column 3, row 5 to (|cffffcc00[|r + ((String(XP)) + (|cffffcc00/|r + ((String(XPBrackets[Level])) + |cffffcc00]|r))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • XP Greater than 1000
        • Then - Actions
          • Set XP = 1000
          • Multiboard - Set the text for Multiboard item in column 3, row 5 to |cffffcc00[|r1000|c...
        • Else - Actions
 
Level 15
Joined
Oct 18, 2008
Messages
1,588
  • XP Update
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 1 (Red)
      • XP Lower than 1000
    • Actions
      • Set XP = (XP + ((Level of (Dying unit)) x 2))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • XP Greater than 1000
        • Then - Actions
          • Set XP = 1000
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • XP Greater than or equal to XPBrackets[Level]
          • Level Less than 10
        • Then - Actions
          • Set Level = (Level + 1)
          • Multiboard - Set the text for Multiboard item in column 2, row 2 to (String(Level))
        • Else - Actions
      • Multiboard - Set the text for Multiboard item in column 3, row 5 to (|cffffcc00[|r + ((String(XP)) + (|cffffcc00/|r + ((String(XPBrackets[Level])) + |cffffcc00]|r))))
This looks and works much smoother. No need to run the trigger if the XP is above 1000, and no need to update the multiboard 3x in a trigger with the same line.

Also, I'm not sure but I think if you change the content of a multiboard, you have to hide it and then show it, if I remember right.
 
Level 6
Joined
Jan 8, 2009
Messages
140
Thanks a lot that fixed it! I agree, much cleaner looking trigger. The multiboard updates fine without hiding then showing it though.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Wc3 handles Triggering Unit faster and better than other Event Response units. It's the only Unit Event Response you can use after a wait in a trigger without having to store it in a variable. So, it's better because Blizzard decided it.
 
Status
Not open for further replies.
Top