x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Access data table based off of variables

Hi guys.

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.

 ,DC1,DC2,DC3
 Head,20,40,90
 Neck,25,45,100
 Hand,5,10,20
 Foot,7,20,40

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!

Product Version: UE 4.14
Tags:
more ▼

asked Jan 12 '17 at 11:45 AM in Blueprint Scripting

avatar image

AzoghMartins
38 3 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/GetDataTableRow/index.html

more ▼

answered Jan 12 '17 at 03:18 PM

avatar image

JeromeParent
1.2k 63 33 96

avatar image AzoghMartins Jan 12 '17 at 03:47 PM

So, basically, I get the row by bodypart and connect the ten different outputs to a switch based of on an int and feed the weapons DC into the controller for the switch? Thanks, that should do nicely.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question