Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nahuel on Fri 02/09/2022 11:03:44

Title: Reuse script for all rooms avoiding repetition (room_AfterFadeIn)
Post by: Nahuel on Fri 02/09/2022 11:03:44
Hi everyone, I hope you are doing well  :smiley:

My problem:
- Create a cutscene that shows other chars interacting on several different roms
- the main character is not present during the cutscenes
- this is launched when an item of the invertory is used (book)
- can be used anywhere everywhere.
- the main char should say a text after "reading" the book

My approach (working but don't like it):
  - created a global variable bool EndCutsceneon (GlobalVariables)
  - at the end of all cutscenes set EndCutscene = true;
  - For EACH room (because the player can interact with a specific item in any room at any time), I've added the text needed to say "this is really interesting story!" under room_AfterFadeIn()

Is there a better way to reuse it globally?
I tried for repeatdly exectute checking the variable but the text is said while the fade is being doing and the player can skip this.

Thanks for your time.
Title: Re: Reuse script for all rooms avoiding repetition (room_AfterFadeIn)
Post by: Matti on Fri 02/09/2022 14:16:17
Quote from: Nahuel on Fri 02/09/2022 11:03:44
Is there a better way to reuse it globally?
I tried for repeatdly exectute checking the variable but the text is said while the fade is being doing and the player can skip this.

Too bad there's only eEventEnterRoomBeforeFadein available as an event type for the on_event function.

It should work with repeatedly execute though if you check IsInterfaceEnabled() before saying the line, because the interface should be disabled while the screen fades in.
Title: Re: Reuse script for all rooms avoiding repetition (room_AfterFadeIn)
Post by: Nahuel on Fri 02/09/2022 14:28:49
Quote from: Matti on Fri 02/09/2022 14:16:17

Too bad there's only eEventEnterRoomBeforeFadein available as an event type for the on_event function.

It should work with repeatedly execute though if you check IsInterfaceEnabled() before saying the line, because the interface should be disabled while the screen fades in.

Will check that! Thanks for your reply! Will post some results.
Title: Re: Reuse script for all rooms avoiding repetition (room_AfterFadeIn) | [Solved]
Post by: Nahuel on Fri 02/09/2022 14:33:29
Excellent, thanks Matti that did the trick, thanks again!
Title: Re: Reuse script for all rooms avoiding repetition (room_AfterFadeIn)
Post by: Crimson Wizard on Fri 02/09/2022 16:38:55
There's event eEventEnterRoomAfterFadein added in 3.6.0 beta.
Title: Re: Reuse script for all rooms avoiding repetition (room_AfterFadeIn)
Post by: Matti on Fri 02/09/2022 19:34:19
Quote from: Nahuel on Fri 02/09/2022 14:33:29
Excellent, thanks Matti that did the trick, thanks again!

You're welcome.

Quote from: Crimson Wizard on Fri 02/09/2022 16:38:55
There's event eEventEnterRoomAfterFadein added in 3.6.0 beta.

Cool, good to know!