OsNpcCreate
From OpenSimulator
(Difference between revisions)
(clarified clonefrom) |
|||
Line 1: | Line 1: | ||
{{osslfunc | {{osslfunc | ||
|threat_level=High | |threat_level=High | ||
− | |function_syntax=key osNpcCreate(string firstname, string lastname, vector position, string | + | |function_syntax=key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom) |
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
// touch to create a NPC clone of the toucher in front of this emitter | // touch to create a NPC clone of the toucher in front of this emitter | ||
Line 16: | Line 16: | ||
vector npcPos = llGetPos() + <1,0,0>; | vector npcPos = llGetPos() + <1,0,0>; | ||
osAgentSaveAppearance(llDetectedKey(0), "appearance"); | osAgentSaveAppearance(llDetectedKey(0), "appearance"); | ||
+ | // coud use avatar UUID directly in osNpcCreate, but then NPC appearance is not persisted | ||
npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); | npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); | ||
toucherPos = llDetectedPos(0); | toucherPos = llDetectedPos(0); |
Revision as of 01:53, 17 August 2011
key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom)
| |
| |
Threat Level | High |
Permissions | No permissions specified |
Extra Delay | No function delay specified |
Example(s) | |
// touch to create a NPC clone of the toucher in front of this emitter // NPC will move to the toucher, then will greet them. // Touch again to remove the NPC key npc; vector toucherPos; default { touch_start(integer number) { vector npcPos = llGetPos() + <1,0,0>; osAgentSaveAppearance(llDetectedKey(0), "appearance"); // coud use avatar UUID directly in osNpcCreate, but then NPC appearance is not persisted npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); toucherPos = llDetectedPos(0); state hasNPC; } } state hasNPC { state_entry() { osNpcMoveTo(npc, toucherPos + <3,0,0>); osNpcSay(npc, "Hi there! My name is " + llKey2Name(npc)); } touch_start(integer number) { osNpcSay(npc, "Good bye!"); osNpcRemove(npc); npc = NULL_KEY; state default; } } |