How do I pick objects by instant variable for set behavior

Get help using Construct 2

Post » Thu Jul 28, 2016 7:34 pm

Hi. I have objects with different instant variable values for different features. But when I need set a behavior for a object with a instant variable, the behavior set actions for all instances!
How can I tweak or do a better thing than it?
Thanks in advance :)
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Post » Thu Jul 28, 2016 7:46 pm

Well, you should be able to pick objects by variable value with no problem, something like,

Object Variable = 0 --> do X
Object Variable = 1 --> do Y

Only objects whose variable equals 0 will do X and those with 1 will do Y, so I'm not sure I understand the problem correctly?
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Thu Jul 28, 2016 9:27 pm

Sup with that? wrote:Well, you should be able to pick objects by variable value with no problem, something like,

Object Variable = 0 --> do X
Object Variable = 1 --> do Y

Only objects whose variable equals 0 will do X and those with 1 will do Y, so I'm not sure I understand the problem correctly?


I use text in variables instead of numbers.
This is my sheet:
Image

The drag and drop behavior isn't working for all instances. I don't know what is the conflict.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Post » Thu Jul 28, 2016 10:36 pm

I tried recreating something similar but it seems to be working correctly. What does the event which sets the Type variable look like? Most likely something in that condition is setting Type for all instances instead of just one.
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Thu Jul 28, 2016 10:53 pm

Good idea, but I've tried in a separate-new project, with two instances with different variables, but the behaviors continue working for all instances.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Post » Thu Jul 28, 2016 11:05 pm

@Ashley, I think here its a problem with behaviors.
Last edited by DaniellMesquito on Fri Jul 29, 2016 12:40 am, edited 1 time in total.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Post » Thu Jul 28, 2016 11:24 pm

Hmm, strange. Can you upload the .capx for one of these projects so I can have a look?
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Thu Jul 28, 2016 11:27 pm

Of the main project I can't, but I will send of the separated project.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Post » Fri Jul 29, 2016 12:08 am

You need a "For each" loop in your conditions, otherwise if just one object meets the conditions, it will apply to all object instances (because you haven't told it to check each one individually).

[For each sprite.object]
[sprite.variable=XYZ]
--- Do stuff
[ELSE]
--- Do nothing

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Fri Jul 29, 2016 1:08 am

@SoldjahBoy

SoldjahBoy wrote:You need a "For each" loop in your conditions, otherwise if just one object meets the conditions, it will apply to all object instances (because you haven't told it to check each one individually).

[For each sprite.object]
[sprite.variable=XYZ]
--- Do stuff
[ELSE]
--- Do nothing

~Sol


It isn't working. I tried using car behavior instead of dragndrop, and continues conflicting.

Image
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
24
S
7
G
4
Posts: 326
Reputation: 3,878

Next

Return to How do I....?

Who is online

Users browsing this forum: AndreasR, HellMax, tarek2 and 9 guests