Issue: Cannot read property 'traits' of undefined

Captura de tela de 2024-09-28 19-59-55.png


So, what's happening... I add a new character and when I try to walk with them, it happens. The funniest part is that it's happening inside a saved game where I'm doing changes on my work as the beta test progress. If I play test it out of this saved game, nothing happens and the game plays normally.

I checked everything I could regarding this character and everything seems to be fine.

Is there any way to fix that? I only have the default plugins installed on my game.
saved games after adding is mostly compitable
so a new game is always required when adding new data in the database
or new plugins.

otherwise if you did that, you need the console log as that tell us more.
A save game file that doesn't have the new data goes haywire when you add new data and try to access it? Who would've thought.
The funniest part is that it's happening inside a saved game where I'm doing changes on my work as the beta test progress. If I play test it out of this saved game, nothing happens and the game plays normally.
That is exactly what's expected to happen. When you change the database or anything to do with plugins, it is expected you will need to start a new game.

Also, when you get an error, you need to press F8 and go to the Console tab to show the full error trace.

I'm surprised you're not familiar with all of this information for how long you've been around 😉
So, for short: if I (or someone else) starts a new game, everything will be fine. Otherwise, the old saved files are lost?

That is exactly what's expected to happen. When you change the database or anything to do with plugins, it is expected you will need to start a new game.

I worked doing changes in maps, events and database while play testing on saved games during all this time without any issues. That's why I found it funny.
So, for short: if I (or someone else) starts a new game, everything will be fine. Otherwise, the old saved files are lost?
I you search the forums you'll definitely find some threads about how to support saves from old versions of a game. But the short version is that it does require some effort and will not happen on its own.
I you search the forums you'll definitely find some threads about how to support saves from old versions of a game. But the short version is that it does require some effort and will not happen on its own.

I'm more worried about if this error will persist for players starting the game anew than supporting old saves, to be honest. The game is not officially released yet and there's only a beta version available to supporters.
Otherwise, the old saved files are lost?
I don't remember my database-fu to the letter... but that could be solved if the save files saved *data pertaining to the objects* rather than the objects themselves (which I believe is what they do)

couldn't that be solved with a try/catch block? add the new property to default if missing?
couldn't that be solved with a try/catch block? add the new property to default if missing?
the problem is that most users don't know how to do that, and that includes a lot of plugin programmers. It went to the point that even those programmers who theoretically knew how to do that don't, because most other plugins never bothered.


So @CleanWater yes, any change in the plugin manager and a lot of additions to the database will require people to start a new game.
That is true even for professional games where the programmers should know what they're doing, or have you never read in update notes comments like "this update function can only be used when starting a new game"?


And here is a short explanation of the error message:

Cannot read property 'traits' of undefined​


The engine tried to read something like "character.traits" and found out that the "character" part is undefined.
That is because characters in your game need to be saved, and the newly added character did not exist in the old savefile that was created before you added the character.
The engine tried to read something like "character.traits" and found out that the "character" part is undefined.
That is because characters in your game need to be saved, and the newly added character did not exist in the old savefile that was created before you added the character.
That's my concern, he was created before the time I started the game, not after.

My worries are for players getting this error after playing a long campaign, even if I don't change anything else in the database.

I didn't found any clue to why this error occurred.
I don't get why there is still confusion.

Actor data is loaded out of the database into code objects when a new game is started. Those objects are saved in the save game. The database is not referenced again for actor data during gameplay.

If you make a new actor, your save game will not contain an object for them, so trying to reference them via events or anything else when loading an existing game will crash with an error.

This was said in the first few posts, just with less technical explanation - what is there to not understand almost a week later?

My worries are for players getting this error after playing a long campaign, even if I don't change anything else in the database.
Zero people have said that is a possibility - why are you worried about it?

I didn't found any clue to why this error occurred.
You were already told why. You added a new actor. How is that not a clue?
You were already told why. You added a new actor. How is that not a clue?
I didn't added the actor in the database, it was already there. I added in the party in game.
Okay...that's not what anyone would mean when they say they "added a new character."

You were also told almost a week ago how to show the error trace if you needed more help troubleshooting, and you never did.

So I dunno what else anyone can say.
Okay...that's not what anyone would mean when they say they "added a new character."

You were also told almost a week ago how to show the error trace if you needed more help troubleshooting, and you never did.

So I dunno what else anyone can say.
I replaced the old save file with a new one and lost it. There's no way to get the error again.

Original thread: https://forums.rpgmakerweb.com/threads/issue-cannot-read-property-traits-of-undefined.172262/