Forum rules - please read before posting.

Trigger AC cutscene (or other event) from code?

edited October 2014 in Technical Q&A
I have a puzzle in my game which I needed to write some custom code in order to implement its functionality.

That's all fine and dandy, however I now need to tell the AC engine when this puzzle has been completed by the player so I can trigger the next appropriate part of the flow (like a cutscene or anything else)

Any suggestions or resources of how to do that? Ideally I'd love to use a c# event but I guess I'd have to change AC specific code to subscribe to this event... so maybe there's some other way to do this kind of thing?

Could I set a local/global variable and have AC respond when this happens? Not sure how I could have AC continuously check for the state of a variable though (plus that feels a bit expensive)

Could I expose an AC Cutscene field on my puzzle game manager script and basically just have the code trigger that cutscene when appropriate? That actually sounds like the more elegant option if possible...might look into that while I wait...


  • Right the approach I describe in that last paragraph there seems to *almost* work...

    Took me a while that I need to call Interact() on a cutscene object to trigger it, but now that I figured out the cutscene seems to trigger, as I have a switch camera action and a change player character facing action and those both seem to fire, however I have a bunch of Dialogue actions after that and none of them seems to fire...

    Anyone any ideas what might be going on here?

    I noticed in the manual that there's a concept of gamestates in the AC engine so I wonder if I need to be setting the gamestate manually since I am firing the cutscene from code? Then again I would have thought cutscene.Interact() would be handling that internally?
  • Hmm...definitely something to do with the way I am triggering the cutscene as I tried setting it as an "On Start" cutscene and it works just fine that way...
  • And after checking the StateHandler on the PersistentEngine, it seems that Cutscene.Interact() does indeed set the gameState to Cutscene... 

    Starting to run out of possible culprits now... :/
  • Ok... this is very strange! I had a check in my minigame's update to see when the minigame might be completed and this was spamming the log when this happened. Since I didn't need to be doing that in the update, I moved it to a more appropriate place where it wouldn't be getting called continuously but only when it had to instead. 

    I have no idea how this could be relevant, but this seems to have also fixed the issue of my cutscene not playing properly when triggered from code!

    Oh well... all's well that ends well I guess.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.