This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

OSSL BEFEHLE zur NPC ANIMATION
#1
OSSL BEFEHLE zur NPC ANIMATION

Dieser Artikel ist Teil einer Serie von OSSL Befehlen zur NPC Nutzung in Openim.
Ich habe die Befehle Thematisch gegliedert:

Hier die Befehle zur NPC Animation:

osNpcPlayAnimation, osNpcStopAnimation, osNpcSit, osNpcStand, osNpcTouch


Zunächst ein Wort vorab.

NPCs können auf verschiedenen Arten animiert werden.
NPCs lassen sich auch über Avatar Animations-Befehle (auf Posern) animieren.

Alle Möglichkeiten die Avataren zur Verfügung stehen (mittels Poser, Fahrzeugen, etc) sind verfügbar, werden hier aber nicht beschrieben.
Allerdings unterliegen NPCs Einschränkungen gegenüber Avataren: Sie können nicht über Simgrenzen bewegt werden!!! (Stand 11.2021).
Zudem können sie keine Dinge per Attach anziehen. Beispielsweise einen Besen beim Start einer Kehr Animation in die Hand anziehen geht nur beim Avatar.
Beim NPC benötigt man dafür eine weitere Appearance Notecard bei der der Besen bei der Erstellung angezogen war. dann werden die „Erscheinungen“ ausgetauscht.

Will man die NPCs jedoch nicht in Abhängigkeit von Sitzen auf Posern animieren so dienen folgende Befehle:

Dies entsprechen teilweise der bei Avataren per Tastatur Eingabe ausgelösten Bewegungen (sitzen, aufstehen, etwas berühren).






Animation eines NPCs starten

osNpcPlayAnimation(key npc, string animation)

Plays animation on the NPC identified by their key.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Spielt eine Animation an dem NPC ab (sofern die Priorität der neuen Animation höher als die der Alten ist).
Da mehre Animationen additiv abgespielt werden können, ist auf Überlappung und Priorität zu achten.
Bereits laufende Animationen die nicht mehr benötigt werden, sind mit osNPCStopAnimation zu stoppen.
Ob die alte Animation vor Start der Neuen gestoppt wird, oder danach ist abhängig vom Einsatz.

Beide Methoden haben ihre Vor- und Nachteile:
Zuerst Stoppen, dann Starten geht zuverlässig, aber es kann dazwischen Rucken oder Unterbrechung in der Bewegung geben.
Umgekehrt ist die Funktion Prioritäts abhängiger.

Beispiel:
osNpcPlayAnimation(npc, animation);






Animation eines NPCs stoppen

osNpcStopAnimation(key npc, string animation)

Stops an animation that is being played by the NPC identified by their key.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Stoppt eine laufende Animation. Dazu muss die Animation bekannt sein. Es gibt Standard Animationen mit den Namen „sit“ wenn man sich auf ein Sittarget setzt. Und „stand“ wenn man aufgestanden ist.

Beispiel:
osNpcStopAnimation(npc, animation);







NPC auf Sitz (sit target) / Objekt setzten


osNpcSit(key npc, key target, integer options)

Makes an NPC sit on an object.
Options - OS_NPC_SIT_NOW. Makes the npc instantly sit on the prim if possible.
This is the only option available and is currently always on no matter what is actually specified in the options field
If the prim has a sit target then sit always succeeds no matter the distance between the NPC and the prim.
If the prim has no sit target then
If the prim is within 10 meters of the NPC then the sit will always succeed.
At OpenSimulator 0.7.5 and later, if the prim is further than 10 meters away then nothing will happen.
Before OpenSimulator 0.7.5, if the prim is further than 10 meters away then the avatar will attempt to walk over to the prim but will not sit when it reaches it.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Dient dazu den Avatar auf ein Objekt mit/ohne Sit Target zu setzten, zum Beispiel auf einen Poser.

- key ist der Key/UUID des NPCs.
- target ist die UUID des Objektes auf das sich gesetzt werden soll.
- options ist aktuell nur „OS_NPC_SIT_NOW“ verfügbar.
- Laut Beschreibung ist der Erfolg des Sitzbefehls abhängig von der Distanz zum Objekt auf das gesetzt werden soll, wenn nicht per Script Befehl ein explizites Sit Target ausgewiesen wurde.

Beispiel:
llSitTarget(<0.3, 0.0, 0.55>, ZERO_ROTATION);
osNpcSit(npc, llGetKey(), OS_NPC_SIT_NOW);

Anmerkung:
Mit llGetKey() wird die eigene UUID des Prims ermittelt in dem das Script untergebracht ist.
Somit setzt sich der NPC auf das Objekt das dieses Script enthält.

Faktisch wird der NPC ein Child Prim mit der größten Linknummer des Objektes auf dem es sich hinsetzt.
Zusätzlich wird die Basisanimation „stand“ beendet und „sit“ gespielt.







NPC von Sitz (sit target)/ Objekt aufstehen lassen

osNpcStand(key npc)

Makes a sitting NPC stand up.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Der NPC mit der UUID/key "npc" steht auf.

Faktisch wird die Verlinkung mit dem Sit Prim aufgehoben, und der NPC wieder ein eigenständiges Objekt.
Zusätzlich wird die Basisanimation „sit“ beendet und „stand“ gespielt.

Beispiel:     osNpcStand(npc);







Einen NPC ein Objekt berühren lassen


osNpcTouch(key npcKey, key objectKey, integer linkNum)

Only LINK_THIS and LINK_ROOT are valid for this function. Any other of the LINK_* constants will be ignored and no touch takes place.
1. If linkNum is LINK_THIS then the prim with the key objectKey will be touched.
2. If linkNum is LINK_ROOT or 0 then the root prim of the link set will be touched, even if the root prim key is not objectKey
3. For any other value of linkNum a search will be made through the linkset for a prim with that link number. If found that prim will be touched. If no prim is found for that link number the function fails silently and no touch takes place.
The touch is fired as if it came from an old client that does not support face touch detection or (probably) one of the text clients like Metabolt. Since there is no mouse the llDetectedTouch* functions will return the defaults (See the LSL Wiki for full details)
llDetectedTouchBinormal TOUCH_INVALID_VECTOR
llDetectedTouchFace TOUCH_INVALID_FACE
llDetectedTouchNormal TOUCH_INVALID_VECTOR
llDetectedTouchPos TOUCH_INVALID_VECTOR
llDetectedTouchST TOUCH_INVALID_TEXCOORD
llDetectedTouchUV TOUCH_INVALID_TEXCOORD
If the prim is not found or would not allow a normal client to touch it then this function fails silently.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Der mit npcKey beschriebene NPC , berührt das Objekt objectKey an der angegebenen Linknummer linkNum.

Parameter Beschreibung:

key npcKey       =  Key/UUID des NPCs
key objectKey   =  Key/UUID des Objektes das berührt werden soll.
integer linkNum =  Linknummer des mit objectKey beschriebenen Objektes das berührt werden soll.

als Eingabe für Linknummer kann neben der Echten Linknummer auch folgendes angegeben werden:
- "LINK_THIS"  :  das Prim in dem dieses Script sich befindet
- "LINK_ROOT" : das Root Prim des Objektes in dem sich dieses Script (eventuell im Sub Prim) befindet

Beispiel:     osNpcTouch(npc, llGetKey(), LINK_THIS);

Die Berührung wird die Touch Events triggern das per Script in dem angefassten Objekt wiederum ausgewertet werden kann.
Beispiel: der NPC fasst einen Türe an: 

In der Türe findet sich dann etwas in dieser Art:

    touch_start(integer number)
    {
        {
            llSay(0,“Wer klopft da draussen und will rein?“);
        }
    }








Weitere Befehle sind in anderen Artikeln behandelt um die Übersichtlichkeit zu wahren.
Die Original Infos in Englisch findet ihr hier:

http://opensimulator.org/wiki/Scripting_Documentation
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste