Solarus > Development

Prevent attack command from attacking

(1/2) > >>

Porksteak:
Is there to make it so the attack command being pressed stops the hero from attacking? I've tried using on_command_pressed(), on_state_changed() and on_stage_changing() but nothing seems to be working for me.

Diarandor:
To give an adequate answer for your purposes we need to know this: do you want to always disable the sword attack in all your game? Or just temporarily under certain states/conditions?

Porksteak:
Just temporarily depending on if the hero has enough stamina to attack

Max:
Can you post the things you tried? Like the actual code, you said you used on_state_changed() but like, HOW did you use it?

Christopho:
Two solutions:
- Associate the attack command to no keyboard key and no joypad action: game:set_command_keyboard_binding("attack", nil)
Or
- Remove the attack ability: game:set_ability("sword", nil)

Navigation

[0] Message Index

[#] Next page

Go to full version