Thursday, October 11, 2007

Cough Cough...is that you Coffin?

So Halloween is upon us Muahahaha!! Time to get creepy!Let’s make a coffin with a crazy sounds and rattling lid.
This little guy has 2 scripts in it one for a looped creepy sound and the other for the lid that moves around.
I used textures from the Haven of course to make it that old wood texture and a shiny metal on the brackets that *Hold* down the lid along with a couple of marbles to make the stone.



First we will make the base (slab) of the whole set up. Just rez a box and use these measurements.
Size (meters)
X 4.689
Y 2.372
Z .236




Simple enough, lets move on to the *coffin box* portion, it’s actually in two pieces the top and the bottom. (where your head goes and feet)
Select the box you just made and hold the Shift button and pull up on the blue mouse arrow to make a duplicate of the base.
Now we will change it with these measurements to make the bottom part of the coffin box.
Size (meters)
X 1.00
Y .500
Z 2.205

Rotation (degrees)
X 0
Y 90
Z 270

Taper
X .35




Did you get that shape like above? If not then Booooooooo :(

Lets to the top part of the coffin box now, just select the box you just made and click the Red arrow and hold the shift key and move your duplicate out, we will change the measurements to this:
Size (meters)
X 1.330
Y.500
Z .500

Rotation (degrees)
X 0
Y 270
Z 90

Taper
X .35



Did you get the shape like above? If so, then ghoul!! :D


Now for the brackets of the coffin, its three pieces two vertical *posts* and a horizontal *bar*.
We will make one select it as a whole and copy via the arrow trick and make three. You can adjust these as you wish in your placement. I just made mine caddy whompus to give it that creepy look.

The *post* part measurements are:
Size (meters)
X .031Y .029Z .757

Now how hard is that?

Now for the horizontal *bar* part of the bracket the measurements are.
Size (meters)
X .085
Y 1.165
Z .047

Rotation (degrees)
X 0
Y 0
Z 351




Do the copy arrow trick on the vertical post. Select the Green arrow hold the shift key and make a duplicate of the post and position it on the opposite end of the horizontal bar.



Now we have the brackets built but we need three to place along the coffin box so what you do is click all three parts of the bracket and do the copy arrows trick once more holding the shift key and clicking Red arrow just slide out and make a duplicate of the bracket then do it once more.


Now for the headstone, rez a box and do these measurements
Size (meters)
X 1.918
Y 1.187
Z .736

Rotation (degrees)
X 0
Y 90
Z 0

Wow, now that was easy!




Now the rounded portion of the tombstone, rex a cylinder and use these measurements
Size (meters)
X .884
Y 1.191
Z .737

Rotation (degrees)
X 0
Y 90
Z 0

Path Cut Begin and End
B .250
E .750


Put those two together as if they were the tomb stone.

Now the lid

Just do the arrow trick on the Bottom and top of the coffin box and narrow it down to

X 100






We will put a bounce script in that part and link the two together.





*The looped sound sript*
This script will take any sound you have just put it in the Contents of the slab on the tomb stone along with any creepy sound. Mines says *heeeelllllppp meeeeeeeee!!* with a few knocks.


integer listenChan = 1; // Change to desired channel for chat commands


float soundVolume = 1.0; // Volume of the sound (0.0 - 1.0)
integer on = FALSE;

string soundName;
default

{

state_entry()

{

soundName = llGetInventoryName( INVENTORY_SOUND ,0 );

llListen(listenChan, "", NULL_KEY, "");

}
touch_start( integer t )

{

if ( on )

{

on = FALSE;

llStopSound();

}

else

{

on = TRUE;

llLoopSound( soundName, soundVolume );

}

}
listen(integer channel, string name, key id, string message)

{

if (message = "on")

{

on = TRUE;

llLoopSound(soundName, soundVolume);

}

else if (message = "off")

{

on = FALSE;

llStopSound();

}

}

}





*Bounce* this goes into the linked part of the lid. I picked the bottom or larger part of the lid to put the script in. This has to be seperate than the whole coffin because its animated on its own. So you can link the the pieces of the lid together but they can not be a part of the main coffin.




//speaker bounce 0.1
float bounceTime = 0.25;

vector originalPos;

vector newPos;


default

{

state_entry()

{

originalPos = llGetLocalPos();

llSetTimerEvent(bounceTime);

}


timer()

{
// if (bounceTime == 0.25)

{

// llOwnerSay("bounce");

// bounceTime = 0.01;

newPos = originalPos - <0,>;

llSetPos(newPos);

// }

// else {

// llOwnerSay("beat");

// bounceTime = 0.25;

newPos = originalPos;

llSetPos(newPos);

// }
}

}
So there you go a rattling coffin with crazy sounds.
Ohhh spooky!

No comments:

Post a Comment