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

Get help using Construct 2

Post » Fri Aug 29, 2014 12:46 am

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 do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Fri Aug 29, 2014 6:51 am

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
"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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 29, 2014 7:53 am

I was going to recommend the nickname plugin as well. It works wonders in cases like this
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Fri Aug 29, 2014 8:47 am

all this time I need a plugin! ahh! thankyou
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Fri Aug 29, 2014 10:13 am

smoke84 wrote:all this time I need a plugin! ahh! thankyou


Well it's one way to do it.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 29, 2014 5:48 pm

@codah Do you have another method to try?
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Fri Aug 29, 2014 10:26 pm

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 ...
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Aug 30, 2014 5:11 am

Or just put your monsters in single object as different animations.
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sat Aug 30, 2014 6:17 pm

I was considering that but was wondering how I would keep the stats organized like mob1 hp = 10, mob 2hp = 30, etc
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Sat Aug 30, 2014 8:46 pm

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, evillair, gamecorpstudio, jorgmaquoi, ultrafop and 24 guests