Jump to content

Having problem with holstered gun


NawaliaTrea
 Share

You are about to reply to a thread that has been inactive for 2283 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi again,

I am stumble on another problem...again...;D ...so i am trying to do a draw/holster script...but now i am stuck on the holstered gun. so far i have no problem with the script when the gun is not linked to the holster. but when i linked the gun to the holster that gun just wont leave the holster ( the gun is a multi prims and the holster is a single prim object. i know i have to make some changes for the setlinkalpha parts but honestly i don't know what command needed for this and tried to browsed the wiki but couldn't find any that can explain about this. maybe i can get some tips from you all ...;D

Thank you sooo much ;)

Link to comment
Share on other sites

assuming this is about transparent/opaque then we could set the holster as the root prim, then in root:

holster_gun(integer show)
{
    llSetLinkAlpha(LINK_ALL_OTHERS, (float)show, ALL_SIDES);
}


// test
holster_gun(1);  // show the gun and holster
holster_gun(0);  // hide the gun, showing empty holster 

 

Link to comment
Share on other sites

31 minutes ago, ellestones said:

assuming this is about transparent/opaque then we could set the holster as the root prim, then in root:


holster_gun(integer show)
{
    llSetLinkAlpha(LINK_ALL_OTHERS, (float)show, ALL_SIDES);
}


// test
holster_gun(1);  // show the gun and holster
holster_gun(0);  // hide the gun, showing empty holster 

 

okay..so the script is in the root prim instead of the former root prim in the gun since that prim already become first child prim. thank you i'll try this command for the setlinkalpha... i use the sling draw script i am working on right now on my sorority paddle linked with a bunch of spikes around it then linked it to a scooter (the scooter act like a holster) when i type the chat trigger the paddle got alpha but all the spikes stay there lol.... ;D thanks so much for your help.

Edited by NawaliaTrea
Link to comment
Share on other sites

1 hour ago, ellestones said:

assuming this is about transparent/opaque then we could set the holster as the root prim, then in root:


holster_gun(integer show)
{
    llSetLinkAlpha(LINK_ALL_OTHERS, (float)show, ALL_SIDES);
}


// test
holster_gun(1);  // show the gun and holster
holster_gun(0);  // hide the gun, showing empty holster 

 

Hi....apparently i am still stuck ;D ..so i revised the script and the part look like this there's must be a mistake i made but can't figure out what it is yet ;D

 if (chan == ChatChan) {
            if (llToLower(msg) == llToLower(DrawCmd)) {
                if (IsLeg) {
                    if (llGetLinkNumber() == LINK_ROOT)
                        llSetLinkAlpha(LINK_ALL_OTHERS, 1.0, ALL_SIDES);
                    else
                        llSetAlpha(1.0, ALL_SIDES);
                } else {
                    if (llGetLinkNumber() == LINK_ROOT)
                        llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, ALL_SIDES);      // this was originally LINK_SET, 0.0, ALL_SIDES
                    else
                        llSetAlpha(0.0, ALL_SIDES);
                }

Link to comment
Share on other sites

when we know that the root prim will always show and the others will hide/show on command then the root prim script

if (chan == ChatChan) 
{
   if (llToLower(msg) == llToLower(DrawCmd)) 
   {
       if (isLeg) // when isLeg == TRUE show the gun
             llSetLinkAlpha(LINK_ALL_OTHERS, 1.0, ALL_SIDES);
       else  // hide the gun
             llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, ALL_SIDES);
   }
}

we can reduce this code down a bit by using IsLeg as an argument for the function

if (chan == ChatChan) 
{
   if (llToLower(msg) == llToLower(DrawCmd)) 
   {
       llSetLinkAlpha(LINK_ALL_OTHERS, (float)isLeg, ALL_SIDES);
   }
}

if isLeg should change when we issue the command to draw/holster (for use elsewhere in the script) then

if (chan == ChatChan) 
{
   string m = llToLower(msg);
   if ((m == DrawCmd) || (m == HolsterCmd)) // we expect DrawCmd/HolsterCmd to already be lowercased previously in the script 
   {
      isLeg = (m == HolsterCmd);
      llSetLinkAlpha(LINK_ALL_OTHERS, (float)isLeg, ALL_SIDES);
   }
   // else { handle any other commands here }

}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2283 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...