Character save at save point
Re: Character save at save point
Let's focus on getting one Persistent Active Data working. Then the same solution will probably apply to the others.
Please post a screenshot of the inspector view for this Persistent Active Data component. Expand any parts of the Condition section that you're using (e.g., Lua conditions, Accepted Tags, etc.).
Then play the game in the Unity editor and load a saved game. In the Console window, click on the line that reports the loaded saved game info. It'll say something like "Loading saved game. Save game data: .....". Press Ctrl+C to copy it to the clipboard, then paste it into an email to tony (at) pixelcrushers.com or PM it to me.
Please post a screenshot of the inspector view for this Persistent Active Data component. Expand any parts of the Condition section that you're using (e.g., Lua conditions, Accepted Tags, etc.).
Then play the game in the Unity editor and load a saved game. In the Console window, click on the line that reports the loaded saved game info. It'll say something like "Loading saved game. Save game data: .....". Press Ctrl+C to copy it to the clipboard, then paste it into an email to tony (at) pixelcrushers.com or PM it to me.
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Character save at save point
I have my variables set up like this:
Variable[Trigger___Activate_plant_group_one_area] ~= true
I also noticed that when I removed the quotes some of the triggers didn't setactive the object. There was an error with the variable. So I put the quotations back and it worked again... It still loaded everything on load.
I deleted the " " in the lua command area and still loads a bunch of stuff that shouldn't show. So now as an example it looks like this:Variable[Trigger___Activate_plant_group_one_area] ~= true
I also noticed that when I removed the quotes some of the triggers didn't setactive the object. There was an error with the variable. So I put the quotations back and it worked again... It still loaded everything on load.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Character save at save point
I put the persistence active date component on a separate collider and it didn't work. Anyway, so far the only thing that saves and loads perfectly are the quests the player is on. Let me give an example of a situation with that I just saw.
Let's say I have to collect 10 scrolls. I accept the quest and walk up to the first scroll. If I collect that scroll I now have 1/10 collect. The scroll is destroy on use, so it goes away. I save the game and load it, here's what happens: I am still on the quest and still have 1/10 collected which is great. The probably is that on load the scroll I just collected now is there again. The player could potentially just collect the second one, save/load and keep doing that until 10/10 are collected. Is there something in the code that needs to be fixed possibly? This is the same situation with my areas saving and loading. All the areas active on load which also happens with the scrolls. Although, not all the quest items throughout the game load, so that works. It's just if I'm on the quest this happens. I assume these things are probably connected with the persistent active data component?
Let's say I have to collect 10 scrolls. I accept the quest and walk up to the first scroll. If I collect that scroll I now have 1/10 collect. The scroll is destroy on use, so it goes away. I save the game and load it, here's what happens: I am still on the quest and still have 1/10 collected which is great. The probably is that on load the scroll I just collected now is there again. The player could potentially just collect the second one, save/load and keep doing that until 10/10 are collected. Is there something in the code that needs to be fixed possibly? This is the same situation with my areas saving and loading. All the areas active on load which also happens with the scrolls. Although, not all the quest items throughout the game load, so that works. It's just if I'm on the quest this happens. I assume these things are probably connected with the persistent active data component?
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Character save at save point
Here's an example:
ScrollQuestExample_2016-10-31.unitypackage
In this example, there are three interactable objects:
The dialogue database has these variables:
ScrollQuestExample_2016-10-31.unitypackage
In this example, there are three interactable objects:
- QuestStartTrigger: When the player enters this trigger, it starts the quest to pick up 2 scrolls. (A blue platform)
- Scroll01: A scroll that can be picked up. (A red box)
- Scroll02: Another scroll that can be picked up. (Another red box)
The dialogue database has these variables:
- numScrollsCollected (Number) = 0
- Scroll01Collected (Boolean) = False
- Scroll02Collected (Boolean) = False
- QuestStartTrigger:
- Dialogue System Trigger: Sets the quest active; Runs the sequence "SetActive(QuestScrolls,true); SetActive(QuestStartTrigger,false)"
- Scroll01:
- Destroy On Trigger Enter (simple script that destroys the GameObject when the player touches it)
- Persistent Destructible: Sets Scroll01Collected to true when destroyed.
- Increment On Destroy: Increments numScrollsCollected.
- Scroll02: set up similarly to Scroll01.
- Persistent Active Data: Target=QuestStartTrigger, Condition=Only if quest is unassigned.
- Persistent Active Data: Target=QuestScrolls, Condition=Only if quest is active.
- Persistent Active Data: Target=Scroll01, Condition=Variable["Scroll01Collected"] ~= true
- Persistent Active Data: Target=Scroll02, Condition=Variable["Scroll02Collected"] ~= true
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Character save at save point
Awesome, so I started testing this on a quest and it looks like it works perfect! I think the biggest difference is that I placed all persistent active data items into one empty object. The demo scene really helped A LOT! THANKS!!!
Anyway, I assume this will also work if I do this for my SetActive items in the scene?
Also, I was going to place every persistent active data component for everything in my game inside one empty game object, but I guess that wouldn't work since there is a quest condition. Is that correct? I assume that's it, but I think I'll ask you before I go and make hundreds of changes to make sure.
Anyway, I assume this will also work if I do this for my SetActive items in the scene?
Also, I was going to place every persistent active data component for everything in my game inside one empty game object, but I guess that wouldn't work since there is a quest condition. Is that correct? I assume that's it, but I think I'll ask you before I go and make hundreds of changes to make sure.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Character save at save point
Each Persistent Active Data component has its own condition. So long as your SetActive items set something that can be tested in a condition, it should work. Test with one or two SetActive items first to double-check your process.
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Character save at save point
I feel like I'm missing a key step, but I can't quite place my finger on it for saving my SetActive objects.
1) Here's my first object with persistent active data component. Here's what I have:
a) Target
b) Lua Condition: Variable
c) I also created a variable
i) PLANTS ALL HERE and cliffs text
ii) False boolean
d) Quest condition (I made this quest (RuctionGames) and set it to active during the whole game with the idea since it's always active everything I use it with will always be saving. I assume that works.
i) RuctionGames active
2) This is my trigger that activates the "PLANTS ALL HERE and cliffs" area when I run through it.
a) It's probably easier if you just look at it.
i) I think something it wrong with this here because if I delete the variable in the lua condition the trigger works, but if I leave it, the trigger only works once in game as far as I can tell and is basically broken.
1) Here's my first object with persistent active data component. Here's what I have:
a) Target
b) Lua Condition: Variable
c) I also created a variable
i) PLANTS ALL HERE and cliffs text
ii) False boolean
d) Quest condition (I made this quest (RuctionGames) and set it to active during the whole game with the idea since it's always active everything I use it with will always be saving. I assume that works.
i) RuctionGames active
2) This is my trigger that activates the "PLANTS ALL HERE and cliffs" area when I run through it.
a) It's probably easier if you just look at it.
i) I think something it wrong with this here because if I delete the variable in the lua condition the trigger works, but if I leave it, the trigger only works once in game as far as I can tell and is basically broken.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Character save at save point
This is my understanding of your goal, in plain English:
- There is an inactive GameObject named "PLANTS ALL HERE and cliffs".
- When the player enters a certain trigger collider, activate "PLANTS ALL HERE and cliffs".
- In saved games, remember whether "PLANTS ALL HERE and cliffs" is active or inactive.
- In your dialogue database, define a Boolean variable named "Trigger setactive scene 2 start area cave". Leave its Initial Value false.
- On your trigger collider, add a Sequence Trigger with:
- Sequence:
Code: Select all
SetActive(PLANTS ALL HERE and cliffs); SetVariable(Trigger setactive scene 2 start area cave, true)
- Condition > Lua Conditions:
Code: Select all
Variable["Trigger_setactive_scene2_start_area_cave"] ~= true
- On your PersistentActiveDataAll GameObject, add a Persistent Active Data component with:
- Target: PLANTS ALL HERE and cliffs
- Condition > Lua Conditions:
Code: Select all
Variable["Trigger_setactive_scene2_start_area_cave"] == true
- Sequence:
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Character save at save point
So far it doesn't work yet.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Character save at save point
Hi Scott,
How can I help? Would it help to provide a new example scene that you could base your configuration on?
How can I help? Would it help to provide a new example scene that you could base your configuration on?