The Attributes Component provides a centralized location where all attributes are handled. just like the previous components, this component relies on “BP_BaseAttribute” to be the parent for all the attributes your trying to create.
there are a number of useful function you can use from the attributes component. just like the ones provided in the picture here.
attributes and attribute modifiers are 2 different things, modifiers usually are used when you need to modify something overtime. you will not see a huge use case for it in the sample.
————————————————————————————————————————————————————-
BP_BaseAttribute:
Construct Attribute: you would have guessed it by now, this function runs when the attribute gets constructed the first time
Modify Attribute: this function gets called if you want to modify the attribute value.
Tick Attribute: this tick function runs as long as the attribute exist in the component.
————————————————————————————————————————————————————-
Attributes Per Character and NOT per weapon:
By Default, all attributes gets changed/refreshed when a new weapon is equipped. however, some of you want to make it per character instead which is quite easy to add. to accomplish that, open the weapon you are equipping and override the following function: “Update Attributes”
please note: you are already equipping the unarmed weapon on begin play so you need to do that for it as well.
after overriding the function, remove the code that is highlighted in yellow:
after removing it, make sure the function has nothing in it. and that’s it for the weapon. last step is you have to go to the player character and simple construct the attributes you want by using the following function for EVERY attribute you want the player to have:
that’s all.