Access data table based off of variables
I'm haveing a bit of trouble wrapping my mind around how to access data from a data table in blueprints based off of variables and I hope that the awesome Unreal community can help me out.
My setup is as follows. Every weapon in the game has a Damage Class (DC) ranging from 1 to 10. Every enemy has different hit areas. When a weapon is fired, the line trace returns which body part is hit and from that result I want to get the actual damage dealt from a data table.
The structure of the table looks as below.
So I have two stored variables, one holding the DC of the weapon and one holding the bodypart hit by the weapon. How to I get the value corresponding to these two values, in blueprint if possible, otherwise in C++?
Example1: The pistol with DC2 hits the neck of the enemy. I want the value of 45 returned from the function. Example2: A rifle with DC3 hits the hand of the enemy. I want the value of 20 returned from the function.
To I have to get the info by row name based on body part and then do a select based on the DC or can I somehow do a direct lookup based on the two variables and get the return value?
Thanks in advance!
asked Jan 12 '17 at 11:45 AM in Blueprint Scripting
You will have to get the row based on the body part and break the result, and select the corresponding DC.
There is no way to do both with just one node, but even then this is a very simple function that only needs to be created once. With only 10 DCs you can just use a switch or something similar to select the right value. The entire thing should take like 2 minutes to create.
answered Jan 12 '17 at 03:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here