Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Frangible object

Katerina Morgwain
Registered User
Join date: 30 Apr 2008
Posts: 12
11-11-2008 13:17
Use this script to create frangible windows, doors, barricades, walls, home furniture, street furniture, etc. Just crash everything when you're in that mood!

1) create a cube, name it "frangible object"

2) create 3 cubes, resize them to 0.250x0.250x0.250, name them "piece1", "piece2" and "piece3"

3) make them physical and temporary (Edit > Object), pick them up before they selfdelete

4) open your frangible object's inventory, drop in the 3 pieces

5) put into your frangible's object inventory the "Frangible object" script

6) close your frangible object's inventory

7) bump or hit your frangible object


Note: it will take 5 minutes to reset to its original status (of course, you can modify this time in the Frangible Object script)


------------------
Frangible object
------------------
// Based on the Break script by TwoPercent Milk, contained into
// Darjay Serf's target dummy.

float health = 100.0;
// Total object's heatlh points.

default
{
on_rez(integer start_param)
{
llResetScript();
}
// Script is resetted to its default values on object's rezzing
// (state_entry section).

state_entry()
{
llSetAlpha(1, ALL_SIDES);
// This makes your object visible.

llSetStatus(STATUS_PHANTOM, FALSE);
// This makes your object solid.
}

collision_start(integer times)
{
float damage = 33.33;
// Damage value on avatar or object collision.

health = health - damage;

if(health<=0)
{
llSetAlpha(0, ALL_SIDES);
// This makes your object invisible.

llSetStatus(STATUS_PHANTOM, TRUE);
// This makes your object "phantom" (non solid).

llRezObject("piece1", llGetPos(), <llFrand(9) + llFrand(-9),
llFrand(9) + llFrand(-9),
llFrand(9)>,
ZERO_ROTATION, 0);
// Pieces contained into you object will be rezzed around it
// at random positions.
// Be sure that they are temporary prims!

llRezObject("piece2", llGetPos(), <llFrand(9) + llFrand(-9),
llFrand(9) + llFrand(-9),
llFrand(9)>,
ZERO_ROTATION, 0);
// As above; simply change the name according to your
// inventory object, then copy&paste as many times as
// you want your object's pieces to be rezzed.

llRezObject("piece3", llGetPos(), <llFrand(9) + llFrand(-9),
llFrand(9) + llFrand(-9),
llFrand(9)>,
ZERO_ROTATION, 0);

llSleep(300);
// This makes the script sleep for 300 seconds (5 minutes)
// before your object's initial status is restored.

llResetScript();
// Script is resetted and your object's initial status
// is restored (state_entry section).
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
11-12-2008 06:14
:)
_____________________
i've got nothing. ;)
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
11-12-2008 12:20
Please explain what "frangible" means.