// touch to create npc in front of this emitter
// Npc will walk to the toucher, then will greet them.
// touch again to destroy
key npc;
vector toucherPos;
default
{
touch_start(integer number)
{
vector npcPos = llGetPos() + <1,0,0>;
npc = osNpcCreate("Jane", "Bot", npcPos, llGetOwnerKey(llGetKey()));
list rtn = llGetObjectDetails(llDetectedKey(number), [OBJECT_POS]);
toucherPos = llList2Vector(rtn, 0);
state hasNPC;
}
}
state hasNPC
{
state_entry()
{
osNpcMoveTo(npc, toucherPos + <1,0,0>); // This is currently unworkable
osNpcSay(npc, "Hi there! My name is " + llKey2Name(npc));
}
touch_start(integer number)
{
osNpcSay(npc, "Good bye!");
osNpcRemove(npc);
npc = NULL_KEY;
state default;
}
}