OsNpcStopMoveToTarget
From OpenSimulator
(Difference between revisions)
(New page: {{osslfunc |function_syntax=osNpcStopMoveToTarget(key npc) |csharp_syntax= |description=Stop a current move to a target. |threat_level= |ossl_example= |additional_info= }}) |
m (Change See Also) |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{osslfunc | {{osslfunc | ||
+ | |permissions=${OSSL|osslNPC} | ||
|function_syntax=osNpcStopMoveToTarget(key npc) | |function_syntax=osNpcStopMoveToTarget(key npc) | ||
|csharp_syntax= | |csharp_syntax= | ||
|description=Stop a current move to a target. | |description=Stop a current move to a target. | ||
− | |threat_level= | + | |threat_level=High |
− | |ossl_example= | + | |permissions=${OSSL|osslNPC} |
− | |additional_info= | + | |delay=0 |
+ | |ossl_example=<source lang="lsl"> | ||
+ | // | ||
+ | // osNpcStopMoveToTarget Script Exemple | ||
+ | // Author: djphil | ||
+ | // | ||
+ | |||
+ | key npc; | ||
+ | integer move; | ||
+ | integer step; | ||
+ | |||
+ | default | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSay(PUBLIC_CHANNEL, "Touch to see osNpcStopMoveToTarget usage."); | ||
+ | } | ||
+ | |||
+ | touch_start(integer number) | ||
+ | { | ||
+ | key toucher = llDetectedKey(0); | ||
+ | vector npcPos = llGetPos() + <-5.0, -1.0, 1.0>; | ||
+ | osAgentSaveAppearance(toucher, "appearance"); | ||
+ | npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); | ||
+ | state hasNPC; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | state hasNPC | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSetTimerEvent(5.0); | ||
+ | } | ||
+ | |||
+ | timer() | ||
+ | { | ||
+ | if (move == TRUE) | ||
+ | { | ||
+ | osNpcStopMoveToTarget(npc); | ||
+ | llSetTimerEvent(3.0); | ||
+ | move = FALSE; | ||
+ | } | ||
+ | |||
+ | else | ||
+ | { | ||
+ | if (step == FALSE) | ||
+ | { | ||
+ | osNpcSay(npc, "Hello world!"); | ||
+ | step = TRUE; | ||
+ | } | ||
+ | |||
+ | osNpcMoveToTarget(npc, llGetPos() + <5.0, -1.0, 0.0>, OS_NPC_NO_FLY); | ||
+ | llSetTimerEvent(1.0); | ||
+ | move = TRUE; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | touch_start(integer number) | ||
+ | { | ||
+ | llSetTimerEvent(0.0); | ||
+ | osNpcSay(npc, "Goodbye!"); | ||
+ | osNpcRemove(npc); | ||
+ | npc = NULL_KEY; | ||
+ | state default; | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |additional_info=This function was added in 0.7.2-post-fixes | ||
}} | }} | ||
+ | == See Also == | ||
+ | * [[osNpcMoveTo]] | ||
+ | * [[osNpcMoveToTarget]] | ||
+ | * [[osNpcStopMoveToTarget]] |
Latest revision as of 18:55, 5 December 2020
osNpcStopMoveToTarget(key npc)
| |
Stop a current move to a target. | |
Threat Level | High |
Permissions | ${OSSL|osslNPC} |
Extra Delay | 0 seconds |
Example(s) | |
// // osNpcStopMoveToTarget Script Exemple // Author: djphil // key npc; integer move; integer step; default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch to see osNpcStopMoveToTarget usage."); } touch_start(integer number) { key toucher = llDetectedKey(0); vector npcPos = llGetPos() + <-5.0, -1.0, 1.0>; osAgentSaveAppearance(toucher, "appearance"); npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance"); state hasNPC; } } state hasNPC { state_entry() { llSetTimerEvent(5.0); } timer() { if (move == TRUE) { osNpcStopMoveToTarget(npc); llSetTimerEvent(3.0); move = FALSE; } else { if (step == FALSE) { osNpcSay(npc, "Hello world!"); step = TRUE; } osNpcMoveToTarget(npc, llGetPos() + <5.0, -1.0, 0.0>, OS_NPC_NO_FLY); llSetTimerEvent(1.0); move = TRUE; } } touch_start(integer number) { llSetTimerEvent(0.0); osNpcSay(npc, "Goodbye!"); osNpcRemove(npc); npc = NULL_KEY; state default; } } | |
Notes | |
This function was added in 0.7.2-post-fixes |
[edit] See Also
- osNpcMoveTo
- osNpcMoveToTarget
- osNpcStopMoveToTarget