Tag: Blog5-1

  • Unit 8:Devlog 5- Upgrades

    Work on the seletion and upgrade system.

    Firstly I created the selection system using my flow chart plan on the main unit 8 page.

    Click to Open in Fullscreen

    I created this in my player blueprint so that It wouldnt be run by the indivual towers and cause problems, however I still needed the actor references of the clicked/ hovered units so I created this in the unit parent.

    The main code uses some of these functions to animate the range:

    And also this simple function if you noticed a odd looking node in the main code, which gets the needed component references from the actor reference provided to it:

    Here is a preview of the selection system functioning and integrated with the Upgrade UI I will make later in this blog.

    Now I need to create this upgrade and stats UI…..

    UI modules created, Ui set to show and update correctly, stats reworked, starting stats being transferred to ui.

    Success in stats to ui, success in upgrades to ui

    Kill count and upgrade button colouring when affordable success

    Stats displaying properly, unit is upgradeable and closes other path


    I firstly created these widget modules that I could put into other widgets like the button to the left.

    Then put them all together in the main panel and created a sliding animation for it to appear on screen.

    I then created a system to detect what the Unit clicked type was (hero or not) and display the corrcet modules in the main panel correctly.

    To do this I had to re-work how I configured my unit stats into a table so it could be easily read.

    I only created 3 characters at this point of writing so my table is small. But as you can see it stores the data for each level of the unit when a stat is valid.


    I created headers for a ridiculous amount of stats, almost all I could ever need when im creating new characters in the future, though I didn’t properly intergrate stats that were obviously not going to be used yet. I Left a note on functions I would need to update when adding new characters.

    I added this chunk of code into my parent unit to get its stats from the table instead of me manually inputing the variables. This also allowed for the Unit upgrading code to be a simple addition to the level then re-running the stat gathering code.

    This set the correct widgets to display when needed, and also hides the other path when upgrading a non hero unit. However In future I want to ‘grey-out’ the other path instead of collapsing it but I havent messed with how to do that yet.

    Then how I got the UI to display the current stats and also the upgrades is a midly long chain of events.

    First where I left a note in the very first image in this blog I put the this function below and above to get the stats then show the panel.

    These stats are then set to variables or text in the upgrade panel UI

    Further along it then runs what I have called a “upgrade calculator”.

    Click to open in fullscreen

    This basically runs a loop based of whether it needs the hero module, or the 2 normal unit modules. Then in this loop it gets the stats from the table and uses another function to calculate if there is a change between a stat in the current level and the next level.

    This function is one that will need updating and formating based on each new upgrade I add.

    It also runs more functions which format the arrays of floats into indivuald strings that then get turned into displayable arrays to send the upgrade widget modules.

    Additionally I need to add more formatting like seconds or meters to the range but that Isnt difficult to do so Im just putting it off for now. I actually did format the stat widget module currectly so I do know its not to hard to do.

    These then send these stats to the individual upgrade modules which is why there is so many lines at the end of that full screen image.

    The upgrade modules then run this to get the values indivual lines of text instead of an array of strings

    The split string functions being ran are

    Which pretty simply just split the strings onto individual rows then set the text box.

    The update Upgrade button function send the stats to the upgrade button of that module and runs this:

    Which just formats the values to to text and shows the Essence price if it isn’t 0.

    To format the button colour to be red when you cannot afford the upgrade and green when you can I created this.

    This may be incredibly messy since I don’t properly understand all of the slate brush nodes but this works so I don’t really mind.

    Then also so the button actually functions and whether it can be upgraded based of the colour, when its clicked it runs this.

    The function names that it runs is pretty self explanatory but I might aswell show the ones that arent already shown in this blog already.

    When the enemy is killed it runs this function which updates the UI if the unit that killed the enemy is actively displayed otherwise it just adds to the indiviudal kill count variable of each unit.

    I Still need to create the targeting button and sell button but that might have be in next weeks blog since I am going away for a week starting tomorrow.

    Here is a preview of how everything currently functions

    Another thing to fix in a later week is capping the ugprades at there max since currently it will upgrade past its cap and reset all the stats to 0 then allow you to spam the upgrade button for free. If i added a upper cap then this would stop.