Creating Objects by name and then picking them

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi
    when using create object by name is there any way to pick the Active object I just created and do something with it like set it's animation frame etc?
    I currently have a list that contains all the names of the objects I would like to create and I'm using create object by name to add them to my game but I can't think of any way to pick them once they have been created.
    Any help would be appreciated.
    Thanks.

  • Picking can be tricky. In my testing ... using the Foreach extension was the "only way" to pick and work with a specific object. I agree this process does need work and some new extensions to make the process easier. The Foreach loop picks active objects in reverse order ... so be aware. Again there might be a different way of picking but I have not found it based on my testing.

  • I had the same problem in a game to generate random objects from a pool list, I didnt find how to do it and changed the code.
    Now I thought to a possible way, it should be tested, now a cant verify it but my idea is this.

    1) Give to all the objects in the list a Flag "JustCreated" setted On and the same Qualifier.
    2) Create the object by name from the list
    3) Start a "Foreach Loop" on the Qualifier, for example "CheckCreation"
    4) On the foreach loop "CheckCreation" + "JustCreated" is On: do wath you need to do using the qualifier and remember to set the flag "JustCreated" to Off

    I think it should work, it is to be tested.

  • Hi @10mbra1, nice example. You don't really need the foreach loop, though! As long as the objects you are creating by name possess a qualifier, you can simply create by name then apply actions to the qualifier in the same event, and the correct object will be scoped.

    Your example without the foreach loop: Please login to see this attachment.

    Best person at writing incomprehensible posts. Edits are a regularity.

  • Intersting optimization, simply the Qualifier did the work, we are always lerning new things ;)
    I am not at pc so I cant se the file... I suppose at this point the flag is useless.

    Edit:
    Thinking about this... it is very simple for scooping objet. Had I focused this 5 months ago I wuold have saved days of work.

    Edited 2 times, last by 1Ombra1 (June 30, 2018 at 9:57 PM).

  • Object picking becomes a lot easier if you can store a dedicated identifier value on it, then compare that to a value on something else. For instance, if you have a mouse cursor active object that stores an object id value when it collides with that object, then upon pressing left click, the object with an id value that matches the id value stored in the mouse cursor object sets its internal flag "Click and Drag" on. Using this method you can even have objects stacked on top of each other & only a single one will attach to the cursor.

  • Hi thanks for all of your responses, I have a new related question. I noticed that when you create an object by name the frame seems to need at least one instance of the object otherwise nothing is created. I'm in the process of making a level editor and I was planning on using create by name to place objects so that I don't need to create a new event line for every object in the game since there could be hundreds of them. However if I need one of every object in the main frame to load/build levels is that likely to impact performance? any ideas on how I go about handling the situation? would it actually be better to use a line for each object?

    any help would be appreciated
    thanks.

  • I had the same problem in a game to generate random objects from a pool list, I didnt find how to do it and changed the code.
    Now I thought to a possible way, it should be tested, now a cant verify it but my idea is this.

    1) Give to all the objects in the list a Flag "JustCreated" setted On and the same Qualifier.
    2) Create the object by name from the list
    3) Start a "Foreach Loop" on the Qualifier, for example "CheckCreation"
    4) On the foreach loop "CheckCreation" + "JustCreated" is On: do wath you need to do using the qualifier and remember to set the flag "JustCreated" to Off

    I think it should work, it is to be tested.

    you saved me a lot of time, thanks.<3

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!