Index variable simple integer. It assign value in NPC talk dialog. On default game map it assigned and printed. After Character move to other level(location) it become empty. It assigned as global in Game Instance. And after new level load, become empty and impossible assign new value. It strange.
It’s a little bit hard to get the issue from the blueprints that you showed, but generally I don’t see any reason why you would set a variable in GameInstace to be “InstanceEditable” or “Exposed on Spawn”. There is only 1 instance of GameInstance and it’s never spawned by your logic.
If you set everything correctly, try without those flags, maybe they break something in case of the GameInstance.
All other variables also taken through Game Instance, and flagged as global… Possible need to spawn my NPC class in new location, because this example not from Character blueprint, this piece of NPC blueprint. But I think it must be no problem, if I get variable from Game Instance itself…
So sawn NPC class in level blueprint do nothing. Really all working fine with no need spawn Game Instance class… just this variable can’t be operated…
There is no such thing in UE as global variables; but the GI is persistent, indeed. The Instance Editable
and Expose on Spawn
flags don’t do anything here. There’s also a questionable bit in the script you posted:
This does not do anything, for example. Perhaps try to retrace the logic of what is supposed to happen. Perhaps it’s an order of operations?
- could you show us how you assign a new
Save Game Index
int value? We can’t see it in the screenshots. - is the save game important here? What are the chances we load it in the new level and accidentally assign the GI some stale data?
And after new level load, become empty and impossible assign new value.
Why would it be impossible to assign a new value after level load?
Idea was save quests in array on Game Saves. So any new quest need new index. When Character interact with NPC, quest added and save to disc. On default level all work fine. And print 0 index. Other NPC in other game location. Character go, talk to NPC, there must assign quest and add it to active quest array. After this need to remove index previous quest, so it never appear as active. This for AddQuest function. There is another function for complete quests, but it other story, idea similar. Quests added AND removed when in default game location. I can’t transfer quest system between levels.
I try anything, that is why appear those useless nodes . Without them nothing changes. I just need this index for add elements to array.
Thank friend. May be it will best idea assign every quest own index in table. and just get indexes from table.
Let’s say we start with index 0. The we add 1:
The index is 1. You then load a new level, right? So what happens when you fetch that value from the GI? You should get 1. if you get 0, it means something else modified it.
Sounds like it could work. The GI/SG keeps track of the index. If we ever want to check which quest we’re doing, we get it by index from the DT.
It ok. But it print nothing, so value variable is NONE. It strange. it very simple example, not any other blueprint change value. Savequest function not change value, in Game Instance default value 0.
Very strange story
Where is the print?
I trying print in different points. Result same: none . Ahah. Heavy puzzle.
I disagree. Could you please show how and when we Print that index? We are still talking about the index, right? Even if the value was not set, it would still print something. If it does not Print, it means the script is not running…
If I assign GI an index (default is 0) value in lvl1
:
I can read it in lvl2
:
Probably unrelated.
Why are you saving your quests as a class? Class does not pass any information.
Hmmm. I have some copied by Youtube videos quest system. So quest blueprints have parent class MasterQuest, but they have different names, right? Function AddNewQuest get blueprint class, as input. So it work fine. That is why I use class. Untill I talk next NPC all work fine
I found solution. All this piece of code I paste in child blueprint of MasterNPC(currently QueenNPC). So index appear, it printed. But function QuestSave not add new element to saving array. Seems need bring this operation to QueenNPC blueprint. I thought it enough place code just in parent class. Look like it not work accurate.
Thank a lot for assistance!
Thank a lot. I never know. It need to mark for future
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.