Creating a Package with custom settings

Hi all,

As I’m sure you’re aware, packages have been out for a while now.

Packages basically allow you to reuse models multiple times in one game, and when you change one, the rest get updated.

Using this system, I have created a couple of elements in my puzzle game.

However, when it comes to linking one element (i.e. a button, when it is pressed) with another (i.e. a door to open).

But to tell the script what event to fire, I must set a value.
Previously, I had a configuration in the model, with an ObjectValue representing the event to fire.

But if I try to change values within a model, it will require me to either publish, or update, meaning they all have the same values.

(No, attributes don’t work. Further clarification: When changing the attributes of a package, it will appear as though they are unaffected, but this I assume is a glitch in the studio. Because, when you publish from another instance of the package, all the attributes will be reset.)

Now, for this example, I could create an external script, that wires one event to another completely outside of the packages, but this only works for events. What about settings?

Take cube droppers. I want to be able to choose if the cubes should drop by default, or await input. How should I set a setting like this? As far as I’m concerned, packages do not provide any way AT ALL to have instance(as in an inserted package in the game)-specific settings.

Is there any trick I can use other than to parent the package to a model, and in that model have a configuration (what I use currently, but I feel it is very hacky, and is very annoying to use when adding new elements).

(Sorry if I’m not being clear enough.)
(Also sorry if I’m posting in the wrong forum, I feel like this is the closest one.)

2 Likes

Another possibility is to have a module that returns a configuration table that the package uses to identify whether it should drop or wait. Each instance of a package can have a unique name so if you name them appropriately you can use the name as a key in the configuration table. You would need a script in the package to require the configuraiton module, lookup the setting and apply it.

1 Like

That could work.

For example, a modulescript with object values (pointing to each package) and the object value contains attributes for the settings.

But I was just hoping there was a slightly more elegant way. Like an encapsulated way, that way I wouldn’t have to look for it in another location, and instead it is tied directly to the package itself.

Thanks for your input either way!

I really want this, and I made a suggestion for how this could look like in this reply on another related topic.

1 Like