What I dont understand is how the message gets converted into numbers
Any way the sender chooses. It's unlikely you'll be able to guess the numbers on the first try, but by looking for similarities across all messages you'll start to suspect patterns.
For instance, let's look at the example from the OP:
Team A has the words "pig" "toaster" "cup" "engine". The message to transmit is "4,2,1". a player might post the words "car, bread, pink". Their opponents guess that the message might be 1,2,3. This is wrong, so the other player on team A gets to decode. She says "4,2,1". The gamemaster than confirms that the message is correct.
Team B has no real way to know what the message is on the first try, because they have no data. But once Team A is confirmed to be correct, they know:
1 is connected to the word "pink"
2 is connected to the word "bread"
4 is connected to the word "car"
Those are clues! And let's say next round, the message is "1, 3, 2". Team A then posts the phrases "bacon, tea, butter." Team B also guesses wrong, and Team A guesses right. Team B now knows the following:
1 is connected to the words "pink" and "bacon"
2 is connected to the words "bread" and "butter"
3 is connected to the word "tea"
4 is connected to the word "car"
So when on the third round, Team A gets the message "3, 4, 2", and posts the words "porcelain, gas, electricity," Team B has some suspicions. "Porcelain" might be related to a tea pot, and cars use "gas". "Electricity" is still a weird one, but if you HAVE to choose between "pink bacon" and "bread butter," maybe bread butter refers to breakfast or something? So they might well guess the right message despite not knowing exactly what the enemy cipher is.