Candy Lisle
No one special just...
Join date: 26 Feb 2007
Posts: 110
|
09-09-2008 12:11
After building my first weapon I'd like to have that nifty hostering/drawing ability. I have the scripts and gestures but it looks like I need to have the script in every prim of the weapon or it will only make invisible the scripts its in.
Any ideas on how to do this without rebuilding the entire gun?
|
Ghosty Kips
Elora's Llama
Join date: 2 May 2008
Posts: 2,386
|
09-09-2008 12:16
From: Candy Lisle After building my first weapon I'd like to have that nifty hostering/drawing ability. I have the scripts and gestures but it looks like I need to have the script in every prim of the weapon or it will only make invisible the scripts its in.
Any ideas on how to do this without rebuilding the entire gun? You should only need the appropriate scripts in the gun's root prim.
_____________________
-- Why aren't you doing something more useful, like playing WoW?
|
Candy Lisle
No one special just...
Join date: 26 Feb 2007
Posts: 110
|
09-09-2008 12:17
From: Ghosty Kips You should only need the appropriate scripts in the gun's root prim. Not sure, I know the script I'm using only changes the prim it's in.
|
Yosef Okelly
Mostly Harmless
Join date: 26 Aug 2007
Posts: 2,692
|
09-09-2008 12:25
Edit your script to set the transparency of all faces on all child prims.
or
Make a small script to put in all the child prims to set transparency and call with llMessageLinked();
But the real scripters hang out a few fourms down in the script forums. You may get better luck there.
|
Candy Lisle
No one special just...
Join date: 26 Feb 2007
Posts: 110
|
09-09-2008 12:27
It sounds like I'll have to do something to every prim, and I don't think there is anyway around it other than piece by piece. I don't think there is any magic way to add something to every prim otherwise.
|
Ghosty Kips
Elora's Llama
Join date: 2 May 2008
Posts: 2,386
|
09-09-2008 12:32
From: Candy Lisle It sounds like I'll have to do something to every prim, and I don't think there is anyway around it other than piece by piece. I don't think there is any magic way to add something to every prim otherwise. No, you can set child prims to transparency from a script in the root. I don't know the function call offhand, though.
_____________________
-- Why aren't you doing something more useful, like playing WoW?
|
Candy Lisle
No one special just...
Join date: 26 Feb 2007
Posts: 110
|
09-09-2008 12:35
From: Ghosty Kips No, you can set child prims to transparency from a script in the root. I don't know the function call offhand, though. Thanks I'll ask in the scripting forum.
|
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
|
09-09-2008 13:02
I scripted a "just for show" sword a while back, that had a command that allowed me to draw or re-sheath the sword.
If the whole linkset is to appear or disappear, a single script in the root prim is all you need, to set the alpha for the whole linkset to fully transparent when the weapon is sheathed/holstered, or fully visible when it is drawn. This copy of the gun/sword/whatever attaches to the appropriate hand, and is invisible when not in use.
To have the holstered/sheathed gun or sword vanish from the holster/sheath when it is drawn, and reappear when it is put back, that requires one chat command listener in the root prim of the holster and belt linkset (or sheath and belt) that uses "llMessageLinked" to send a command to the appropriate child prims, and a small "link_message" listener" script in each prim that has to vanish or reappear. For a sword, that means you make the hilt and crossguard vanish from the sheath linkset when the command to draw the blade is given. For a gun, it would be the prims that are exposed outside the holster.
I used a script in the hand-held drawn weapon that listened only to the owner of the prims, for "draw k" and "sheath k" commands (for my katana). The same script was in the sheath, but instead of issuing the command that toggles visibility on all prims, it used llLinkMessage to send a signal to the listeners in the child prims that needed to change.
For a gun, you probably also want to script it so when the gun in your hand is visible, it activates a pose that puts your gun hand in the right position, and when holstered, it deactivates that hand/arm position AO.
For details on how to make this work, and what the exact commands are, the Scripting Tips forum is where you need to be.
llSetAlpha will change just the prim it is in.
llSetLinkPrimitiveParams can be used to set the properties of just the root prim, or of all child prims, or of specific child prims by link number, from a single script in the root prim.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-09-2008 15:04
For those playing along at home, http://lslwiki.net/lslwiki/wakka.php?wakka=llSetLinkAlpha may prove useful. (I just checked the corresponding thread in Scripting Tips and Bree had the answer there, too. )
|