Is it possible spawn an object using a string?

0 favourites
  • 3 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • What I am trying to do is create a system in which I can place down randomized zone-based spawners without having to touch their variables. All I have to do to add new spawners is create new dictionary keys, instead of having to set up events for each new spawner/enemy combination.

    I have it so far that it modularly sets up any members of the Spawner Family based on their object name by using a RegexReplace expression to pull from the object name

    For example, ForestEnemySpawner -> ForestEnemySpawner.EnemyType = choose(Forest1, Forest2, Forest3)

    And I want to be able to do this

    SpawnerFamily: Conditions Met -> Spawn object: Dictionary.Get(ForestSpawner.EnemyType)

    With a dictionary key Forest#=UniqueEnemyObject

    I know I can achieve the effect I need by simply setting up individual events for each spawner/enemytype configuration but I am much more interested if this type of setup can work. I was wondering if it's possible through some event magic I can't think of or maybe some functions


  • I think what you are looking for is the "System->Create Object by Name" action.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you, I didn't realize it was stored under system. It seems strange that the option isn't available anywhere besides system though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)