Search the Community
Showing results for tags 'vibrating'.
-
Hello! I need to make an object that starts to vibrate when an avatar sits on it and it plays animation. I found such a script of vibration and animation, but how should they be combined together? vibration integer k; integer flip = 1; list params; vector pos; integer link = 0; default { state_entry() { params = llGetLinkPrimitiveParams(link, [PRIM_POSITION]); pos = llList2Vector(params, 0); } touch_start(integer total_number) { if (k = !k) llSetTimerEvent(0.02+llFrand(0.1)); else llSetTimerEvent(0.0); } timer() { llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, pos + ((flip = -flip) * < 0.02, 0.01, 0.01 > )]); } } animation string animation; // the first animation in inventory will automatically be used // the animation name must be stored globally to be able to stop the animation when standing up default { state_entry() { // set sit target, otherwise this will not work llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); } changed(integer change) { if (change & CHANGED_LINK) { key av = llAvatarOnSitTarget(); if (av) //evaluated as true if not NULL_KEY or invalid llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); else // avatar is standing up { if (animation) llStopAnimation(animation); // stop the started animation llResetScript(); // release the avatar animation permissions } } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { animation = llGetInventoryName(INVENTORY_ANIMATION,0); // get the first animation from inventory if (animation) { llStopAnimation("sit"); // stop the default sit animation llStartAnimation(animation); } } } }