0 Favourites

How do I pick instances with differnet instance variables?

  • 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.

    Thank you for your time

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,126
karshinkoff's avatar
karshinkoff
Unread hot topic
0 Favourites
[Plugin] instance bank2
85 18,366
rexrainbow's avatar
rexrainbow
Unread hot topic
56 4,727
MPPlantOfficial's avatar
MPPlantOfficial