OsNpcCreate

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 7: Line 7:
 
|
 
|
 
ossl_example = <source lang="lsl">
 
ossl_example = <source lang="lsl">
default
+
// touch to create npc in front of this emitter
{
+
// touch again to destroy
 +
 
 +
key npc;
 +
 
 +
default
 +
{
 
     touch_start(integer number)
 
     touch_start(integer number)
 
     {
 
     {
      key npc;  
+
        vector npcPos = llGetPos() + <1,0,0>;
      npc = osNpcCreate("Jane", "Bot", <100,100, 40>, "c40457e2-6e89-4bca-ab4e-d781db63616a");    
+
        npc = osNpcCreate("Jane", "Bot", npcPos, llGetOwnerKey(llGetKey()));
 +
        state hasNPC;
 
     }
 
     }
}
+
}
 +
 
 +
state hasNPC
 +
{
 +
    touch_start(integer number)
 +
    {
 +
        osNpcRemove(npc);
 +
        npc = NULL_KEY;
 +
        state default;
 +
    }
 +
}
 
</source>
 
</source>
 
|  
 
|  

Revision as of 05:02, 30 June 2011

key osNpcCreate(string firstname, string lastname, vector position, key cloneFrom);
No descriptions provided
Threat Level High
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
// touch to create npc in front of this emitter
// touch again to destroy
 
key npc;
 
default
{
    touch_start(integer number)
    {
        vector npcPos = llGetPos() + <1,0,0>;
        npc = osNpcCreate("Jane", "Bot", npcPos, llGetOwnerKey(llGetKey()));
        state hasNPC;
    }
}
 
state hasNPC
{
    touch_start(integer number)
    {
        osNpcRemove(npc);
        npc = NULL_KEY;
        state default;
    }
}
Notes
*This function creates a NPC(Non Player Character) clone from an already existing avatar UUID Key.
  • Note: This function may not work as you have intended. See Mantis #5148 for more information.
Personal tools
General
About This Wiki