Unit uses 1 item with different ways

hi guys,i have one unsolved question.

how can I make an item that can be used in different ways (for example, a sword that can be swung twice, and a third time to fire a projectile)