Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script for a shooting target

Stringless Banjo
Registered User
Join date: 28 Feb 2005
Posts: 1
02-28-2005 01:03
Can anybody help?

im making a shooting gallery and simply need a script for it. i just want a few targets that move about, and when hit i would like physics enabled. After a few seconds the object should disappear, then a few seconds later it should appear again, moving about like how it originally was.

Im new to SL and have no idea where to start for this. i have experience editing exhisting scripts and all, but i cant find any scripts like this anywhere.

I really appreciate your help and will put your name in the credits above mine or something.

(EDIT: when i say shooting target i mean a target to shoot at, it doesnt need to fire back.
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
Hmm... Try this, mebbey?
03-02-2005 01:25
Hhhmmm... Weelll, while I'm less than 1/2 awake, and won't torture you by trying to write out a script that I'm sure wouldn't compile.... Or wait, actually, I will. ;)

I think you can accomplish (translation : get somewhere in the ballpark of) what your trying for by:

CODE
default
{
collision(integer num_detected)
{
// Something collided with me. For simplicity sake we'll assume it was "the" gun and not some other gun or... a pet tortoise, a flying watermellon, my cousin, some obscenely oversized piece of anatomy that could only exist in SL and doesn't belong in a PG area... God only knows what else... :P
llSetAlpha(0,ALL_SIDES);
// Turn this object invisible. Or, make it "vanish" then "reappear".
llSleep(5);
// 5 seconds later, make it "reappear"
llSetAlpha(100,ALL_SIDES);
llSay(123,"I've been hit! Man Down! Man Overboard! Go red team go!");
// Guessing that you want a scoreboard or some kind of "result" other than /just/ making the object vanish and then reappear... You'd put it here... This example just says "I've been hit...blah blah..." on channel 123 - Then we'd have a listen function on the scoreboard that listens for this particular command on this particular channel and awards "points". Or giant flying watermellon. Or pet tortoise-flavored biscuits. Or my damnedable crazy cousin... Or, you get the idea...
}
}


That's the quickest way that springs to mind at 4AM, my brain swimming with cold medication... You could also use one of the llDetected* functions to make sure that the object colliding is your bullet and not an AV or something else... And change llSay(123,"Blarg";); to whatever you want to communicate "I've been hit", "You sunk my battleship!" back to the mothership...
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
03-02-2005 05:35
Look up Kali Dougall in world, and ask her about her target drones.