Hello,
The problem you have is probably related to SCOPE, object picking and object creation. The functions have a scope, itself, and almost everything outside is ignored. So when you call the "spawn_ship" function, it works as expected. But when you call after that the function "set_FactionRed", the latest created SHIP_small instance is out of scope. Also, when you create an object, you can just set up its variables in the first following event scope. When you press F a second time, your function "set_FactionRed" will get al last the first instance of the SHIP_small object type, due to the fact that objects are accessible the next tick they are created (except modifying them just in the same event scope after system => create object). That's why operations in the "spawn_ship" function works correctly but not operations from the "set_FactionRed" function.
I hope it's not confusing...
So what you can do is putting everything in the first function (quick but not very practice), or put the "returnValue" property of your functions with the UID of the nely created object (Object.UID, not ID as it's not reliable) pass it (Function.ReturnValue) to the functions that are following. In these functions, you have to pick the instance by UID first (so in a function, it's with Function.Param(something)) and do the modifications you want.
Not confusing ?
I'm not very good in english for explanations...