How can I pick an instance that is currently being controlled by a Timeline?

Not favoritedFavorited Favorited 0 favourites
  • 7 posts
From the Asset Store
It is currently the most advanced version of the game of ping pong).
  • For example, I have multiple Enemy instances, and I use a Timeline to move one of them. I want to identify/pick that particular Enemy instance.

    The Timeline Controller doesn't have any expressions or conditions for that. As far as I can tell, the scripting API doesn't expose it either.

    Is there a way to pick controlled instance(s) or get their UIDs?

    Tagged:

  • Maybe you could set an instance variable in the timeline that’s normally a different value. Or if you specify the instance at runtime with the “set instance” action you could try to keep track of it then too.

    If you don’t mind a multiple build step approach you could make a tool to parses the timeline information out of the c3p file and sets a json file in the project you can access. Or maybe you could access the exported data file directly and parse out the timeline info from that.

    Scripting wise it may be easier to just request a method to be able to access it from the api.

  • Maybe you could set an instance variable in the timeline that’s normally a different value. Or if you specify the instance at runtime with the “set instance” action you could try to keep track of it then too.

    The idea is that someone else (not a programmer) will be creating the timelines, and I don't want to complicate things for them. Storing instance UIDs or other identifiers in the timeline tracks isn't much different from hard-coding them in events.

    Here is a possible usage scenario: there are multiple NPCs on the layout. Dialogues can trigger various timelines, which may move one or several NPCs or other objects. I need to know which NPCs are currently being moved by timelines so I can update their appearance accordingly.

    Yes, there are workarounds - for example, I could monitor when their position changes and assume it's the result of a timeline. But I don't understand why there is no proper way to pick the instances controlled by a timeline. Why is there a "Set track instance" action, but no "Get track instance"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think most missing things are usually an oversight that a quick feature request could probably remedy.

    So apart from agreeing that such a feature sounds like it could be useful, I don’t have much to add.

  • I think most missing things are usually an oversight that a quick feature request could probably remedy.

    I love Construct but feature requests have historically been excruciatingly slow, even for small requests like this. (Not blaming here, just an observation)

  • The next beta, r500, will include some new conditions to pick all the instances a timeline is using. The scripting API will also be updated with a new "getInstances" method that returns an array of all the instances in a timeline.

    With those additions and using the existing instance tags it will be possible to get any subset you need.

  • Awesome, thank you!

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)