OsNpcCreate
From OpenSimulator
(Difference between revisions)
(Update Script) |
|||
| Line 6: | Line 6: | ||
key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom, integer options) | key osNpcCreate(string firstname, string lastname, vector position, string cloneFrom, integer options) | ||
| + | |description=*Creates an NPC named '''firstname''' '''lastname''' at '''position''' from avatar appearance resource '''cloneFrom''' | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
| − | // | + | // |
| − | // | + | // osNpcCreate Script Exemple |
| − | // | + | // Authior: djphil |
| + | // | ||
key npc; | key npc; | ||
| − | |||
default | default | ||
{ | { | ||
| + | state_entry() | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osNpcCreate usage."); | ||
| + | } | ||
| + | |||
touch_start(integer number) | touch_start(integer number) | ||
{ | { | ||
| − | vector npcPos = llGetPos() + <1,0,0>; | + | key toucher = llDetectedKey(0); |
| − | osAgentSaveAppearance( | + | vector npcPos = llGetPos() + <1.0, 0.0, 1.0>; |
| − | + | osAgentSaveAppearance(toucher, "appearance"); | |
npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); | npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); | ||
| − | |||
state hasNPC; | state hasNPC; | ||
} | } | ||
| Line 31: | Line 36: | ||
state_entry() | state_entry() | ||
{ | { | ||
| − | + | llSetTimerEvent(5.0); | |
| − | osNpcSay(npc, " | + | } |
| + | |||
| + | timer() | ||
| + | { | ||
| + | llSetTimerEvent(0.0); | ||
| + | osNpcSay(npc, "Hello world!"); | ||
} | } | ||
| Line 38: | Line 48: | ||
{ | { | ||
osNpcSay(npc, "Goodbye!"); | osNpcSay(npc, "Goodbye!"); | ||
| + | llSetTimerEvent(0.0); | ||
osNpcRemove(npc); | osNpcRemove(npc); | ||
npc = NULL_KEY; | npc = NULL_KEY; | ||
| Line 44: | Line 55: | ||
} | } | ||
</source> | </source> | ||
| − | |||
|additional_info= Some more useful info: | |additional_info= Some more useful info: | ||
* NPC stands for Non-Player Character. | * NPC stands for Non-Player Character. | ||
Revision as of 14:38, 30 November 2020
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 | ${OSSL|osslNPC} |
| Extra Delay | 0 seconds |
| Example(s) | |
// // osNpcCreate Script Exemple // Authior: djphil // key npc; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osNpcCreate usage."); } touch_start(integer number) { key toucher = llDetectedKey(0); vector npcPos = llGetPos() + <1.0, 0.0, 1.0>; osAgentSaveAppearance(toucher, "appearance"); npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); state hasNPC; } } state hasNPC { state_entry() { llSetTimerEvent(5.0); } timer() { llSetTimerEvent(0.0); osNpcSay(npc, "Hello world!"); } touch_start(integer number) { osNpcSay(npc, "Goodbye!"); llSetTimerEvent(0.0); osNpcRemove(npc); npc = NULL_KEY; state default; } } | |
| Notes | |
Some more useful info:
| |