Piggie needs to learn to play with others

Get help using Construct 2

Post » Mon Dec 02, 2013 12:50 am

Hi everybody.

I've been trying to solve this problem for some time now. I haven't found anything similar in the forums.

I want a certain Pig to find a path to another random Pig. What I did was:



but what happens is he just targets himself. He's not interested in other pigs...

How can I make him target other instances?

Here's a simple capx recreating my problem.

Thank you.
B
10
S
1
Posts: 17
Reputation: 642

Post » Mon Dec 02, 2013 12:54 am

Pick random ?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Mon Dec 02, 2013 1:07 am

I tried that on the capx I sent. You can see that the red ball goes to the randomly selected green square but the randomly selected square targets itself instead of another square.
B
10
S
1
Posts: 17
Reputation: 642

Post » Mon Dec 02, 2013 1:11 am

in your example

event 1

add condition: Sprite2 is calculating pathinfinding. And in the even right click and invert it.

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Mon Dec 02, 2013 1:18 am

Sorry I sent the old file

Here it is.
B
10
S
1
Posts: 17
Reputation: 642

Post » Mon Dec 02, 2013 1:19 am

Change it to the pic I posted, preview and wait.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Mon Dec 02, 2013 1:29 am

Thank for your time lennaert on answering but it seems I'm not explaining properly.

My actual problem is that I can't make an object find a path to a random instance of the same object.

I gave the example of the Pig finding another Pig to play with. The problem is since I'm picking the Pigs "in the mood" to make them look for a path, I can't pick a different one for them to find a path (they don't have to be "in the mood", if Piggie wants, Piggie gets).
B
10
S
1
Posts: 17
Reputation: 642

Post » Mon Dec 02, 2013 1:33 am

Getting back yo your first post, you are picking the "appropriate" pig, and then picking again from from that same set of one! Your subevent needs to first Pick all, then pick all pigs that do NOT have the "appropriate" condition, and then randomly pick one of those.
ImageImageImage
B
71
S
22
G
248
Posts: 3,756
Reputation: 138,058

Post » Mon Dec 02, 2013 1:55 am

I've never used Pick All, didn't know what it did! I think I can understand how I can repick all of them but I don't know how the Actions would come in here. Tried a few things based on what you said but failed.

Should it look kind of like this?


Could you help me with the actions now?
B
10
S
1
Posts: 17
Reputation: 642

Post » Mon Dec 02, 2013 1:56 am

haha, thats what I thought at first, then saw your example ... and we got lost there somewhere, hehe

here, hows this

capx
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests