Find and use the UID of objects?

This forum is currently in read-only mode.
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • How would you go about finding an instance of an object that isn�t directly affected by say, a bullet?

    Dont want to destroy every enemy when only one gets shot.

  • You don't need to worry about it. Just do this:

    +enemy.sprite is overlapping bullet.sprite
       -Destroy enemy.sprite
    [/code:3gfu3e9d]
    
    Instance picking is handled for you.  Only the instances that meet the criteria of your conditions are selected for the actions that are in the event.  If all of your enemies are dying when only one is hit by a bullet, check the logic of your conditions to make sure you're not picking more than you need to.
    
    If you're still having trouble, post your .cap so someone can take a look.
  • You don't need to worry about it. Just do this:

    > +enemy.sprite is overlapping bullet.sprite
       -Destroy enemy.sprite
    [/code:3kbtr5mq]
    
    Instance picking is handled for you.  Only the instances that meet the criteria of your conditions are selected for the actions that are in the event.  If all of your enemies are dying when only one is hit by a bullet, check the logic of your conditions to make sure you're not picking more than you need to.
    
    If you're still having trouble, post your .cap so someone can take a look.
    

    Well, that I know. What Im asking is rather this: Object A(uid 54) is being shot by Object B (uid 43)(bullet), but instead of Object A being destroyed, I would like Object C (uid 86)to be.

    Would be usefull when you are using another object for collision checking.

    Edit:

  • You can use containers for this, so that when one object is picked via conditions, another one (or more) is too.

    Here's an article on it:

    http://69.24.73.172/scirra/wiki/index.p ... Containers

  • You can use containers for this, so that when one object is picked via conditions, another one (or more) is too.

    Here's an article on it:

    http://69.24.73.172/scirra/wiki/index.p ... Containers

    Exactly what Im looking for. Thanks =)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, that I know. What Im asking is rather this: Object A(uid 54) is being shot by Object B (uid 43)(bullet), but instead of Object A being destroyed, I would like Object C (uid 86)to be.

    Would be usefull when you are using another object for collision checking.

    Edit:

    Ah, see. That's a little more specific.

    You can use containers for this, so that when one object is picked via conditions, another one (or more) is too.

    Here's an article on it:

    http://69.24.73.172/scirra/wiki/index.p ... Containers

    Dude, I totally forgot I even wrote that article.

  • do you guys think containers can work for bullets? basically, i have bullets spawn from a character, and then particle effects spawn on that bullet. getting the particle effects to destroy themselves when their bullet is destroyed was a little tricky, and my current implementation is a bit wonky. at the end of the container article, it mentions having the same number of objects etc -- but being a bullet, there's only one instance of it in the layout editor (and is destroyed on start). i tried it out and it did NOT work as intended...

    edit: if you test for a collision between a sprite and a particle effect, it lets you -- but the other way around isn't permitted... this seems to be related to my problem. i tried just setting it to where the same colision detection for the missle would also be checked for the particle effect spewer, but it destroys all instances of the particle effect spewer, and not just the one overlapping the sprite.

    maybe a bug?

  • Sounds a little strange. Maybe upload your .cap so someone can have a look?

  • http://upload.dfyb.net/uploaded/messed_particles.zip

    best solution i've found so far is to give the particle spewers a lifespan -- keeps them below a certain threshold. but the uploaded .cap doesn't have that -- the uploaded .cap shows how trying to destroy one particle effect spewer results in destroying all of them.

  • Dude, you've really got to name your objects. My brain hurts from trying to read your events. It's all Sprite, Sprite2, Sprite3, Particles, Particles2, Particles3, and none of your sprite icons look like their sprites.

    Anyway, I'm pretty sure I've got it fixed for you.

    http://www.fileshack.us/get_file.php?id ... ticles.cap

    I put the bullet-trails particle object into a container with the bullet, and removed (or rather, turned off) two of your events, particle spawn and particle create. I commented both. Seems to work fine now.

  • Dude, you've really got to name your objects. My brain hurts from trying to read your events. It's all Sprite, Sprite2, Sprite3, Particles, Particles2, Particles3, and none of your sprite icons look like their sprites.

    Anyway, I'm pretty sure I've got it fixed for you.

    http://www.fileshack.us/get_file.php?id ... ticles.cap

    I put the bullet-trails particle object into a container with the bullet, and removed (or rather, turned off) two of your events, particle spawn and particle create. I commented both. Seems to work fine now.

    hat .cap wasn't really part of a project or anything -- just wanted to experiment with missles, so i didn't bother with proper organization.

    cool to see the container working with bullets though -- thanks.

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