OsNpcCreate
From OpenSimulator
(Difference between revisions)
BillBlight (Talk | contribs) |
BillBlight (Talk | contribs) |
||
Line 46: | Line 46: | ||
|description=*Creates an NPC named '''firstname''' '''lastname''' at '''position''' from avatar appearance resource '''cloneFrom''' | |description=*Creates an NPC named '''firstname''' '''lastname''' at '''position''' from avatar appearance resource '''cloneFrom''' | ||
|additional_info= Some more useful info: | |additional_info= Some more useful info: | ||
− | |||
* NPC stands for Non-Player Character. | * 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 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. | ||
Line 60: | Line 59: | ||
* Use OS_NPC_SENSE_AS_AGENT option if you would like for the created NPC to be able to be detected via a sensor and want to maintain llSensor() compatibility with type AGENT. | * Use OS_NPC_SENSE_AS_AGENT option if you would like for the created NPC to be able to be detected via a sensor and want to maintain llSensor() compatibility with type AGENT. | ||
* OS_NPC_OBJECT_GROUP with it the npc will be created with the group of the object with the script, if that object owner is member of that group. This should allow parcel access by group to work now, and not much else. The group Title will also be set, it the region option NoNPCGroup is not active. | * OS_NPC_OBJECT_GROUP with it the npc will be created with the group of the object with the script, if that object owner is member of that group. This should allow parcel access by group to work now, and not much else. The group Title will also be set, it the region option NoNPCGroup is not active. | ||
+ | *This function was added in 0.7.3-post-fixes | ||
}} | }} |
Revision as of 22:24, 25 November 2018
key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom)
key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom, integer options) | |
| |
Threat Level | High |
Permissions | ${XEngine|osslNPC} |
Extra Delay | 0 seconds |
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:
|