Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: eborr on March 12, 2016, 08:17:20 PM

Title: Custom attributes
Post by: eborr on March 12, 2016, 08:17:20 PM
I have added a number of custom attributes to Scene Nodes. The value of these nodes is changed programatically during play. This works. However if I change scene and return then the original values are reset.

The remember nodes checkbox is true, and I have added a line of code to set the PersistentState of the scene to true right before the changescene statement.

Any ideas ?
Title: Re: Custom attributes
Post by: valter.home on March 13, 2016, 02:18:50 PM
Hello eborr,
I too had the same problem and I thought that it was a non-modifiable behavior set programmatically.
In my case it was a region where the character was walking with a particular sound of footsteps.
Later it rains and the sound of footsteps changes.
Changing scene and coming back in it the sound of footsteps was reset.
I solved by creating a global variable as myScene.wet and I initialize it to true when I change the sound.
Then back in the scene I check in scene_init.script if the variable is true and in this case I change the sound again.
Having to check only one region this system to me is fine, I don't know if you have to manage many more nodes / regions.
Title: Re: Custom attributes
Post by: eborr on March 14, 2016, 02:00:38 PM
Yes creating globals is the obvious solution, but the issue with that is the process I want to achieve will involve something which will occur on most scenes and with a variable number of nodes. I dont want to handcraft the process for each scene, nor is it a desirable situatuion to creare and manage what will eventually turn out to be a large number of globals. I think I have worked through a logical solution to the problem, which in theory should work in WME. It will involve the creation of a single complex global object