Events - A unit acquires an item
Conditions - Item type of item being manipulated equal to (item1, weapon?) and Hero manipulating item has item of type (item2, gem?)
or
Item type of Item being manipulated equal to (item2) and Hero manipulating item has item of type (item1)
Actions - (Use If then else multiple actions)
If random number between 1 and 2 equal to 1 then do remove item carried by hero manipulating item of type (item1) remove item carried by hero manipulating item of type (item2) create (item3, weapon+1?) and give it to Hero manipulating item (and create a message that the "upgrading" is successful, with text message, floating text, etc...) else do remove item carried by hero manipulating item of type (item2) (and create a message that the upgrading has failed)
(You may also add a special effect when the upgrade is successful)