• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Code Check] Random Stat Distribution System

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
So, I had a cool idea last night and I spent a few hours making a mock-up of one of the systems I'd have for this idea. It's a system that sets up a random amount of stat points to be distributed between 5 attributes. Health, Damage, Speed, Defense, and Special. Each level up, which is simulated by one of the loops, anywhere between 1 and 5 stats will be taken out of the pool and randomly distributed to the 5 attributes. Each attribute is also randomly given a modifier to their chance at getting the randomly distributed stat point. There are some cases to determine if their points are too low, then they get evolutions to give them more points. The goal of the evolutions is to make sure most of the randomly generated stats are roughly equal with each other, and then I also cap it at 300 to make sure they don't blow the fuck up (Highest possible stat would be ~650, if I didn't cap it at 300). Finally, if any attribute has less than 5 points, we'll remove however many points is missing from the stat pool and add it that attribute.

Anyway, what I'm asking is for some code-checking to make sure this is all sound and functional. I don't quite got time to debug it right now, so I don't really even know if it works yet or not.

The reason why nothing is being stored is because this is just made to figure out how the logics for all these mechanics would work and how big of a system I'd be working on. It doesn't seem like it'd be too big, judging by this. If any of it could be more efficient, I will take advice there too.

BonusConstant = 50

  • Stat Distribution
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Level = (Random integer number between 1 and 100)
      • Set RandomMultiplier = (Random integer number between 1 and 6)
      • Set StatPool = ((Level x RandomMultiplier) + BonusConstant)
      • For each (Integer StatDistribution[3]) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set AttributeFavor[StatDistribution[3]] = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StatPool Less than 100
        • Then - Actions
          • Set EvolutionCount = 3
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • StatPool Greater than or equal to 100
              • StatPool Less than 150
            • Then - Actions
              • Set EvolutionCount = 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • StatPool Greater than or equal to 150
                  • StatPool Less than 200
                • Then - Actions
                  • Set EvolutionCount = 1
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EvolutionCount Greater than 0
        • Then - Actions
          • For each (Integer StatDistribution[4]) from 1 to EvolutionCount, do (Actions)
            • Loop - Actions
              • Set StatPool = (StatPool + (Random integer number between 20 and 70))
          • Set EvolutionCount = 0
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StatPool Greater than 300
        • Then - Actions
          • Set StatPool = 300
        • Else - Actions
      • For each (Integer StatDistribution[5]) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Attribute[StatDistribution[5]] Less than 5
            • Then - Actions
              • Set Attribute[6] = (5 - Attribute[StatDistribution[5]])
              • Set StatPool = (StatPool - Attribute[6])
              • Set Attribute[StatDistribution[5]] = (Attribute[StatDistribution[5]] + Attribute[6])
            • Else - Actions
      • For each (Integer StatDistribution[1]) from 1 to StatPool, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • StatPool Greater than 0
              • Level Less than 100
            • Then - Actions
              • For each (Integer StatDistribution[2]) from 1 to (Random integer number between 1 and 5), do (Actions)
                • Loop - Actions
                  • Set RandomAttribute = (Random integer number between 1 and ((((AttributeFavor[1] + AttributeFavor[2]) + AttributeFavor[3]) + AttributeFavor[4]) + AttributeFavor[5]))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RandomAttribute Equal to (Random integer number between 1 and AttributeFavor[1])
                    • Then - Actions
                      • Set Attribute[1] = (Attribute[1] + 1)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RandomAttribute Equal to (Random integer number between (AttributeFavor[1] + 1) and (AttributeFavor[1] + AttributeFavor[2]))
                        • Then - Actions
                          • Set Attribute[2] = (Attribute[2] + 1)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • RandomAttribute Equal to (Random integer number between ((AttributeFavor[1] + AttributeFavor[2]) + 1) and ((AttributeFavor[1] + AttributeFavor[2]) + AttributeFavor[3]))
                            • Then - Actions
                              • Set Attribute[3] = (Attribute[3] + 1)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • RandomAttribute Equal to (Random integer number between ((AttributeFavor[1] + (AttributeFavor[2] + AttributeFavor[3])) + 1) and ((AttributeFavor[1] + (AttributeFavor[2] + AttributeFavor[3])) + AttributeFavor[4]))
                                • Then - Actions
                                  • Set Attribute[4] = (Attribute[4] + 1)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • RandomAttribute Equal to (Random integer number between ((AttributeFavor[1] + (AttributeFavor[2] + (AttributeFavor[3] + AttributeFavor[AttributeFavor[4]]))) + 1) and ((AttributeFavor[1] + (AttributeFavor[2] + AttributeFavor[3])) + (AttributeFavor[4] + AttributeFavor[5])))
                                    • Then - Actions
                                      • Set Attribute[5] = (Attribute[5] + 1)
                                    • Else - Actions
                  • Set StatPool = (StatPool - 1)
                  • Set Level = (Level + 1)
            • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top