Bug freezing hero?

Started by Diarandor, August 07, 2015, 06:36:48 PM

Previous topic - Next topic
August 07, 2015, 06:36:48 PM Last Edit: August 07, 2015, 06:41:05 PM by Diarandor
Hi! I am using this code in the script of a map

local map = ...
function map:on_started()
  map:get_hero():freeze()
  sol.audio.play_sound("ok")
end

but the hero does not freeze (the sound plays, so the event is initialized). I suspect this could be a bug of the map:on_started() events. I have tried even with empty maps and nothing happens. This is very strange. Can anyone confirm this is not just me?

EDIT: I was trying to use this to make a cutscene for the intro. But since I don't need to display the hero I will use hero:set_enabled(false) instead of hero:freeze(). Anyway, this could be a problem to make cutscenes where the hero appears and we need to freeze him.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Try to freeze the hero in map:on_opening_transition_finished() instead.

Thanks a lot!!!  With that event it works fine. I had never used it.
So there is no bug.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Another possible bug about freezing the hero: When I tried to freeze the hero when swimming, the swimming animation was replaced by the stopped one. I've attached a screenshot to this post.

Freezed means changing the hero's state, so instead of swimming he does nothing. But you can still change the animation of the sprite.

Anyway, I want to point out that in the map script 0.lua of zsdx you wrote:

function map:on_started(destination)
  hero:freeze()
  ...
end

which does not freeze the hero. Although that's not important at all since you have no weapon at the begining, so no sound will start if you press the action command.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Nice catch :)
So he is not freezed, I did not know. It had no consequence because the game is suspended during this whole map due to dialogs (it is the intro map).