Page 7 of 10
Re: Character save at save point
Posted: Fri Jul 08, 2016 9:52 pm
by Tony Li
No to both. You can just type it into the Lua condition.
Here are the pro's and con's:
Creating a variable in the database:
1. You can use the Lua wizard to select the variable without having to type anything.
2. You can put text in the Description field to remind yourself what the variable is for.
Not creating a variable in the database:
1. You don't have to go to the effort of adding all those variables.
Re: Character save at save point
Posted: Fri Jul 08, 2016 11:09 pm
by supadupa64
Should Element 0 be set to true on the sequence trigger because the trigger is already active in the scene? At the moment I have it all set up, but the trigger isn't triggering anything because of the lua condition on the sequence trigger. I take it out and the trigger works.
edit: ok so I changed it to true and the trigger works great. I'm testing the save function as we speak!
edit: actually it doesn't work, lol? It works, then it doesn't... hmm
Re: Character save at save point
Posted: Sat Jul 09, 2016 10:36 am
by Tony Li
Doh! Sorry! I had a brain lapse. I just corrected my previous posts.
When a variable isn't defined in your database, its initial value is
nil, not
false. So instead of this:
No:
Use this:
Yes:
This means "not true". So if the variable is false or nil, it still qualifies as "not true" and everything should work correctly.
Re: Character save at save point
Posted: Sun Oct 16, 2016 10:53 pm
by supadupa64
I don't know if this has been happening the whole time or not, but I just noticed that when I load a game, all my inactive object groups load instead of just the ones that were currently active when the save occurred. As far as I know everything in the persistent active data component is correct, but maybe apparently not...
You think maybe that these trigger colliders are colliding on load with other objects?
Re: Character save at save point
Posted: Sun Oct 16, 2016 11:39 pm
by Tony Li
supadupa64 wrote:I don't know if this has been happening the whole time or not, but I just noticed that when I load a game, all my inactive object groups load instead of just the ones that were currently active when the save occurred. As far as I know everything in the persistent active data component is correct, but maybe apparently not...
You think maybe that these trigger colliders are colliding on load with other objects?
It's possible. Are the conditions on the Persistent Active Data components based on values set by other
OnTriggerEnter components? It's possible that those
OnTriggerEnter components are firing as soon as the scene starts, and then the Persistent Active Data picks up on that.
To test this, inspect one of those
OnTriggerEnter components and expand the Condition > Accepted Tags section. (The inspector fix for the flukey Lua Condition section is coming soon.) If only the player is allowed to fire the trigger, make sure Accepted Tags > Size is 1, and that Element 0 is "Player" (without quotes). Then try loading a game and see if that trigger still fires.
Then again, it might be a logic issue in the Persistent Active Data's Condition. To test this in the editor, after loading a game open the Dialogue Editor window and click on the Watches tab. Select Menu > Add Variable if the condition references a variable. Then select the variable from the dropdown and click Update. (Or tick Auto-Update if you want to automatically update the watch.)
If the condition is more complex, such as a quest state, select Menu > Add Watch. For a quest state, you'll have to enter a Lua expression such as:
Code: Select all
CurrentQuestState("Assassinate the Emperor")
If you want to check in a build, where the Dialogue Editor window isn't available, add a Lua Console to your Dialogue Manager. During play, press ~+L to open the Lua Console. You can enter Lua expressions like:
Code: Select all
return CurrentQuestState("Assassinate the Emperor")
or
Re: Character save at save point
Posted: Thu Oct 20, 2016 11:14 pm
by supadupa64
I put Player in the tag area of a lot of trigger just to make sure and it still loaded areas. I don't recall it doing this before, but maybe I missed it? hmm, I did update to the newest version of Unity, so maybe that has something to do with it.
Although, I did recently place variables in all the triggers and didn't have them.
Basically all the triggers follow this setup.
Re: Character save at save point
Posted: Fri Oct 21, 2016 3:03 am
by supadupa64
I did just find out though that my save/load works about 20 builds ago, so I guess I broke it some how. Maybe you can think of something in the mean time while I try to pick this a part...
Re: Character save at save point
Posted: Fri Oct 21, 2016 8:58 am
by Tony Li
For the variables, if you can get the Lua condition wizard to work, that's the best way to do it. The catch is that, in Lua, the Variable[] table substitutes underscores ( _ ) for blank space characters and some other special characters such as hyphens ( - ). So if you've defined a variable with this name in your dialogue database:
- Scene 4 Transition Trigger - active
Then your Lua condition should look like this:
Code: Select all
Variable["Scene_4_Transition_Trigger___active"] ~= true
The Lua wizards do this substitution automatically for you when you choose a variable name from the dropdown. Otherwise, if you're typing in Lua conditions manually, you'll need to manually do the substitution.
Re: Character save at save point
Posted: Fri Oct 21, 2016 10:37 pm
by supadupa64
Alright I'll give this a go. Thanks!!!
Re: Character save at save point
Posted: Sat Oct 22, 2016 2:53 pm
by supadupa64
So the build I was using before wasn't actually saving the changes which is why I thought it was working correctly, but it actually wasn't.
Anyway, I made those changes and added variables and used the Lua just fine, except it still doesn't work. I tagged it with Player also to try and eliminate the possibility of it being triggered by something else. Although I only have the Accepted tag set to "Player" on the Sequence Trigger script and not on the Persistent Active Data script. Maybe that matters?
Every saved game loads the scene areas, but it doesn't load everything in the game on load. I have quest items that don't load and SetActive(item, active) when they are supposed to during a quest.
Maybe just take out ("-") special characters all together just in case?
I have variables set as text and Initial Value blank for these.