Page 1 of 1

Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 1:22 pm
by wossi
Hello, I have some problems with the doors. How can I control multiple doors individually? Thank you for your help.

Here is the *.capx file:
https://www.dropbox.com/s/lw4wpwajvpgxge3/Door_Actions.capx

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 4:08 pm
by wizaerd
I imagine the same way you'd do anything that involved multiple instances... Use the condition and select a specific door by it's UID...

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 5:00 pm
by wossi
That's was my first idea, but how I can control UID's?

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 6:10 pm
by C-7
I just give them an instance variable (I call it "which") and then assign them a number myself (1, 2, etc.). Then I just say

If door.which =1

Then do whatever you want.

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 6:25 pm
by andreyin
I like to use the IID instead of the UID, because it's fixed.

If you hardcode using the UID, you could accidentally change all the UIDs in your game and you'd have to change each line of code manually (at least that happened with C2 a while ago, not sure if this still happens).

Let's say you have 3 doors in a layout; if you pick them by IID, their respective numbers will be 0, 1 and 2, in the order they were created.

IF player entered door
AND door.IID = 0
-> Go to layout

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 6:26 pm
by vee41
[QUOTE=wossi] That's was my first idea, but how I can control UID's?[/QUOTE]

No need to make anything messy like that, here is one way to do it: door example

@C-7 Isn't that exactly duplicating what UID's are meant for? :)

Re: Open/Close Doors (Multiple Objects)

PostPosted: Sun Sep 15, 2013 6:48 pm
by wossi
[QUOTE=vee41] [QUOTE=wossi] That's was my first idea, but how I can control UID's?[/QUOTE]

No need to make anything messy like that, here is one way to do it: door example[/URL]

@C-7 Isn't that exactly duplicating what UID's are meant for? :)[/QUOTE]

Oh thank you! I can not tell you how grateful I am to you! You make my day! Thank you very much! ;Dwossi2013-09-15 18:49:40