You are touching on two different problems in philosophy of mind, the hard problem of consciousness and the problem of freewill.
Sentience is the capacity to feel, perceive, or experience subjectively, according to Wikipedia, and if (in this case) an NPC can be programmed to perceive and experience subjectively, is there a way for it to 'feel'? Obviously programs can't feel emotions, but they could be programmed to be aware of things, such as a touch, and hence to feel, in that aspect.
Here you are touching upon the hard problem of consciousness, made famous by David Chalmers. Chalmers posits that currently no physicalist or functionalist theory of the mind can provide and explanation of why consciousness is the way it is. A physicalist theory of the mind can tell you that pain is the firing of certain neurons, and a functionalist theory can tell you what types of behavior and mental states correlate with pain, but neither of them can address the question of "What it's like to feel" pain.
The problem is still considered an open one, but there has been attempts to "solve" it, most notably Higher Order Theories of consciousness. The general approach of such theories is the following:
- There are first order mental states: These are the perceptions (i.e. signals from the outside world), sensations and emotions in themselves.
- There are higher order mental states: These are mental states about other mental states, including first order mental states.
Both sentient and none sentient beings can see a red apple - i.e. they can have a first order mental state corresponding to apple. For a Sentient being to be conscious of the red apple, it is not enough to have a mental states corresponding to a red apple, but also to have a higher order mental state which corresponds to 'being aware of there being a red apple'. In information processing terms, the system has to store a representation of the red apple, and a second representation of the act of being aware of the red apple.
Closely related to Higher Order Theories of consciousness are Self-Representational Theories of Consciousness, of which the most well known account is given by Douglas Hofstadter in his books "Godel, Escher and Bach", and "I am a Stange Loop". Here self-awareness, or sentience, is characterize by information processing systems capable of representing themselves, i.e. or storing and manipulating symbols that represent themselves. Hofstadter call this a strange loop. A conscious "I" emerges in systems that are rich enough to process a representation of themselves, the key is the ability for self-reference, which instead of leading to paradox is what leads to the emergence of consciousness.
AS I mentioned earlier, the hard problem of consciousness is still considered an open question by many, and not everyone agrees that Higher Order and Self-Representational theories solve the dilemma. But they do provide one avenue to your question.
Do things such as NPC's qualify as "creatures", since they are acting only off of preprogramming?
Here you are touching on the problem of freewill: A libertarian (one who believes in absolute freewill) would say that such an NPC didn't have freewill and therefore didn't qualify as truly sentient. A compatibilist, believes that agent has freewill as long as it is free to act according to its own internal motivations. In the case of your preprogrammed NPC, they have freewill according to compatibilists, since they are acting according to their own internal motivation, instead of being driven by outside forces. Whether, a compatibilist would make the next step of saying that your NPC is therefore sentient or not depends on who you ask. Daniel Dennett a well know compatibilist would say "yes they do", since he believes that strong AI and sentient robots are possible.