Manage scene properties inside an spawn array

Godot Version

4.2.1

Question

Hi all! I need a little help with a situation I have regarding to a spawn I implement in my game.
The problem is the following:
I have a “spawner” in which I can drag packedscenes(enemies in this case), so I can spawn later when I touch some area.
The spawner works fine but, for some scenes in the array, I need to modify some values(public/export values in its root).
Is there any way to access it from an array or are there another type of variable I can use to do this?
Sorry if I’m not too clear. This is what I have:

and as you see, the packed scene is there(enemy_04…), but I need to manipulate some values(public/exposed) before the spawn occurs.

I hope I was clear enough.

Thanks!

to be honest, in this kind of spawn system, I would assume you are doing it like this:

func spawn_enemies() -> void:
    for enemy in enemies:
        var enemy_instance = enemy.instantiate()
        enemy_instance.some_exported_var = some_value # changing some exported variable / does not work with position because it's not yet added to the SceneTree
        enemy_container.add_child(enemy_instance)
        enemy_instance.init_enemy(some_position, other_values) # a method inside enemy.tscn that sets its position and some other values

sorry for the delay, I do that, but what I can not do is add values because I want to use different type of enemies in the same array. Could be maybe a solution just to use several spawners for each type of enemy?

isn’t every enemy of yours inheriting from a base class?
So if you had an export variable like @export var enemies: Array(Enemy), you can then loop over them?
Because every enemy inherits the baseClass, they have the same methods and base properties.
Then again, I don’t know how you designed your enemies and how your SceneTree looks like.

in my case, I have my enemies inherited from a base class. But I have a component inside that drops something. In this case the drop can be a health potion/pill or a point to use in a skill. I don’t want to have the skill point in my first level, but in my second, third, etc. Since I can not access is from my main spawn array, I am not able to change this type of things.

Could you show me the code of how it would normally be initialized for the second, third, etc levels?
I am interested to know what variables and changes you need to apply to the main spawn array that you cannot do for your first level. I don’t think I understand how your “skill points” system work and how that would require you to modify some values.

Are we talking about extra parameters for a method inside of the Enemy baseclass? If yes, then we can mark the extra parameters as optional by giving them a default value. We can disregard those parameters for the first level, but make use of them for the second level onwards.

func spawn_enemies() -> void:
    [...]
    # for level one
    enemy_instance.init_enemy(some_position, other_values)
    # for level two onwards
    enemy_instance.init_enemy(some_position, other_values, optional_value)
func init_enemy(pos: Vector2, other_values, optional_value: String = "i am a default") -> void:
    # initialize enemy or something
    if optional_value == "i am a default":
        # this only happens in level two onwards