Multiple Instances, Multiple Behaviours (RPG Style)

  • 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...

    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? )

    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 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.

  • 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.

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you all! 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:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)