:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sylbur81PL

Hello, I would like to write a star merchant style game on the GODOT 4 engine.
As a resource I have created a ship class which contains a hull type in addition to damage, name, etc. And when a hull resource is added I would like it to have a specified in the array how many cargo or passenger modules I can add to it.
For example:

extends Resource
class_name StarshipHull
@export var name: String
@export var hullModules: Array # how to specify for many types of hulls

when I create Array it always have size 0.
Thank You for feedback.

:bust_in_silhouette: Reply From: Gil-Koren

You can create diffrent arrays for each type of hull if you have a finite amount, or you can use a dictionary with the keys being the type of hull you want. Nested arrays are also an option.

Thank You for reply,
I try to create array for each type of hull but if I put module in one type of hull, all of hulls get this same modules. I need to use modules only in starschip, and size of number of modules that I can put into my schip neded to be depend of type of hull.

Sylbur81PL | 2022-08-21 09:56