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"

Custom item or class database

Hi all,

I'm looking to create a database that contains all the data I need for constructing certain gameplay elements at runtime. Preferably editable via a blueprint, for easy access and changes.


Example:

I have a Weapons and when the weapon is equipped I can query my item database and access the properties of the weapon.

  1. Name

  2. Type

  3. Damage

  4. UStaticMesh (mesh)

  5. ParticleSystem (Special FXs)

  6. etc.


Attempted:

I tried to create a Database class that held a TArray of my ItemData class. Then creating a Blueprint of the class.

The theory being, that I could have an array of my data class, then populate the array with all the data and references, such as, meshes and particles systems as needed. However, it seems you cannot have a TArray of classes.

So then I tried creating a Struct for my ItemData and using a TArray of those, but that also seems you cannot populate a struct with a TSubobjectPtr. If you do it crashes the editor.


Question:

So my questions is how would I go about setting up some kind of database as described? Or is there something I am missing?

Product Version: Not Selected
Tags:
more ▼

asked Jun 25 '14 at 05:00 AM in C++ Programming

avatar image

Mercurial Forge
99 13 17 18

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

3 answers: sort voted first

I did some more digging around and found FStringAssetReference and TAssetPtr to be the answer to my issues.

Here is the documentation: https://docs.unrealengine.com/latest/INT/Programming/Assets/AsyncLoading/index.html

and here is a great tutorial someone did on the forums: https://forums.unrealengine.com/showthread.php?5309-TUTORIAL-C-Runtime-Async-Load-Modular-Character-(Intermediate)

more ▼

answered Jun 26 '14 at 01:10 AM

avatar image

Mercurial Forge
99 13 17 18

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

What are you trying to use TSubobjectPtr for in the structure? TSubobjectPtrs are meant to point at actor sub-object, as name says as well. It should not be used anywhere outside of the actor.

Just hold asset references in your structure.

more ▼

answered Jun 25 '14 at 09:43 PM

avatar image

BiggestSmile
1.6k 54 38 105

avatar image Mercurial Forge Jun 26 '14 at 12:20 AM

What would i use to hold the reference and still be able to choose it nicely from the content browser? I'm attempting to make a very user friendly interface so anyone can add items and spells etc. I used TSubobjectPtr as an example because I like how it displays in the details panel. I like how you can select items that the class will spawn such as when you use it in conjunction with UParticleSystemComponent to select what particle system will be used with the actor.

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

Have you tried SQLite? I've gotten it to integrate pretty well with unreal.

more ▼

answered Jun 25 '14 at 09:58 PM

avatar image

Shoiko
638 57 55 68

avatar image Mercurial Forge Jun 26 '14 at 12:20 AM

I have looked into it, but my plan it to create something use friendly within the editor for other team members to work with.

(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