How do I pick by priority

Get help using Construct 2

Post » Tue Jun 24, 2014 11:54 pm

Hi everyone,

Basically i can't manage to pick objects depending on their role. So here is my little problem, I want to pick Characters with Role 1 in priority, and if none are available, then pick Characters with Role 2. I can't get this to work with Else Shall I instead use a variable Characters.Count < 0 to determine the availability of Role 1? or There is another way round with Else?

How would you do it?


Thanks for your help!
B
12
S
2
Posts: 85
Reputation: 899

Post » Wed Jun 25, 2014 12:23 am

You should be able to do it with Else

Image

This should definitely work
B
6
S
2
Posts: 79
Reputation: 608

Post » Wed Jun 25, 2014 1:11 am

Thanks monitz87!

Let's say that everytime I press 5, the character's opacity changes to 50. I want characters with role 1 first then those with role 2 to be affected. That is not going to work is it? I need an extra condition to check there is no character left with role 1at 100 opacity for the else to work right?
B
12
S
2
Posts: 85
Reputation: 899

Post » Wed Jun 25, 2014 1:29 am

You can use the Object.PickedCount expression after you compare Object.Role = 1 to see if there are 0 objects with a value of 1 for Role :)
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Wed Jun 25, 2014 1:37 am

Add Opacity=100 to event 1.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Wed Jun 25, 2014 1:44 am

blackhornet wrote:Add Opacity=100 to event 1.


this
B
6
S
2
Posts: 79
Reputation: 608

Post » Wed Jun 25, 2014 8:19 am

Thanks everyone! I'll try this tonight when I'll get back home :)

Basically, I'm trying to build an AI which is going to extinguish fires depending on their roles. Guys with roles 1 should be the first one to move to stop the fire, and guys with role 2 should only go there if guys with role 1 are all busy trying extinguishing the fire :)

Hopefully I'll manage to do it with your advice.
B
12
S
2
Posts: 85
Reputation: 899

Post » Wed Jun 25, 2014 9:34 pm

Right so I did what you were suggesting with opacity as condition for instance:

Image

@EncryptedCow
I did not manage to do something equivalent using your method. And since I'm always interested in in trying different alternatives, I would be interested to see that working with your suggestion. I have attached the file so you don't need to do it from scratch if you have the time :)

In the meantime, thanks for helping sorting this out. Now I need to reproduce it on a larger scale :)
You do not have the required permissions to view the files attached to this post.
B
12
S
2
Posts: 85
Reputation: 899


Return to How do I....?

Who is online

Users browsing this forum: zsoldiers and 6 guests