How do I stop all family members from being hit

Get help using Construct 2

Post » Thu Aug 21, 2014 11:58 pm

Hello everyone!

I have been playing around with health bars and recently started using families. The family is called Mob_Family.

That family has two variables. (mob_health) and (mob_maxhealth)I am having trouble with damaging foes.

I have 4 statically placed mobs. Each mob has a different value for mob_health.

When I test play, All 4 mobs get a health bar above them but when I strike the first mob, all 4 mobs take damage and every health bar updates as a result. And the enemy with the lowest hp will be destroyed even if i don't hit him. I don't know what I can do to fix this issue. Any suggestions? Thanks

PS: I was hoping to avoid using containers
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 22, 2014 12:47 am

if this is all your doing your events look overly complicated why not just have

Event:Weapon on collision with Mob_famliy
Action: the three actions you have in your function
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Fri Aug 22, 2014 1:07 am

I could but it does not solve my issue.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Fri Aug 22, 2014 1:36 am

well it should fix the health issue
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Fri Aug 22, 2014 3:46 am

You have to pass in to the function, the UID of the object being damaged, then in the function pick using that UID (function.param(0)). And use a for loop to call the function for each object.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Aug 23, 2014 12:01 am

still having trouble setting this up. :(
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Sat Aug 23, 2014 12:45 am

smoke84 wrote:still having trouble setting this up. :(


Don't have time now, but look at your mobhp_bar function in isolation. How do you expect it to know which Mob_Family object to perform on? You're currently selecting all objects in the family, thus you're operating on them all.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Aug 23, 2014 7:06 pm

Everything is working as intended thanks everyone.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Sun Aug 24, 2014 10:17 pm

well done :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, digitalsoapbox, Mike Mead, OBLIVION and 23 guests