I'm new to VS and even "newer" to Lua (I have some fair C/C++ experience - though a bit dusty).
At this point I'm trying to get a grasp of what can be done
, and what can't be done
Dynamic Objects in VS via Lua
I was wondering if it's possibly to create scene-object instances on demand,with a dynamically assigned "object area", their own actions, and the ability to put them into the inventory.
A practical example
A proof-of-concept I'm trying to create is:
a Library scene that has bookcases with shelves full of books. These books should be dynamically instantiated with
- a random title made out of words contained in a table
- a pair of images (the book spine
for representing the book on the shelf and the cover
for its representation in the inventory) randomly picked by a table of coupled-together filename-paths.
- other than the title, they should also carry some other unique properties(variables?) eg. number of pages and book weight
- on scene init, they are randomly generated and stacked in the shelves, one next to the other
- they can be looked-at, picked-up (leaving their place empty), and placed as items into the user's inventory. Later on, the user should still be able to know the title, weight, and number of pages for the books he is carrying and use them in a puzzle where weight, pages number and title are important.
- Be able to save the picked-up books with their properties inside the savegame [optional]
- Be able to save the whole unique Library scene with its books inside the savegame, so the user can revisit it. [my guess is this isn't feasible at all]
Any lead on how to do that?
For now I'd be more than happy if somebody pointed me towards the right direction regarding a)object instantiation, b)(re)setting a scene object image via code, c)defining the object area via lua, e)linking actions to scene objects via lua.
If I got the info on Data Structures wiki
correctly,it seems b) to e) are not scriptable. If I got it right, only their position can be changed via lua.
Alternatively what is the possibility of dynamically creating "multiple copies" of an pre-existing scene objects and only modifying their scriptable properties? For instance, if I can't change the image filename through lua, how about I create in the editor instances of all different book cover designs, and instantiate these instead? Of course they have to be separate instances, since two books may share the same cover design and hotspot area, but the title/pages number/weight, should be unique.
If instances are totally unsupported, I wonder how would you tackle the "(seemingly) random library" example? Would you painstakingly create all books in the editor and then have them shuffled around on scene init
Would also appreciate if somebody went through the list of features I imagined for this library scene and comment on the feasibility of each one of these. A short comment in the lines of "I think yes - I'd look into ___ for that" or "no - can't think of way to achieve this"
Thank you for your time!
PS. Please feel free to take your time; I'm not in the making of my next blockbuster
I'm merely trying to learn visionaire studio and thought that since I didn't find anything about new/constructed instances of scenes or scene-objects in the forums, I could raise the question, provoking an answer by others who have a better understanding of VS and its philosophy - hopefully this will be helpful for other n00bs too
PS. I remember Memoria by Daedalic had a "random" forest labyrinth puzzle with many rooms(scenes). My guess is they had one room with all possible assets already created in the editor and depending on which room you were previous in, and which direction you were exiting towards now, they were displaying only the assets that made up the next individual room, giving the illusion of travelling through rooms, while you were merely exiting from one side and reentering from the other side...