OsNpcCreate
From OpenSimulator
(Difference between revisions)
Line 46: | Line 46: | ||
* You can create and load appearance notecards with the following functions: [[osOwnerSaveAppearance]], [[osAgentSaveAppearance]], [[osNpcLoadAppearance]], [[osNpcSaveAppearance]]. | * You can create and load appearance notecards with the following functions: [[osOwnerSaveAppearance]], [[osAgentSaveAppearance]], [[osNpcLoadAppearance]], [[osNpcSaveAppearance]]. | ||
* '''In current OpenSim development code (from commit c4972e77 on Thu Jan 12 2012), an overloaded version of osNpcCreate() has been added.''' | * '''In current OpenSim development code (from commit c4972e77 on Thu Jan 12 2012), an overloaded version of osNpcCreate() has been added.''' | ||
− | ** This has the signature key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom, | + | ** This has the signature key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom, integer options). |
** The options field can be either OS_NPC_CREATOR_OWNED or OS_NPC_NOT_OWNED. | ** The options field can be either OS_NPC_CREATOR_OWNED or OS_NPC_NOT_OWNED. | ||
** OS_NPC_CREATOR_OWNED will create an 'owned' NPC that will only respond to osNpc* commands issued from scripts that have the same owner as the one that created the NPC. | ** OS_NPC_CREATOR_OWNED will create an 'owned' NPC that will only respond to osNpc* commands issued from scripts that have the same owner as the one that created the NPC. |
Revision as of 16:35, 12 January 2012
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, "Goodbye!"); osNpcRemove(npc); npc = NULL_KEY; state default; } } | |
Notes | |
Some more useful info:
|