Would it be possible to create a 2-handed weapon that changes form when you use a special attack? It would change the primary attack and the appearance of the weapon. If it requires advanced lua skills, then I give up, but maybe there is a way to do it without messing with core files?
There is a charging gun in game. You can replace image of the loading gun to another one but after special shoot it becomes 1st one again. I think this is only way to do that without custom .lua
You could try checking the Elithian Races mod. The unique Legion sword changes between a regular blade and a rifle, with the alt cycling between the two forms.