// touch to create npc in front of this emitter // Npc will walk to the toucher, then will greet them. // Touch again to remove the NPC // http://opensimulator.org/wiki/OSSLNPC // http://opensimulator.org/wiki/OsNpcCreate // http://opensimulator.org/wiki/OsNpcRemove // http://opensimulator.org/wiki/OsNpcMoveTo // http://opensimulator.org/wiki/OsNpcSay string npcNoteCard = "NPC Appearance"; key npc; vector toucherPos; default { state_entry() { llSetText("",<0.6,0.6,0.6>, 1.0); } touch_start(integer number) { vector npcPos = llGetPos() + <1,0,0>; llSay(0,(string)llDetectedKey(number)); //if (llDetectedKey(0) == llGetOwner()) { osAgentSaveAppearance(llDetectedKey(0), npcNoteCard); npc = osNpcCreate("ImYour", "Clone", npcPos, npcNoteCard); // below for specific logged in avatar cloning via UUID // npc = osNpcCreate("ImYour", "Clone", npcPos, "e24a9015-f5ca-452b-8c95-d32e34cb9d64"); // below or temp copy of NPC without saving appearance // npc = osNpcCreate("ImYour", "Clone", npcPos, llGetOwnerKey(llGetKey())); toucherPos = llDetectedPos(0); state hasNPC; } //else llSay(0,"Sorry, I only make NPCs for "+llKey2Name(llGetOwner())+"\n You are "+llKey2Name(llDetectedKey(number))); // } } state hasNPC { state_entry() { osNpcMoveTo(npc, toucherPos + <3,0,-5>); // -5 to make sure it lands - if avatar is on land // osNpcSay(npc, "Hi there! My name is " + llKey2Name(npc)+". I am (s)he as you are (s)he as you are me and we are all together."); } touch_start(integer number) { // osNpcSay(npc, "Good bye!"); // osNpcRemove(npc); // npc = NULL_KEY; state default; } }