Author Topic: Cutscene builder bug  (Read 291 times)

boaromayo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • | boaromayo
Cutscene builder bug
« on: February 20, 2019, 01:04:06 pm »
I'm using std::gregwar's cutscene builder for my game, and for some reason, this error pops up whenever .hero_start_treasure() is called:

Quote
Error: In timer callback: [string "scripts/maps/cutscene.lua"]:252: bad argument #2 to start_treasure (integer expected, got function))

I tried using different arguments to call that function, but that same error prompt still pops up.

Here's snippets of my cutscene code:

Code: [Select]
function map:cutscene()
    -- Some other code here...
    .set_direction(hero,0)
    .dont_wait_for.hero_animation("walking")
    .movement(
      {
        type = "target",
        entity = hero,
        properties = {
          speed = 80,
          target = {124,200},
          smooth = true,
          ignore_obstacles = true
        }
      })
    .dont_wait_for.hero_animation("stopped")
    .wait(500)
    .hero_start_treasure("prison_key", 1, "prison_key_get") -- This is where an error is triggered.
    .exec(game:set_value("main_story", 2))
    -- More code below...

Could this be a bug in the cutscene builder?

stdgregwar

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Cutscene builder bug
« Reply #1 on: February 20, 2019, 02:11:27 pm »
Hi boaromayo,

Glad to see you found some use for this old little helper. Where did you found it ? On the forum ?

The fact is that it is no more maintained because Solarus 1.6 can use coroutines to express this kind of asynchronous behaviour.
So yes this could be a bug... but it won't be fixed as  far as i'm concerned.

The new way to write cutscenes (among other things) easily is to use `coroutine_helper.lua` from the free-resource-pack. (https://gitlab.com/solarus-games/solarus-free-resource-pack/blob/dev/data/scripts/coroutine_helper.lua)

This will allow you to write cutscene even more easily.

Best

boaromayo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • | boaromayo
Re: Cutscene builder bug
« Reply #2 on: February 20, 2019, 02:47:35 pm »
Hey, gregwar, thanks for the quick response!

I found the cutscene builder in this forum post here. It's been so helpful in putting my scenes together!

Also, thanks for the coroutine helper script!

Looks like I'm going to have to do rewrites now that that script is no longer going to be updated...

EDIT: Btw, can the coroutine helper be expanded to have more features, such as freezing or unfreezing the hero, or having the camera move to a certain location on the map? Plus, does this script only work on Solarus 1.6?
« Last Edit: February 20, 2019, 03:44:40 pm by boaromayo »

stdgregwar

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Cutscene builder bug
« Reply #3 on: February 20, 2019, 05:28:46 pm »
Quote
EDIT: Btw, can the coroutine helper be expanded to have more features, such as freezing or unfreezing the hero, or having the camera move to a certain location on the map? Plus, does this script only work on Solarus 1.6?

Coroutine helper works very differently of cutscene builder. Whereas in cutscene_builder the only actions you could do were things allowed by the script, in coroutines you can call any engine function during the cutscene as long as they do not require waiting. (hero:freeze() for example). For the engine features that take a callback you can use wait_for to suspend the coroutine until the callback is called. I hope this is clear. If you need more help you can ask questions on the discord server.

Happy Making!

boaromayo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • | boaromayo
Re: Cutscene builder bug
« Reply #4 on: February 20, 2019, 10:28:35 pm »
I managed to do a workaround using the cutscene builder, and the cutscene worked smoothly.

Thanks for the help anyway!