The "firearm" was invented in China in the 13th century for celebration or for signaling.
The Chinese used gunpowder in the following centuries without ever testing it on the battlefield.
In the Medieval period, every kingdom was at war, everyone was fighting against everyone and it was just a mess.
As technology developed a lot of things changed.