How do I reference a family member to populate my grid?

  • Hello Everyone

    I am using an array to create a grid of squares. Each square in the grid is assigned a instance variable: box_id. I also have a family of 3 monsters which have instance variables: mob_id.

    My Box_ID's on the grid look like:

    0, 5, 10, 15, 20

    1, 6, 11, 16, 21

    2, 7, 12, 17, 22

    3, 8, 13, 18, 23

    4, 9, 14, 19, 24

    My Mob_ID's

    monster1... mob_id = 0

    monster2... mob_id = 1

    monster3... mob_id = 2

    Right now when I hit B my grid is created but it is empty.

    I would like to match box_id to mob_id and spawn a monster in the associated square.

    I have searched the forums and tried many things but I can't seem to figure out how to do this. How can I reference a specific family member and tie it to my grid?

    The end result should show 3 monsters on my grid occupying the squares marked 0 , 1 and 2

    Any suggestions? I have been stuck on this for hours..

  • You can't spawn a specific family member. I would use the nickname plugin and give each monster type a nickname "beast_0", "beast_1" etc. then spawn based on [quote:39g7ikjs]"beast_" & beast_box.box_id

    Or there might be other plugins that work more like the way you're expecting a Family to work.

    Otherwise you could have an IF block and if a square is 0, spawn monster type 0, etc.

  • I was going to recommend the nickname plugin as well. It works wonders in cases like this

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • all this time I need a plugin! ahh! thankyou

  • all this time I need a plugin! ahh! thankyou

    Well it's one way to do it.

  • codah Do you have another method to try?

  • If there are only 3 different monster types. Can't it be as simple as

    System: beast_box.box_id = 0 -> beast_box: Spawn monster1 ...

    System: beast_box.box_id = 1 -> beast_box: Spawn monster2 ...

    System: beast_box.box_id = 2 -> beast_box: Spawn monster3 ...

  • Or just put your monsters in single object as different animations.

  • I was considering that but was wondering how I would keep the stats organized like mob1 hp = 10, mob 2hp = 30, etc

  • That could be as easy as:

    monster on created (or any other triggered event)

    monster if animationframe is 1 set hp to 10

    monster if animationframe is 2 set hp to 20

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