integer charge = 0; integer chargelvl = 1; //--------------------------------- //---------[Weapon Traits]--------- //--------------------------------- integer curwint = 1; // string curweap = "V Shot"; list weapons = [ "X Shot", "V Shot" ]; // list checkweaps = [ "x shot", "v shot" ]; // vector wcolor1 = <1,1,1>; list wcolors1 = [ //X Shot <0,0.25098,0.941176>, //V Shot <1,1,1> ]; // vector wcolor2 = <1,.42353,0>; list wcolors2 = [ //X Shot <0.9,0,0>, //V Shot <1,.42353,0> ]; // //Charge Types: //------------- //(Aftercharge = Diff. charge remains after 3rd shot fired) //0 - Two Levels //1 - Normal (Three Levels) //2 - Four Levels //3 - Normal w/Aftercharge //4 - Four Levels w/Aftercharge //5 - No Charge, Rapidfire On Hold //6 - No Charge, Only Single Shot integer curcharge = 1; list charges = [ //X Shot 2, //V Shot 1 ]; //!!! - For any of the bullets below, putting "TELL SCRIPT" will not fire a bullet, but will instead say a linked message with the following values, in order to trigger a separate script: // > Integer: Shot charge level (1 to 5, 5 being an Aftercharge. Rapidfire will function the same way as No Charge, and will only notify once.) // > String: Full weapon name, including caps. // string c1shot = "X Buster Shot"; list c1shots = [ //X Shot "X Buster Shot", //V Shot "X Buster Shot" ]; // string c2shot = "X Buster Medium Charge Shot"; list c2shots = [ //X Shot "X Buster Medium Charge Shot", //V Shot "X Buster Medium Charge Shot" ]; // string c3shot = "X Buster Full Charge Shot"; list c3shots = [ //X Shot "X Buster Full Charge Shot", //V Shot "X Buster Full Charge Shot" ]; // string c4shot = "X Buster Max Charge Shot"; list c4shots = [ //X Shot "X Buster Max Charge Shot", //V Shot "X Buster Max Shot" ]; // string cAshot = "X Buster Shot"; list cAshots = [ //X Shot "X Buster Shot", //V Shot "X Buster Shot" ]; // float c1speed = 0; list c1speeds = [ //X Shot 0, //V Shot 0 ]; // float c2speed = 0; list c2speeds = [ //X Shot 0, //V Shot 0 ]; // float c3speed = 0; list c3speeds = [ //X Shot 0, //V Shot 0 ]; // float c4speed = 0; list c4speeds = [ //X Shot 0, //V Shot 0 ]; // float cAspeed = 0; list cAspeeds = [ //X Shot 0, //N/A //V Shot 0 //N/A ]; //--------------------------------- //-------[End Weapon Traits]------- //--------------------------------- setweapon(integer wnum) { curwint = wnum; curweap = llList2String(weapons,wnum); wcolor1 = llList2Vector(wcolors1,wnum); wcolor2 = llList2Vector(wcolors2,wnum); curcharge = llList2Integer(charges,wnum); c1shot = llList2String(c1shots,wnum); c2shot = llList2String(c2shots,wnum); c3shot = llList2String(c3shots,wnum); c4shot = llList2String(c4shots,wnum); cAshot = llList2String(cAshots,wnum); c1speed = llList2Float(c1speeds,wnum); c2speed = llList2Float(c2speeds,wnum); c3speed = llList2Float(c3speeds,wnum); c4speed = llList2Float(c4speeds,wnum); cAspeed = llList2Float(cAspeeds,wnum); llMessageLinked(LINK_SET,1,(string)wcolor1,NULL_KEY); llMessageLinked(LINK_SET,2,(string)wcolor2,NULL_KEY); } default { on_rez(integer start_param) { llResetScript(); } state_entry() { llMessageLinked(LINK_SET,1,(string)wcolor1,NULL_KEY); llMessageLinked(LINK_SET,2,(string)wcolor2,NULL_KEY); llListen(7,"",NULL_KEY,""); llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } listen(integer channel, string name, key id, string msg) { if((msg == "shoot" && id == llGetOwner()) || msg == (string)llGetOwner()+"x buster shoot") { rotation rot = llGetRot(); vector fwd = llRot2Fwd(rot); vector up = llRot2Up(rot); llStartAnimation("X Buster Shoot 3"); llParticleSystem([]); if(chargelvl <= 1) { llRezObject("X Buster Shot",llGetPos()+(0.7*up)+(fwd),fwd*50,llGetRot(),2); if(charge > 1) { llStopSound(); } llPlaySound("X Buster Fire",1.0); } else if(chargelvl == 2) { llRezObject("X Buster Medium Charge Shot",llGetPos()+(0.6*up)+(0.6*fwd),fwd*60,llGetRot(),2); llStopSound(); llPlaySound("X Buster Mid Charge Fire",1.0); } else if(chargelvl == 3) { llRezObject("X Buster Full Charge Shot",llGetPos()+(0.6*up)+(0.8*fwd),fwd*70,llGetRot(),2); llStopSound(); llPlaySound("X Buster Full Charge Fire",1.0); } else if(chargelvl == 4) { llRezObject("X Buster Max Charge Shot",llGetPos()+(1.05*up)+(1.25*fwd),fwd*50,llGetRot(),2); llStopSound(); llPlaySound("X Buster Full Charge Fire",1.0); } llStopAnimation("X Buster Shoot 3"); llSetTimerEvent(0.0); charge = 0; chargelvl = 1; } if(msg == (string)llGetOwner()+"x buster charge" && charge <= 1) { llStartAnimation("X Buster Shoot 3"); llParticleSystem([PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_MAX_AGE, 1.1, PSYS_SRC_BURST_PART_COUNT, 18, PSYS_PART_FLAGS,PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_TARGET_POS_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK, PSYS_PART_START_ALPHA, .6, PSYS_PART_END_ALPHA, .5, PSYS_PART_START_COLOR, <0,0.3,1>, PSYS_PART_END_COLOR, <.5,.8,1>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_ACCEL, <0,0,0>, PSYS_PART_START_SCALE, <.7,.7,2>, PSYS_PART_END_SCALE, <.3,.3,.7>, PSYS_SRC_BURST_SPEED_MIN, -3.0, PSYS_SRC_BURST_SPEED_MAX, 1.0, PSYS_SRC_BURST_RADIUS, 2.4, PSYS_SRC_BURST_RATE, 0.1 ]); llSetTimerEvent(0.1); llPlaySound("X Buster Charge Start",1.0); chargelvl = 2; } string checkweap = llGetSubString(msg,0,3); string givenweap = llToLower(llGetSubString(msg,5,llStringLength(msg))); if(id == llGetOwner() && checkweap == "wset") { integer wpos = llListFindList(checkweaps,[givenweap]); if(wpos != -1) { setweapon(wpos); } } } timer() { if(charge > 13 && chargelvl < 3) { chargelvl = 3; llParticleSystem([PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_MAX_AGE, .8, PSYS_SRC_BURST_PART_COUNT, 25, PSYS_PART_FLAGS,PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_TARGET_POS_MASK, PSYS_PART_START_ALPHA, .6, PSYS_PART_END_ALPHA, .5, PSYS_PART_START_COLOR, <.9,.9,.7>, PSYS_PART_END_COLOR, <1,1,.8>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_ACCEL, <0,0,0>, PSYS_PART_START_SCALE, <.9,.9,.9>, PSYS_PART_END_SCALE, <.3,.3,.3>, PSYS_SRC_BURST_SPEED_MIN, -3.0, PSYS_SRC_BURST_SPEED_MAX, 1.0, PSYS_SRC_BURST_RADIUS, 2.5, PSYS_SRC_BURST_RATE, 0.1 ]); } else if(charge > 35 && chargelvl < 4) { chargelvl = 4; llParticleSystem([PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_MAX_AGE, .6, PSYS_SRC_BURST_PART_COUNT, 30, PSYS_PART_FLAGS,PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_TARGET_POS_MASK, PSYS_PART_START_ALPHA, .6, PSYS_PART_END_ALPHA, .5, PSYS_PART_START_COLOR, <1,.4,.55>, PSYS_PART_END_COLOR, <1,.95,1>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_ACCEL, <0,0,0>, PSYS_PART_START_SCALE, <1.1,1.1,1.1>, PSYS_PART_END_SCALE, <.3,.3,.3>, PSYS_SRC_BURST_SPEED_MIN, -3.0, PSYS_SRC_BURST_SPEED_MAX, 1.0, PSYS_SRC_BURST_RADIUS, 2.7, PSYS_SRC_BURST_RATE, 0.1 ]); } charge += 1; if(charge > 90) { charge = 90; } } link_message(integer sender_num, integer num, string msg, key id) { if(msg == "x buster shoot") { rotation rot = llGetRot(); vector fwd = llRot2Fwd(rot); vector up = llRot2Up(rot); llStartAnimation("X Buster Shoot 3"); llParticleSystem([]); if(chargelvl <= 1) { llRezObject("X Buster Shot",llGetPos()+(0.7*up)+(fwd),fwd*50,llGetRot(),2); if(charge > 1) { llStopSound(); } llPlaySound("X Buster Fire",1.0); } if(chargelvl == 2) { llRezObject("X Buster Medium Charge Shot",llGetPos()+(0.6*up)+(0.6*fwd),fwd*60,llGetRot(),2); llStopSound(); llPlaySound("X Buster Mid Charge Fire",1.0); } if(chargelvl == 3) { llRezObject("X Buster Full Charge Shot",llGetPos()+(0.6*up)+(0.8*fwd),fwd*70,llGetRot(),2); llStopSound(); llPlaySound("X Buster Full Charge Fire",1.0); } else if(chargelvl == 4) { llRezObject("X Buster Max Charge Shot",llGetPos()+(1.05*up)+(1.25*fwd),fwd*50,llGetRot(),2); llStopSound(); llPlaySound("X Buster Full Charge Fire",1.0); } llStopAnimation("X Buster Shoot 3"); llSetTimerEvent(0.0); charge = 0; chargelvl = 1; } if(msg == "x buster charge" && charge <= 1) { llStartAnimation("X Buster Shoot 3"); llParticleSystem([PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_MAX_AGE, 1.1, PSYS_SRC_BURST_PART_COUNT, 18, PSYS_PART_FLAGS,PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_TARGET_POS_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK, PSYS_PART_START_ALPHA, .6, PSYS_PART_END_ALPHA, .5, PSYS_PART_START_COLOR, <0,0.3,1>, PSYS_PART_END_COLOR, <.5,.8,1>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_ACCEL, <0,0,0>, PSYS_PART_START_SCALE, <.7,.7,2>, PSYS_PART_END_SCALE, <.3,.3,.7>, PSYS_SRC_BURST_SPEED_MIN, -3.0, PSYS_SRC_BURST_SPEED_MAX, 1.0, PSYS_SRC_BURST_RADIUS, 2.4, PSYS_SRC_BURST_RATE, 0.1 ]); llSetTimerEvent(0.1); llPlaySound("X Buster Charge Start",1.0); chargelvl = 2; } } }