Multiple Instances, Multiple Behaviours (RPG Style)

Get help using Construct 2

Post » Sat Oct 04, 2014 3:45 pm

Hey all. I've searched around but as yet haven't found anything to help, and I've been trying to get this for a few days now... :oops:

Basically I want to spawn multiple instances of a crab, and have them all wander around independantly. I can (of course) get this for one crab, but if I try and spawn more, then they all behave as one. I'm sure it's a simple solution but it's driving me nuts. (Oh yeah and I'm new to Construct, could you tell? :lol: )

Should I be picking them from the UIDs (I can't figure out how to do that either), or should I be structuring this all differently? Stuck, I am.

Any help would be much appreciated!

Here's a screenshot of the event sheet:
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 28
Reputation: 465

Post » Sat Oct 04, 2014 4:23 pm

You need to pass something to the function. Most likely the UID of the newly created crab.
So in:
Call "EnableCrabby" (Crabby.UID)

Same goes with the call to "CrabbyGO"

Also in the functions you need to pick the crab as well-

So "On "EnableCrabby" you have to add

Pick Crabby.UID = Function.Param(0)

Same goes in "CrabbyGo"

Otherwise the function don't know what crab it should work with and just pick all of them, and that's why they all behave the same.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Sat Oct 04, 2014 7:13 pm

Thanks a heap for the quick answer nimos.

Sorry to say I'm still a complete beginner though, and I'm a bit lost. I get the logic of what you're saying, but I'm not sure which command I use to pass those UID's on - could you give an example so I can see what the value should be?

I just read the manual and about 5 forum topics but it's all a bit advanced and not quite the same issue. X) Sorry for the trouble, and thanks again.
B
6
S
1
Posts: 28
Reputation: 465

Post » Sat Oct 04, 2014 7:45 pm

You can add parameter in the Call Function dialog. Double click the Call "EnableCrabby"(), click on the "add parameter", type Crabby.UID, you should see exactly what nimos100 typed above, then follow through his instruction.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Sat Oct 04, 2014 10:37 pm

Jimzip wrote: I'm still a complete beginner .


Have you done the beginner tutorials? You must learn the basics of events and picking before perhaps going on to more advanced features like functions. Good luck.

https://www.scirra.com/tutorials/37/beginners-guide-to-construct-2
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Oct 05, 2014 1:59 pm

Message: Jimzip is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
Thank you all! :D I got it, and ugh I feel so stupid ... I was looking for the pick condition in System and not on the object itself ... -.- always simpler than you think.

Codah yep, hehe was the first thing I did when I started construct. ;) Thanks though.

For anyone else having problems with this, here's another thread with the problem & solution: . scirra.com/forum/passing-a-sprite-or-reference-to-to-a-function_t87399

And here's a screenshot of how this function looks now:
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 28
Reputation: 465


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests