In the first situation, you are definitely correct. Costs must be paid before the card can be responded to. Any triggered effects that happen because of that cost will happen still before any response can happen.
In the second situation, the gear's cost is not attaching to the character. The cost is picking the character that it will be attached to. If you kill the character in response to the prototype (in this case with a scrag) the prototype will go to the discard pile. The ability will not trigger because it was never on the character.
STP: Between 27 and 32
1st place WCC
Top 4 Pt. II Invitational
Top 4 GenCon Socal XBox
1st place Open Beta 1.5k
Probably something I forgot...