How do I destroy the new created trigger? [SOLVED]

0 favourites
  • 8 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I create multiple monster and i created same trigger to them. The problem is when i killed/destroy the monster i targeted and destroyed the trigger pinned to it, all the trigger on the other monsters are destroyed too. How can i solve this? please help thanks in advance!

  • Using containers. It is designed for those things.

  • Using containers. It is designed for those things.

    oh i see thanks. if you are not busy can you give an example? i will compare what i have done to yours

    EDIT: i did it now

  • Create a global variable (name it ObjectUID or something), and right after creating the object, put this in between Create Object and Destroy Object:

    int(ObjectName.UID)[/code:3r0pkid7]
    
    You can then refer back to this with objects you want to specifically manipulate or destroy by choosing Pick by UID and using the global variable as the UID. A good example would be having the player pick up an object and using the stored UID to only manage said object and not any other instances around.
  • Create a global variable (name it ObjectUID or something), and right after creating the object, put this in between Create Object and Destroy Object:

    int(ObjectName.UID)[/code:1gesphsz]
    
    You can then refer back to this with objects you want to specifically manipulate or destroy by choosing Pick by UID and using the global variable as the UID. A good example would be having the player pick up an object and using the stored UID to only manage said object and not any other instances around.
    

    thanks for this too

  • Having a global variable and using pick by variable-contents is a bit simpler but you could also get a bit more advanced and store the UID and/or variable via array or dictionary. My head's a tad fuzzy atm, so I think it's more efficient (cut out the middle man) by storing the UID directly to an array/dictionary, if you want to go the more advanced route.

    Dictionary (for the picking by UID action): Dictionary.Get("VariableName")

    Array (same): Array.At(0)

    (be sure to set the dictionary key or array to the UID before hand on creation, though, that may be an easy mistake to forget to)

    I'm pretty sure the inside of Array's At follows a 0 or 0,0 or 0,0,0 format depending on array size. (i.e, just zero for only 1d arrays)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, when using containers, picking is done for you. No need to keep track in arrays and those things.

    Pick one in the container and the picklist contains all from the container.

    Also, destory/create one, and you create/destroy all.

    https://drive.google.com/open?id=0B1SSu ... EpWdWI5Nlk

    Only 1 little downfall, you have to create them during runtime. But that is pretty easy.

  • Thanks a lot guys. This is added information in my knowledge about C2!

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