Tutorial Diablo style stat system

X-maul

AKA: Demtrod
Reaction score
201
In this tutorial I will teach you how to create a system that will give the player a specified amount of statpoints each level, that the player can use to increase the stats for his hero.
(This system will only work for 1 unit per player)

I asume you have a little bit of expirience with both the data editor and the trigger editor, but I'll try to go forward as slow as possible.

Step 1
To begin with we will need a behavior of the type Veterancy, name it HeroLevel.
(If you already have a veterancy behavior, go to step 2)
When you have created the bahavior, go click the Behavior: Veterancy Levels +, click the green X to add a level. Make the first level be 0 so the hero will start at level 1. Create another one with the minimum expirience at 50. Then just click it and press [Ctrl]+[V], [Ctrl]+[C] and copy as many levels as you want.
mNPum.jpg

Normaly you would want to make the veterancy behavior increase attributes, but in this case, we wont do that.

Step 2
Now we need the attributes, I'll just create 3 attributes for the sake of the tutorial. This is done pretty easily, I'll just make them pretty simple, creating;
  • Stamina
    Increasing Health and health regen.
  • Strength
    Increasing melee and ranged damage
  • Wisdom
    Increases energy and energy regeneration.
Make sure you set the Stats: Max Points to something very high, I'll just set mine to 9999999.
Step 3
Now we need to create a buff that increases the attributes for us.
Make a new behavior of the type Buff, name it Stamina Increaser.
Go to the Behavior: Modification field and go to the Behavior tab, now click the green X under Attribute Changes, and set the new field to Stamina:
L8tYM.jpg

You do not want to make it change point to anything but 0, that will be changed later with triggers, we just want it to be associated with the right attribute.
Now create the same buff behavior for each of your attributes, so in my case, I have Stamina Increaser, Strength Increaser and Wisdom Increaser.
Step 4
Now go to your unit and add all the attribute and the buff behaviors;
DGS3A.jpg

Step 5
Now we are done with the data part of it. So go to the trigger editor and create a new trigger, and name it Stats System Init. (You can also delete the Melee Initialization)
Now we need some Global Variables;
1 Dialog (Stats Dialog)
5 Dialog Item (Increase Stamina, Increase Strength, Increase Wisdom, Toggle Stats, Stat Points Remaining [16])
4 Integer (Stamina [16], Strength [16], Wisdom [16], Stat Points [16])
1 Boolean (Stats Toggled [16])
Txf33.jpg

(I set the init for Stat Points to 5 so we have 5 stat points from the start)
Go to your Stats System Init trigger, and create an action that creates a dialog of the size 250, 270 relative to center, and set the variable Stats Dialog to the last created dialog. Now make an action that hides the last created dialog (This is so that it's not shown in the start of the game).
By now your trigger should look like this:
Code:
Stats System Init
    Events
        Game - Map initialization
    Local Variables
    Conditions
    Actions
        Dialog - Create a Modal dialog of size (250, 270) at (0, 0) relative to Center of screen
        Dialog - Hide (Last created dialog) for (All players)
        Variable - Set Stat Dialog = (Last created dialog)
Now add an action to create a dialog item of the type button, and set the Increase Stamina variable to last create dialog item, do this for each attribute.

Also we want to display the remaining stat points, so create a local variable of type Integer, name it X.
Now create a For each Integer action and make it go from 1 - 12.
Add an action that adds a dialog label to display the remaining stat points, and set the Stat Points Remaining variable to the last created dialog item, and the array to X.

You trigger should look something like this by now;
Code:
Stats System Init
    Events
        Game - Map initialization
    Local Variables
        X = 0 <Integer>
    Conditions
    Actions
        Dialog - Create a Modal dialog of size (250, 270) at (0, 0) relative to Center of screen
        Dialog - Hide (Last created dialog) for (All players)
        Variable - Set Stat Dialog = (Last created dialog)
        Dialog - Create a button for dialog (Last created dialog) with the dimensions (200, 50) anchored to Top with an offset of (0, 100) setting the tooltip to "" with button text "Stamina" and the hover image set to ""
        Variable - Set Increase Stamina = (Last created dialog item)
        Dialog - Create a button for dialog (Last created dialog) with the dimensions (200, 50) anchored to Top with an offset of (0, 150) setting the tooltip to "" with button text "Strength" and the hover image set to ""
        Variable - Set Increase Strength = (Last created dialog item)
        Dialog - Create a button for dialog (Last created dialog) with the dimensions (200, 50) anchored to Top with an offset of (0, 200) setting the tooltip to "" with button text "Strength" and the hover image set to ""
        Variable - Set Increase Wisdom = (Last created dialog item)
        General - For each integer X from 1 to 12 with increment 1, do (Actions)
            Actions
                Dialog - Create a label for dialog (Last created dialog) with the dimensions (200, 50) anchored to Top Left with an offset of (50, 50) with the text ("Stat Points Remaining: " + (Text(Stat Points[X]))) color set to White text writeout set to False with a writeout duration of 2.0
                Dialog - Hide (Last created dialog item) for (All players)
                Dialog - Show (Last created dialog item) for (Player group(X))
                Variable - Set Stat Points Remaining[X] = (Last created dialog item)
Step 6
Now we need to make the buttons actually do something.
Create a new trigger and name it Stat Dialog Buttons.
Make your new trigger have the event;
Code:
        Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
Now create a new action of the type Switch, and make it depend on Used Dialog Item.
Add a new case with the if set to Stamina Increaser, now create an If Then Else action and set the condition to Stat Points == 0. Now in in the Then field add an action that sets the Stamina variable to Stamina + 1.
Now add an action of the type Catalog Field Value Set. Set the Catalog to Behavior, the Entry to Stamina Increaser and the Field Path to;
7y7gU.jpg

Set the string in the end to Convert Integer to String, and set the integer to your Stamina variable.
Now create an action that decreases the Stat Points with 1.
Set all the array fields to Triggering Player.
Create an action that sets the text for the Stat Points Remaining to the updated value.

Do this for the 3 attribute buttons, your trigger should look something like this;
Code:
Stat Dialog Buttons
    Events
        Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
    Local Variables
    Conditions
    Actions
        General - Switch (Actions) depending on (Used dialog item)
            Cases
                General - If (Increase Stamina)
                    Actions
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Stat Points[(Triggering player)] == 0
                            Then
                            Else
                                Variable - Set Stamina[(Triggering player)] = (Stamina[(Triggering player)] + 1)
                                Catalog - Set value of Behaviors StaminaIncreaser Modification.AttributeChangeArray[0].Points for player (Triggering player) to (String(Stamina[(Triggering player)]))
                                Variable - Set Stat Points[(Triggering player)] = (Stat Points[(Triggering player)] - 1)
                                Dialog - Set Stat Points Remaining[(Triggering player)] text to ("Stat Points Remaining: " + (Text(Stat Points[(Triggering player)]))) for (All players)
                General - If (Increase Strength)
                    Actions
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Stat Points[(Triggering player)] == 0
                            Then
                            Else
                                Variable - Set Strength[(Triggering player)] = (Strength[(Triggering player)] + 1)
                                Catalog - Set value of Behaviors StrengthIncreaser Modification.AttributeChangeArray[0].Points for player (Triggering player) to (String(Strength[(Triggering player)]))
                                Variable - Set Stat Points[(Triggering player)] = (Stat Points[(Triggering player)] - 1)
                                Dialog - Set Stat Points Remaining[(Triggering player)] text to ("Stat Points Remaining: " + (Text(Stat Points[(Triggering player)]))) for (All players)
                General - If (Increase Wisdom)
                    Actions
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Stat Points[(Triggering player)] == 0
                            Then
                            Else
                                Variable - Set Wisdom[(Triggering player)] = (Wisdom[(Triggering player)] + 1)
                                Catalog - Set value of Behaviors WisdomIncreaser Modification.AttributeChangeArray[0].Points for player (Triggering player) to (String(Wisdom[(Triggering player)]))
                                Variable - Set Stat Points[(Triggering player)] = (Stat Points[(Triggering player)] - 1)
                                Dialog - Set Stat Points Remaining[(Triggering player)] text to ("Stat Points Remaining: " + (Text(Stat Points[(Triggering player)]))) for (All players)
            Default
Step 7

Now we only need to create a button that toggles the Dialog;
Create a new dialog with a button, and set the variables;
Code:
Stat Toggle Init
    Events
        Game - Map initialization
    Local Variables
    Conditions
    Actions
        Dialog - Create a Modal dialog of size (200, 200) at (0, 0) relative to Left of screen
        Dialog - Show (Last created dialog) for (All players)
        Variable - Set Toggle Dialog = (Last created dialog)
        Dialog - Create a button for dialog (Last created dialog) with the dimensions (180, 180) anchored to Center with an offset of (0, 0) setting the tooltip to "" with button text "Stats" and the hover image set to ""
        Variable - Set Toggle Stats = (Last created dialog item)
Step 8
Now we need to make the toggle button do something, so make a trigger that reacts to dialog item is used, and make the condition check if it's the Toggle Stats dialog item

Now make a If then else actions that checks if the Stats Toggled is true or false, and make the one that is true hide the dialog, and set the Stats Toggled variable to False. Now copy the If then else and move it into the then field and change the true to false, and false to true. It should look like this:
Code:
Stat Toggle Button
    Events
        Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
    Local Variables
    Conditions
        (Used dialog item) == Toggle Stats
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Stats Toggled[(Triggering player)] == True
            Then
                Dialog - Hide Stat Dialog for (Player group((Triggering player)))
                Variable - Set Stats Toggled[(Triggering player)] = False
            Else
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        Stats Toggled[(Triggering player)] == False
                    Then
                        Dialog - Show Stat Dialog for (Player group((Triggering player)))
                        Variable - Set Stats Toggled[(Triggering player)] = True
                    Else
Step 9

Last but not least, we need to make the stat points remaining increase when leveling.
Just increase the Stat Points variable, and update the dialog text:
Code:
Level Up
    Events
        Unit - Any Unit gains an experience level
    Local Variables
    Conditions
    Actions
        Variable - Set Stat Points[(Owner of (Triggering unit))] = (Stat Points[(Owner of (Triggering unit))] + 5)
        Dialog - Set Stat Points Remaining[(Triggering player)] text to ("Stat Points Remaining: " + (Text(Stat Points[(Triggering player)]))) for (All players)
_____________________________________________________________________

Hopefully you were able to make sense of my tutorial, please give me some feedback, as this is my first tutorial.
 

Attachments

  • Diablo Stat System.SC2Map
    23.7 KB · Views: 637
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top