Author Topic: [FIXED] Simulating a command when the hero is frozen ?  (Read 41 times)

MetalZelda

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
[FIXED] Simulating a command when the hero is frozen ?
« on: June 18, 2017, 11:42:51 pm »
Hello

I ran out with a problem

I am working on cutscenes, that imply the hero to be frozen AND execute basic actions when the cutscene is active
the problem is, you can't simulate a command when the hero is frozen, I've tried to unfreeze him before the action occurs but when loading a spin attack from simulated command and if the player mispress the attack button, the animation is cancelled and the hero can move on it's own depending on the rules given (hero:unfreeze before the action or handling the command)

If the attack command is not pressed then the animation will play fine

I've tried to start a dummy menu like so, I also tried using sol.main:on_key_pressed, same

In this event, your input should do nothing except if a dialog is active ...
Code: Lua
  1. function dummy:on_key_pressed(key)
  2.   return not game:is_dialog_active()
  3. end

But no matter what, even if I delete hero:freeze(), this prevent the hero from moving, but we can still cancel the simulated input, even if this rule (key_pressed) or on_command_pressed has been defined to prevent any input to interrupt the action

Anyone help ?

You can reproduce it simply

Code: Lua
  1. game:simulate_command_pressed("attack")
  2. sol.timer.start(1500, function()
  3.   game:simulate_command_released("attack")
  4. end)
  5.  
« Last Edit: June 18, 2017, 11:47:00 pm by MetalZelda »

MetalZelda

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
Re: Simulating a command when the hero is frozen ?
« Reply #1 on: June 18, 2017, 11:46:44 pm »
Oh well, Haven't seen that the spin attack is canceled when the input is release, which is an event of an input press, this is fixed