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"

String array doesnt work within a shared funtion library

Problem: I cant get it to ether store or give me the information inside the string arrays. Is this not possible within a function? Or is it some sort of glitch. But when i call to get information from the string it prints out blank.

What the code does(If needed): I'm having an issue with my item system. I'm trying to make an item system that stores items based off id then ill have a function library that stores any item information that is needed that can be access by giving the correct id.

Extra Information(Probably not needed):

The properties function input has nothing to do with the problem.

I'm using unreal engine 4.7.6 because 4.8.1 and 4.8.0 crashes on start up and corrupted my game already and i had to rebuild

alt text

Product Version: UE 4.7
Tags:
funtion problem.png (223.7 kB)
more ▼

asked Jun 28 '15 at 07:56 PM in Blueprint Scripting

avatar image

GameHog
11 2 4 7

avatar image ScottSpadea Jun 29 '15 at 05:27 AM

have you tested if it works with single strings, instead of string arrays?

using local Variables inside a function, to store long term data, seems strange to me. in c++, local Variable data goes out of scope when the function ends. if you want to mix data and functions, usually you would use an Actor Blueprint. if you just want to store data, maybe you should use a CSV dataTable.

local variables are supposed to be temporary storage that only exists while the function is running.

avatar image GameHog Jun 30 '15 at 12:16 AM

Yah i suppose it would be better to do that. I'm more use to code so it weird getting into visual scripting. so i was experimenting with a way i could organize a large amount of data that any actor in the world can call from. But i still need to remember its translated from visual scripting to c++ code. In my mind i though that it was creating a string like string Item_Names[5] = {"wood", "1", "2". "3", "4" };
But my guess is that the get node is getting confused because a string is really an array and that would be storing a pointer to a array in a string. char Item_Names[5][10]; so if i writes it like this in c++ it might get confused.

avatar image Etemadi Jun 30 '15 at 12:49 AM

Maybe save the strings outside of the function and call them when use the function this way your array can exist.

Next time check the code if you don't know exactly. You can right mouse and go to source code

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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