OsNpcCreate
From OpenSimulator
(Difference between revisions)
m |
(A few more additions and clarifications, moving some text out of the description field, and moved it to 'additional info') |
||
Line 33: | Line 33: | ||
touch_start(integer number) | touch_start(integer number) | ||
{ | { | ||
− | osNpcSay(npc, " | + | osNpcSay(npc, "Goodbye!"); |
osNpcRemove(npc); | osNpcRemove(npc); | ||
npc = NULL_KEY; | npc = NULL_KEY; | ||
Line 40: | Line 40: | ||
} | } | ||
</source> | </source> | ||
− | |description=*Creates | + | |description=*Creates an NPC named '''firstname''' '''lastname''' at '''position''' from avatar appearance resource '''cloneFrom''' |
+ | |additional_info= Some more useful info: | ||
+ | * NPC stands for Non-Player Character. | ||
+ | * You can clone an appearance from a saved appearance notecard name or UUID, or from the UUID of an avatar logged into the same region or sim. | ||
+ | *You can create and load appearance notecards with the following functions: [[osOwnerSaveAppearance]], [[osAgentSaveAppearance]], [[osNpcLoadAppearance]], [[osNpcSaveAppearance]]. | ||
| | | | ||
}} | }} |
Revision as of 16: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, "Goodbye!"); osNpcRemove(npc); npc = NULL_KEY; state default; } } | |
Notes | |
Some more useful info:
|