How to recognize different instances of the same family?

Get help using Construct 2

Post » Mon May 01, 2017 6:46 pm

I'm having problems when I wnat my enemies to hurt only one enemy at time . They already choose only one clone of a object type to attack, but they hurt one clone of each object type of the family.
For example: When a "bad soldier" hits a "good soldiers" group it only hurt one of the soldier in the group, but at same time hurts a "good archer" that isn't in it's attack range just because the good archer make part of the same family that the good soldier.
My code is:

>When "bad soldier" is overlapping "Good" family
>System pick "Good" instance 0.
>System pick "GoodSoldier" instance 0.
-Make damage
>System pick "GoodArcher" instance 0.
-Make damage

So how can I make the "bad soldier" hurt only the object type "good soldier" or "good archer" (the closest one) per time?
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 01, 2017 6:55 pm

You don't want to pick the individual objects again. Any overlapping Good object is picked, so just "Make damage" on it.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon May 01, 2017 7:14 pm

But I want the bad soldier to hurt only one enemy at time, even when they're overlapped. For this he needs to choose on of the overlapped object types first and then choose one of the clones of this object type.
The enemy soldier already can choose one of the overlapped clones but he can't choose just one of the overlapped object types. In a "good" group made of archers and soldiers, all overlapped, the enemy soldier hurts only one of the overlapped soldiers but he hurts at same time one of the overlapped archers. I want him to choose only archers or only soldiers and then one single of the choosed group.
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 01, 2017 7:20 pm

You have that with Pick Good instance 0. That picks whichever the first one is, regardless of type.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon May 01, 2017 7:32 pm

yes, but when i make the action "Subtract 25 from vida" i can't especify to subtract only of the "instance 0" picked in the condition and then the damage go for all clones of the object type
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 01, 2017 7:37 pm

Then you've got the Damage actions in the wrong place. The whole point of picking instance 0 is so that subsequent actions will only work on that instance. You need to post a CAPX, or at least an image of your events.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon May 01, 2017 7:52 pm

Image

Here it is . Sorry for the language, i hope you can understand.
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 01, 2017 8:00 pm

You didn't mention all of the other conditions required :) Given what I can see, change your four other "pick instance 0"s to "pick by UID = Mal.UID". This will pick the specific object by the base type, and only one of those should match and do anything.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon May 01, 2017 8:13 pm

Should I place all 4 subtract actions together?
Like this?
Image
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 01, 2017 8:35 pm

No, that's not what I meant. In the previous image, replace "Pick Humtroglodita2 instance 0" with "Pick Humtroglodita2 by UID=Mal.UID". Same with the other three.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests