How do I pick instances with differnet instance variables?

Get help using Construct 2

Post » Tue May 09, 2017 1:02 am

Hello!

I'm currently developing a RTS game as an hobby and ran into an issue of ordering different units in the game to target other instances that don't match their instances variables.

I have attempted multiple times and couldn't get a script working

When a unit is created they get their team from whatever they are colliding with

I am looking for an example of a script that an instance of a unit that picks other instances of itself that don't match instance variables and order to target automatically.

I'll link some pictures of script i have tried.

Image

Image

Thank you for your time
B
6
Posts: 2
Reputation: 256

Post » Tue May 09, 2017 12:32 pm

The 'Add object to target' action is not 'personal'. It does not add 'picked' targets. It adds objects and their instances to its 'auto' target system. All instances of that object. Also, once added, the instance is not a target yet. It becomes a target when it comes into range.

You can override the 'auto target' system by using the action 'Acquire target'. This makes a picked instance into a target (when it is in range at the moment the action is called).

The 'Add object to target' action is typical used once and under a 'on startup' event.

If you divide them in teams by instance variables, the best is to act on the moment that an instance becomes a target. (i think).

Condition > On target acquired
___ Sub Condition > target does belong to team ?
______action > Unacquire target
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: 25games, Ashley, leotardozc, TRMG and 23 guests