bonjour aide script animation sound avec timer

Répondre
Partager Rechercher
Bonjour ,

J'ai un script que je met dans un prim avec mon animation , mais j'aimerais pouvoir y intégrer quelques modif que je ne sais faire apparemment ^^

J'aimerais savoir si en mettant dans mon prim une animation et un son il est possible que quand je porte le prim il joue mon animation et le son en même temps que l'animation avec un timer style toute les 30 secondes .
Eventuelement que je puisse mettre uuid animation et sound a la place des animation dans l'objet .

je met mon script si jamais une personne a une lumière ^^

merci d'avance


string gAnimName = "anim";

default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // ask the owner for permission to trigger animations
llSetTimerEvent(0.5);//I added this line.
//llStartAnimation(gAnimName);

}

on_rez(integer param)
{
llResetScript(); // reset the script as soon as it starts.
}

attach(key id)
{
integer perm = llGetPermissions();

if (id != NULL_KEY) // make sure we're actually attached.
{
if (! (perm & PERMISSION_TRIGGER_ANIMATION)) // remember to use bitwise operators!
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // request permissions from the owner.
}
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation(gAnimName); // stop the animation

}
}
}
timer()
{
llStopAnimation(gAnimName);
llStartAnimation(gAnimName);
}
}

Dernière modification par gxkill ; 19/11/2020 à 11h35.
hellow, essaye ça.....petite remarque, on ne peut jouer une anim par l' UUID que si c 'est une anim LindenLab du jeu.....




string sound = "e9a4866a-6c0b-52da-9d19-1410538ade8e";//mettre UUID ici
string anim; //mettre nom de l' anim contenue dans l' inv ici, sinon le script prend la premiere anim trouvée dans l' inv du prim

float duree = 5.0;//temps en secondes de l' anim et du son
float temps = 30.0;//temps entre deux anims

default
{
state_entry()
{
anim = llGetInventoryName(INVENTORY_ANIMATION,0);
}

attach(key id)
{
if (id)
{
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}
else
{
llStopAnimation(anim);
llStopSound();
}
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llSetTimerEvent(0.1);
}
}

timer()
{
llStartAnimation(anim);
llPlaySound(sound,1.0);
llSleep(duree);
llStopSound();
llStopAnimation(anim);
llSetTimerEvent(temps);
}

changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}
}
super Menthal , enorme merci j'ai pu arranger cela a ma sauce

Autre petite question si jamais ^^ je voudrais aussi faire une version avec un bouton comme un bouton de hud quand quand je clic il joue l'animation et le son une fois et s’arrête tout seul , l'animation marche le son aussi mais je suis le seul a entendre le son , sais tu comment je peut palier a cela ? je te met mon script si jamais tu a une idée


* dans mon bouton hud j'ai mis l'animation et le son

default
{
touch_start(integer detected)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("Animation"); // you can also copy and past a UUID here from your inventory
llPlaySound("Sound",1.0);
llSetTimerEvent(5.0); // 5 seconds, in this case
}
}
timer()
{
llSetTimerEvent(0.0);
llStopAnimation("Animation"); // Must match the name or UUID of the animation you started
llStopSound();
}
}
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés