Need a gun holster script
|
Mako Barnett
Registered User
Join date: 17 May 2006
Posts: 1
|
06-15-2006 19:19
I have twin pistols that I am going to build holsters for. I would like to be able to draw the pistols using a holster script, similar to that which is on other touch operated weapons I have bought but am unable to view their script. Does anyone know what such a script would look like and maybe any other components I would need to make it work. Thanks.
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
06-15-2006 20:24
you will need some form of an animation player, such as a basic poseball ect
probally the key part of it all is the animation, you can have the best script in the world but if your animation makes you sip tea it doesnt help you at all
|
Mika Muromachi
Kitsune-at-large
Join date: 31 Mar 2005
Posts: 37
|
06-16-2006 10:00
Most holsters do not actually have the weapons drawn from them. Instead, the weapons are attached to the hand, while the holster is built with the weapon (a non-firing but aidentically-textured prop) in it. In the "holstered" state, the weapons held in the hand are scripted into transparency. Upon "drawing" (usually handled by a touch script or a channeled command), a short animation is played, miming reaching down for the "holstered" weapon. The holstered weapon is scripted into transparency, and the weapons already attached to the hand are rendered visible. Thus, it now looks like there is an empty holster, and the weapon is in your hand. At this time, the "hold pistol" animation is triggered, as well as the ability for the weapons to fire. The same thing is done in reverse when re-holstering the weapon, disabling the "holding" animation and fire ability, rendering the held gun transparent about mid-way through the animation, and rendering the holster's prop visible.
Hopefully this will help. Although I am not a scripter, I have watched these kinds of things in action while set to view transparent. It became quite obvious what was happening after that.
Yours, Mika Kyubi (Muromachi) Kitsune-at-Large (Who wants her last name of Kyubi in SL!!!)
|
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
06-16-2006 19:21
From: Osgeld Barmy you will need some form of an animation player, such as a basic poseball ect
probally the key part of it all is the animation, you can have the best script in the world but if your animation makes you sip tea it doesnt help you at all lmao! Death by Tea cup.. 
|
XShade Foley
Registered User
Join date: 11 Feb 2006
Posts: 12
|
06-17-2006 16:19
here is gun holster script put this in ever prim in the gun that fires default { state_entry() { llListen( 89, "", NULL_KEY, "1" ); llListen( 89, "", NULL_KEY, "2" ); } listen(integer channel,string name,key id,string msg) { if (msg == "1") { llSetAlpha(1, ALL_SIDES); } if (msg == "2") { llSetAlpha(0, ALL_SIDES); } }
}
put this in the parts in the hoster that you whant to disapear default { state_entry() { llListen( 89, "", NULL_KEY, "1" ); llListen( 89, "", NULL_KEY, "2" ); } listen(integer channel,string name,key id,string msg) { if (msg == "1") { llSetAlpha(0, ALL_SIDES); } if (msg == "2") { llSetAlpha(1, ALL_SIDES); } }
}
put this script into the hoster its self efault { state_entry() { state one; } } state one { state_entry() { llSay(89, "1"); } touch_start(integer total_number) { state two; } } state two { state_entry() { llSay(89, "2"); } touch_start(integer total_number) { state one; } }
|
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
|
06-17-2006 17:52
Am I reading this wrong?
state_entry() { llListen( 89, "", NULL_KEY, "1" ); llListen( 89, "", NULL_KEY, "2" ); }
Why are you instantiating two listeners on the same channel? Why not just filter the incoming message within the listen() event?
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
06-17-2006 18:00
i agree, while in this case it probally isnt hurting much its usually better to have a open message and filter it out later if (msg == "1"  else if (msg == "2"  else llSay(0,"command not found, stop talkin crap to me theres only 2 options you doof"  ;
|
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
|
06-17-2006 20:34
Funky. Also, restricting the listens to the owner's key is an excellent measure, unless for some reason it is important that anyone be able to force the wearer to draw. 
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
06-18-2006 00:37
From: XShade Foley here is gun holster script put this in ever prim in the gun that fires default { state_entry() { llListen( 89, "", NULL_KEY, "1" ); llListen( 89, "", NULL_KEY, "2" ); }
You don't need two listeners in EVERY prim of the gun. You just need one in total and a better script.
|
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
|
06-18-2006 02:03
1 listen on the each of the guns, one when youre holding, one when you got it attached, something like this save you have one prim with the listen, and let it say stuff to the others listen(integer channel, string name, key id, string message) { if(message == (hide)) { llSetAlpha(0.0, ALL_SIDES); llMessageLinked(LINK_SET,0,"hide",NULL_KEY); } if(message == (show)) { llSetAlpha(1.0, ALL_SIDES); llMessageLinked(LINK_SET,0,"show",NULL_KEY);
recive stuff for prims, default { link_message(integer sender_num, integer num, string str, key id) { if (str == "1"){ llMessageLinked(LINK_SET,0,"hide",NULL_KEY); } else if (str == "2") { llMessageLinked(LINK_SET,0,"show",NULL_KEY); } } }
|
Copper Surface
Wandering Carroteer
Join date: 6 Jul 2005
Posts: 157
|
06-18-2006 02:24
The thought of people running around with listens in every single prim of their guns just boggles me. Also, is there any reason you need to put scripts in the other prims at all? llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
Quoting the Wiki: "If linknumber == LINK_SET, this function sets alpha on all prims in the link set (including the task). This allows setting an entire object in one call rather than being forced to use a for loop."
|
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
|
06-18-2006 07:23
SetLinkAlpha is indeed handy, as long as you've tracked the linknumber of each prim that's in the holser vs. the prims in the holstered gun. Using LINK_SET would turn the holster invisible as well.
|
starhunter Gall
Registered User
Join date: 6 Sep 2005
Posts: 5
|
thanks for the scripts
07-09-2006 21:37
I was wondering if there is a way to fix it so the gun hold animations, to stop when the guns are away.
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
07-10-2006 22:57
From: starhunter Gall I was wondering if there is a way to fix it so the gun hold animations, to stop when the guns are away. Well scripted guns do this.
|