Pick by Instance Variable in Family - Create?

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I'm trying to make an event to create random objects from a family, but limited to the objects with a specific instance variable value.

    I have X amount of objects in a family called Objects. The family has an instance variable called CanBuild.

    If an object's CanBuild variable is 1 you can create it, if not you can't.

    I've set the CanBuild variable to 1 in one of the objects and 0 in the rest.

    I've made following event:

    On touched (create button) ---> Subevent ---> Pick Objects where Objects.CanBuild = 1 --->Subevent---> Create object.

    But it doesn't create the object. If I remove the Pick Objects condition it just creates a random object from the Objects family.

    Any ideas how to do this? I hope it's clear enough.

  • You are telling the program to pick an instance with a certain variable value, but that instance doesnt exists, thats why is not creating anything. You should put the value in another object like the button being touched so:

    On touched >

       Subevent> button variable=1 > create this object

       Subevent> button variable=0 > create that object

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply!

    I understand what you're saying, but the problem is that I don't wanna create a specific object, but rather create a random object from a range of objects within a family. Is it not possible to choose which objects within a family can be created and which cannot?

    I want to make certain objects available only in certains levels etc.

    I guess one solution could be to make different families for all the levels..

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