| Scripting Discuss scripting for SL and other platforms |
| |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Junior Member ![]() Join Date: Nov 2009
Posts: 3
| Well i'm primarily a builder and have been for about 4 years. I make buildings and such but would like to make it so that when a person walks on the floor - a walking sound is played. I've seen something similar on XStreet but it wasn't full perms and you couldn't even change the sound that was played. Has anybody heard or seen of a script like this and what is it called? Thanks |
| | |
| | #2 (permalink) |
| Senior Member ![]() ![]()
I see what you did there.
Join Date: Oct 2009 Location: Internets
Posts: 114
SL Join Date: 3/16/2009
Business: Red Fedora Productions | HINT: collision_start and collision_end Also, a LOT of people find the gunshot-loudness clip-clop shoes extremely annoying. I'm sure they'll find these floors just as annoying if the noise is played at max volume. Please, for the love of God, make the sound relatively quiet. |
| | |
| 1 User Agreed: |
| | #3 (permalink) | |
| Junior Member ![]() Join Date: Nov 2009
Posts: 3
| Quote:
Thanks i'll bear that in mind. I did find a script that does it but it doesn't loop so i may just not do it after all. | |
| | |
| | #4 (permalink) |
| Free, not cheap ![]() ![]() ![]()
Buttercup without a witty
retort? Huh, imagine that!
| I've found these difficult to use with collision event detection on a floor. Since walking or standing on one behaves almost like a single, constant collision, I often see them triggered only as you hit the floor (collision_start) or leave it (collision_end). @Vengeance I've recently done some scripting for collision detection, avatar position and velocity/speed. Here is a snippet of that handiwork. If the sound file you use is a short clip, it should do: Code: string mySound = "step.wav"; // sound in prim inventory
vector agentVel; // 'avatar' velocity
default
{
collision(integer total_number)
{
agentVel = llDetectedVel(0); // detect the avatar's velocity
if( (llFabs(agentVel.x) > 1.5) || (llFabs(agentVel.y) > 1.5) )
{
llPlaySound(mySound, 0.5);
llSleep(0.4);
}
}
}
). The sleep is in there to cause a break in the multiple collisions occurring. I suggest playing with the duration in the llSleep() function until it fits the sound file's length best. Of course, set mySound to the name of the "walk" sound file that is in the object. Last edited by Free Xue; 11-02-2009 at 01:11 PM. Reason: grammar :) |
| | |
| | #5 (permalink) |
| Free, not cheap ![]() ![]() ![]()
Buttercup without a witty
retort? Huh, imagine that!
| (was moved ) Last edited by Free Xue; 11-02-2009 at 02:03 PM. Reason: thread was moved |
| | |
| | #6 (permalink) |
| Senior Member ![]() ![]()
I see what you did there.
Join Date: Oct 2009 Location: Internets
Posts: 114
SL Join Date: 3/16/2009
Business: Red Fedora Productions | SL physics does not register the individual steps you take on a surface. Your avatar is basically enclosed in a box, so when you're walking over a surface, you're basically dragging the bottom of that box across the surface, producing a long collision event. Some psuedocode for you that may help: On Collision_Start, Start Timer Event end Collision_Start Event On Timer event, Play foot impact sound End timer Event On Collision_End event, Stop timer End Collision_End event |
| | |
| | #7 (permalink) |
| Member ![]()
Rather more than just a pretty
face
Join Date: May 2009
Posts: 34
My Mood: SL Join Date: 17 June 2007 | Gwyneth Llwellyn has an alternative approach to heel-sounds, which is worth considering Gwyn’s Home » Blog Archive » Heel sounds on your shoes |
| | |
| | #8 (permalink) | ||
| Free, not cheap ![]() ![]() ![]()
Buttercup without a witty
retort? Huh, imagine that!
| Quote:
Code: default
{
collision(integer total_number)
{
llSay(0, (string)llDetectedVel(0));
}
}
Your pseudo-code in actual code: Code: string mySound = "step.wav"; // collision sound
default
{
collision_start(integer total_number)
{
llSetTimerEvent(0.5);
}
timer()
{
llPlaySound(mySound, 0.50);
}
collision_end(integer total_number)
{
llSetTimerEvent(0.0);
}
}
Quote:
Code: string mySound = "step.wav"; // collision sound
key ID; // agent ID key;
default
{
collision(integer total_number)
{
ID = llDetectedKey(0);
if ( llGetAgentInfo(ID) & AGENT_WALKING )
llPlaySound(mySound, 0.5);
llSleep(0.5);
}
}
| ||
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |