advanced comparison of private values when object is same

Get help using Construct 2

Post » Sun Jan 25, 2015 12:09 pm

Hi, I hardly tried to figure it out by myself and searched in the forum, but failed :(

Well, there are 2-3 or more objects of the same type, and all of them have their private variable (Action Points).
If one of the objects finished "his turn", his private variable (AP) equals zero,
and another object automatically activates (of course, if his ActionPoints > 0).

So, how to select another object of the same type (his private variable should be >0) after the fist object's private variable check?

Here is the .capx https://drive.google.com/open?id=0B7p49JKt0CGLazFncTNpUm5VbjQ&authuser=0
B
13
S
4
G
2
Posts: 22
Reputation: 1,511

Post » Sun Jan 25, 2015 12:21 pm

Oh, you can do that through another variable :)))
but may be there is any different solution?
Image
B
13
S
4
G
2
Posts: 22
Reputation: 1,511

Post » Sun Jan 25, 2015 2:43 pm

I'd probably keep track of the sprite currently selected in a variable, and then use an expression like:

pick selected = 1
ap = 0: set selected = 0
-- (subevent)
-- pick all
-- pick instance with highest ap
-- ap > 0: selected = 1


Other idea would be checking the ap with a function, that you call after every ap using event, that checks if the ap are 0 and if they are, run the selection again. Performance-wise this would be a bit faster than running the event every turn.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests