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"

How to save location of player

Hello! I'm doing saves to my game. But i have a problem. I'm saving location, but when I want to load it game starts, but nothing happens. Game isn't teleporting me to the saved loaction. Below are screenshots of blueprints. alt text

alt text

alt text

Product Version: UE 4.15
Tags:
save.png (123.3 kB)
load1.png (99.0 kB)
load2.png (82.6 kB)
more ▼

asked Mar 31 '17 at 07:46 PM in Blueprint Scripting

avatar image

Qbsoon
1 3 5 8

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

1 answer: sort voted first

You don't set the Save Game Instance variable which you use later in your BP. You must store the return value from the Load Game from Slot node and there is no need to create a Save Game when loading as it will be created from the load function.

You also should get errors when executing that code, it is always wise to see what the messages say to find errors in your code.

more ▼

answered Mar 31 '17 at 08:04 PM

avatar image

SteffM
427 12 4 22

avatar image Qbsoon Mar 31 '17 at 08:33 PM

I set it, it is on variable list. And I don't have any errors. From "create save game object" I created node to "cast to save game 1", and I promoted "As save game 1" to variable. Next, when I already had that variable, I deleted "cast to..." and set "Save Game Instance" nodes. That variable is casting to save game 1. And I think i t is casting even if I delete that nodes. Correct me if I'm wrong.

avatar image SteffM Apr 01 '17 at 11:52 AM

To debug if everything is right, you could print the transform to the screen to see if it was saved and loaded succesfully.

And yes, you must cast the Save Game to your Save Game Class but not from the "Create Save Game" node but from the "Load Save game from Slot" when loading, you create the Save Game when you save your game, not on loading.

avatar image Qbsoon Apr 01 '17 at 09:21 PM

I tried to print transform after loading, but nothing happened

avatar image SteffM Apr 02 '17 at 10:40 AM

Have you made sure the load event does fire? Because even if the transform was not loaded correctly, it should be at zero.

avatar image Qbsoon Apr 02 '17 at 03:14 PM

How to make sure? I tried to cast from "Load Save Game From Slot", but when I clicked on Load Game in menu, nothing happens, no loading screen.

avatar image SteffM Apr 02 '17 at 03:36 PM

When you want to make sure an event fires, just put a Print node at the start at the event, if the string is printed to the screen you see that it has fired.

This is how a load function can look like: alt text

Another prolem in your code is, that you get the slot name and user index from the save game. You load the save by that name, so you cant load it first and than get the name. Try it with a default name to see if thats the problem.

load.png (103.8 kB)
avatar image Qbsoon Apr 04 '17 at 02:36 PM

Now it prints transform but it's deafault transorm.alt text

avatar image SteffM Apr 04 '17 at 05:41 PM

Have you made sure you saved the correct location? And that you use the same name and index for loading and saving?

Maybe you could post how your blueprints look now.

(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