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

Get help using Construct 2

Post » Mon Oct 03, 2016 8:38 am

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!
Last edited by clarkkentnicdao on Mon Oct 03, 2016 9:07 am, edited 1 time in total.
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Mon Oct 03, 2016 8:55 am

Using containers. It is designed for those things.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Oct 03, 2016 9:02 am

99Instances2Go wrote: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 :D thanks a lot :D
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Mon Oct 03, 2016 9:55 am

Create a global variable (name it ObjectUID or something), and right after creating the object, put this in between Create Object and Destroy Object:
Code: Select all
int(ObjectName.UID)


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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Mon Oct 03, 2016 10:08 am

LaDestitute wrote:Create a global variable (name it ObjectUID or something), and right after creating the object, put this in between Create Object and Destroy Object:
Code: Select all
int(ObjectName.UID)


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 :D
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Mon Oct 03, 2016 10:16 am

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)
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Mon Oct 03, 2016 11:40 am

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Oct 04, 2016 5:55 am

Thanks a lot guys. This is added information in my knowledge about C2!
B
79
S
31
G
7
Posts: 148
Reputation: 9,179


Return to How do I....?

Who is online

Users browsing this forum: Armench, Kin and 24 guests