Third-person RPG. UE4.26. Actor for a sword. I have a variable called size. It is 3. I want to create a variable called weight. I want the weight to be 1/2 of whatever the size is. I have another variable called weapon hardness, Weapon hardness + size will decide the damage it does. I do not really want to use data tables. I want to do each weapon individually. How do I tell the weapon to calculate its weight by using the size value and have it show up in the weapon BP? This is what I will use to calculate damage as well. I wanted to do each individually for crafting purposes later. I have the equations already figured out in a spreadsheet. In the spreadsheet, all I do is put in the size and weapon hardness and it calculates the weight, damage, difficulty to craft, value, and AP to use it. How do I put those equations into an actor BP for a weapon and have them automatically calculate everything else as it does in my spreadsheet? I can do the actual equations in BP, but how do I set it up so the equations connect to the other variables and gives me an output? If I can get this done, I can leave this BP as a master copy and just replicate it and fill in the Size and hardness to automatically calculate everything else for each weapon.
I suggest you to read this first.
How do I use one variable (size 3) I created in an actor (a sword) to automatically change another variable (weight, 1/2 the size) in the same actor?
What you want to achieve ?
I would like to have a generic BP that I can replicate to create a new weapon at any time without having to fill out multiple data tables and lists. I would like the BP to show the weight automatically when I input the size by using an equation I already have.
Derive BP from UObject. (Weapon). Put desired variables inside of it(Weight, rarity, mesh).
And create an Actor for your weapon, which creates your weapon object from (Weapon). Is it help ?
I already have an actor created for my weapon, with a mesh, with the variable of size in it. How do I use the size variable to generate a number (its weight) for it?
I have cast to weapon, object is weapon, get size, print text float, to a return, to try to get it to show the number on a HUD screen, but it will not show the size from the BP on the text block on the HUD.
From HUD you can cast to your player, and Iām assuming that your weapon equipped or in your inventory, IDK your design. Put some getter functions to access them (made them public), there you go.