Forgive me, I'm having a difficult time understanding the concept you're trying to convey.
You want the entity_ids in variable form for the user and the npc?
$userid should return the entity ID of the user who triggered the quest.
if you wanted the entity_id from the quest giver you could do something like:
Code:
my $npc_id = $npc->GetID();
I feel I'm missing something though, could you elaborate? Sorry.