Objects Importer
Last updated
Last updated
The objects importer can be used from the administration panel:
Or from the command line using Reldens NPX commands:
For example:
The way the importer works is with a JSON file that should contain the complete objects data but with some extra benefits, like:
Having a "defaults" data set to avoid having to specify the same properties over and over if you have to create multiple objects.
Getting almost all the related contents automatically created: animations, stats, experience rewarded and respawn areas.
IMPORTANT NOTES:
The importer will create all the objects related records, but you will have to manually upload the assets files to the proper folder [your-theme-folder]/assets/custom/sprites/
.
If you would like to get the "attributes per level" or the "experience rewards" automatically created you would need to pass that information to the importer, in which case, I recommend to use the attributes per level generator and the enemies experience per level generator.
The importer will loop over each "object" and create a data set that will clone the "defaults" to use these as base. It will do a deep clone on the "defaults" and a deep merge on each property, meaning, if your "defaults" looks like this:
And the current object has a value like: currentObject.property.subPropertyA = 'asdasd'
This will override or be included a part of the existent property
in the defaults, like:
In order to complete the objects creation we need to know the room ID for that object. Since manually writing the room IDs would be difficult and unclear to which room the object is going to be assigned, here we can use the roomsNames
. The importer will fetch the rooms IDs and create one object
per each specified room here. In the case above the 2 objects are going to be created in 3 rooms.
As you can see in the example above, we also need to know the layer
(layer_name
in the storage). The specified layer is also used to create the respawn area for the object.
Also related to the respawn areas creation you can see the classType
and the childObjectType
visible in the "defaults". In these two you can pass the object type key
, instead of having to pass the type ID which is the stored value.
For reference, the available types with their description can be found in the objects entity documentation.
For now, Objects has 2 places where we need to define the animations:
The "default" animation, which is defined in the object.clientParams
and passed as part of the object properties.
All the other animations defined by a name convention in the animationKey
coming from the storage.
IMPORTANT: the animationKey
convention follows the format [layer-name]_[object-ID]_[key]
, where key
is the part of the convention to set the animation direction
.
For example, following the JSON above, you would get entries with the following keys for the first object:
If your object is an "enemy" type, or for some reason it needs to have "stats", you can pass the "stats" information in two different ways:
By passing the "stats" property on each object (or as part of the "defaults"), like the two samples below:
In this case the format is {[stat-key]: [stat-value]}
, where [stat-key] must match the key
on the storage.
By passing the path of the "monster-attributes-per-level-generated.json" file in the JSON, like:
The object experience reward can also be passed in two ways:
As "experience" on each object (or as part of the "defaults"), like the two samples below:
By passing the path of the "monsters-experience-per-level-generated.json" file in the JSON, like: