spawn a specific object that is inside a Family?

Get help using Construct 2

Post » Tue Jan 21, 2014 8:39 am

I have a "Family" called "Monsters".
Inside the "Family Monsters" I have:

- Monster A (UID = 1)
- Monster B (UID = 2)
- Monster C (UID = 3)

I'm trying the following:

> On Start of Layout:
> Pick FamilyMonster with Instance UID = 2 > RiseMonters: Spawn FamilyMonster on layer X;
> RiseMonters : destroy;

Am I doing something wrong?

Thanks allmoebios2014-01-21 08:42:11
B
24
S
4
G
2
Posts: 96
Reputation: 2,467

Post » Tue Jan 21, 2014 10:58 am

The code for spawning the monsters has to be a sub event of where you picked which one you want to spawn.
B
83
S
40
G
15
Posts: 993
Reputation: 16,909

Post » Tue Jan 21, 2014 11:08 am

Why not just:

> On Start of Layout:
- RiseMonters: Spawn Monster B on layer X;
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jan 21, 2014 4:27 pm

Because the monster UID is passed through a function. So I can not just call the monster directly as you suggested. =/
B
24
S
4
G
2
Posts: 96
Reputation: 2,467

Post » Tue Jan 21, 2014 4:43 pm

I didn't see a function, so I couldn't have known.

aren't uid's asigned at runtime, though? or is uid a variable here (impossible as far as I know) Maybe I'm just misunderstanding what you are trying to do here..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jan 21, 2014 7:06 pm

hahaha, no problem. I just want to do this:

> Pick FamilyMonster with Instance UID = VAR > RiseMonters: Spawn FamilyMonster on layer X;
> RiseMonters : destroy;

but, probably is not possible... =/
B
24
S
4
G
2
Posts: 96
Reputation: 2,467

Post » Tue Jan 21, 2014 7:25 pm

I think you are using uid in the wrong way. A uid is assigned to an instance after it is created, so picking it before it's spawned seems impossible.

Instead of uid, use an instance variable set differently for each member of the family and you should be ready to go.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jan 21, 2014 7:39 pm

but inside family each object have a uid...
B
24
S
4
G
2
Posts: 96
Reputation: 2,467

Post » Tue Jan 21, 2014 7:58 pm

@moebios

that's not quite true.
When you look in the editor you may see a field uid but this is only the unique ID to the instance you have selected in the editor.

When you create a new object it gets another uid.
B
22
S
7
G
4
Posts: 154
Reputation: 3,699

Post » Tue Jan 21, 2014 8:45 pm

Got it. So there's no way to spawn an object of a family.
B
24
S
4
G
2
Posts: 96
Reputation: 2,467

Next

Return to How do I....?

Who is online

Users browsing this forum: Held, NN81, TsubaRu and 8 guests