pick object by name

This forum is currently in read-only mode.
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hi!

    I need to pick an object, which name is in a global variable. For example:

    Key space is pressed

    -global (doomed): Destroy

    is there any way to do this without having to create a PV and manually write the name in for each object?

  • how can an objects name be in a global variable?

    I don't fully understand what you want, but it's probably better to give your objects a "name" private variable.

  • You might be able to work with the object ID (Object.OID).

    If there's no other way to pick objects, you might be able to put them all in the same family, and pick by comparison, Family.OID Equal To Global('Stored OID').

  • There is system create, but no system destroy.

    Might be useful tho....

  • Well the thing is that for this engine i'm working on I'm trying to make everything to be as efficient as possible when i'm expanding the game later on. Right now i'm working on a weapons system, and without this option each weapon needs an extra private variable added, and so far everything is 100% free from unnescessary repetitions.

    Is it hard to add? Because i've thought of it before, and i think it's really wierd that you type everything in eccept the objects that you have to pick from a list. Using calculations or values to pick objects looks to me like something that should have been there from the beginning.

  • The only way I can think of is to have each object that can be destroyed this way in a family, then when you compare the private variable to test if it = the global variable then you destroy it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea, families are the way to go when you want expandability and all objects to behave in a similar fashion. Your setup sounds typical of a family usage.

    and newt, what would system destroy do?

  • he means destroy by name

    or pick by name

  • yea, families are the way to go when you want expandability and all objects to behave in a similar fashion. Your setup sounds typical of a family usage.

    and newt, what would system destroy do?

    Yeah opposite of system create object by name.

    System destroy object by name, in this case he could actually destroy the object by referencing the global with the same name.

  • Exactly. Actually i think all object picking should be by name.

    Edit: Creating an object was actually what i had to do. And it worked perfectly... so... yeah....

    But i still think being able to pick objects through expressions all the time would be a better system.

  • keep a lookout for my next plugin

    i dont want get too much into it, because its still a ways off, but its made for stuff like this,

    name based picking

    being able to place an object or a group objects in a named slot for later picking

    like:

    -on collision with- "enemyguy"

    ---------place- "enemyguy" in "doomed"

    and later

    -pick- "doomed"

    arrays of objects

    expression based object picking

    lots of crap, but im developing it slowly over time so...its not gonna be next week or anything

  • I'm really looking forward to that. Will use it in my AI enginel. But for now, my problem is solved by being told about the spawn object by name action. Thank you for your help! And lucid, thanks for all your contribution to construct. You're a beast at creating plugins.

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