Script 1 for the actual saber, wich would go in each and every prim of the hilt object.
CODE
//vector saberColor;
default
{
link_message(integer sender_num, integer num, string msg, key id)
{
if(msg == "OFF")
{
llSetAlpha(0,ALL_SIDES);
}
else if(msg == "ON")
{
llSetAlpha(1,ALL_SIDES);
}
}
}
Script 2 wich goes in the hilt wich will be used on the hip of the avatar, or turneed off.
CODE
default
{
state_entry()
{
key owner = llGetOwner();
llListen(0,"",owner,"");
}
listen( integer channel, string name, key id, string message )
{
if( message == "/ls on" )
{
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0,ALL_SIDES);
}
if( message == "/ls off" )
{
llSetStatus(STATUS_PHANTOM, FALSE);
llSetAlpha(1,ALL_SIDES);
}
}
}
This system, also has a HUD, the hud has an on off button, the on hand saber works properly on this button because it's attatched to the rest of the LCK system. Here's the script inside that button.
CODE
integer channel = 72;
integer LSON = FALSE;
string text;
default
{
touch_start(integer total_number)
{
if(LSON == TRUE)
{
llSay(channel,"/ls off");
llSetColor(<1,1,0>,ALL_SIDES);
text = "Lightsaber Off";
llSetText(text,<1,1,1>,1);
LSON = FALSE;
}
else if(LSON == FALSE)
{
llSay(channel,"/ls on");
llSetColor(<0,1,0>,ALL_SIDES);
text = "Lightsaber On";
llSetText(text,<1,1,1>,1);
LSON = TRUE;
}
}
link_message(integer sender,integer num,string msg,key id)
{
if(msg == "HIDE")
{
llSetAlpha(0,ALL_SIDES);
llSetText("",<1,1,1>,1);
state hidden;
}
}
}
state hidden
{
link_message(integer sender,integer num,string msg,key id)
{
if(msg == "SHOW")
{
llSetAlpha(1,ALL_SIDES);
llSetText(text,<1,1,1>,1);
state default;
}
}
}
My problem is, that I don't know how to make the hip part listen to this button and the owner only. I can just remove the "owner" string on the IIListen part of the hip script but that way anyone can turn on and off my weapon at will. Please help.
