|
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
|
07-29-2006 06:34
does anyone have any gun turret scripts that allow me to move the turret and fire. i must also be able to fit it onto a ship. thank you anyone for your imput. if i am successful everyone who has helped me in this will recieve a free gun boat or gunplane.
|
|
LaZy Hulka
Registered User
Join date: 11 Apr 2006
Posts: 32
|
07-29-2006 13:42
Hope this works for ya. All you need do is add this to the prim. it's works better when its in the main or first prim of the turrent. key owner; key toucher; string toucherS; float SPEED = 80.0; integer LIFETIME = 7; float DELAY = 0.2; vector vel; vector pos; rotation rot; integer in_use; integer have_permissions = FALSE; integer armed = TRUE;
default { on_rez(integer startParam) { llResetScript(); } state_entry() { owner = llGetOwner(); in_use = FALSE; llTriggerSound("", 1.0); // Add a rezz sound llTriggerSound("", 1.0); // Add a Lock Sound } touch_start(integer total_number) { if(in_use == FALSE) { toucher = llDetectedKey(0); if(toucher == owner) { llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION); llSetText("Requesting Permissions", <1,1,1>, 1); llTriggerSound("", 1.0); //Add a question sound } } if(in_use == TRUE) { if(llDetectedKey(0) == toucher && llDetectedKey(0) == owner) { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("Unit Offline", <1,1,1>, 1); llTriggerSound("", 1.0); //add beep sound in_use = FALSE; } } } sensor(integer sense) { rotation k = llDetectedRot(0); llRotLookAt(k, 1, 1); } no_sensor() { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("Unit Offline - Connection Lost", <1,1,1>, 1); llTriggerSound("", 1.0); // add Alert sound in_use = FALSE; } run_time_permissions(integer perm) { if(perm) { llSetText("", <1,1,1>, 1); llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1); llSetText("Unit Online", <1,1,1>, 1); llTriggerSound("beep yes", 1.0); //add beep sound llTriggerSound("", 1.0); //add lock load sound in_use = TRUE; } else { in_use = FALSE; llSetText("Unit Offline", <1,3,1>, 1); } } control(key name, integer levels, integer edges) { if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { llMessageLinked(LINK_THIS, 0, "fire_nonmistakable", NULL_KEY); ///This is the messagelinked that fires the bolt. It may need a short llSleep after the messagelinked to keep it from seeing a continuous mouseclick? } } link_message(integer sender_num, integer num, string fire_nonmistakable, key id) { rot = llGetRot(); vel = llRot2Fwd(rot); pos = llGetPos(); pos = pos + vel; pos.z += 0.0; vel = vel * SPEED; llTriggerSound("", 1.0); ///This is where the lag seems to start llSleep(2); llTriggerSound("", 1.0); //add bullet sound llRezObject("", pos, vel, rot, 1); ///This can be rezzed up to three or four times before the script is back to normal control } }
|
|
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
|
07-30-2006 02:34
how do you fire? how do you aim? where do you put the bullet? do you have to script the bullet to? also i need it so i can mount it on a ship currently it just move around it all kinds of directions
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
07-30-2006 07:39
The command " llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); " is using the Left mouse button, while in Mouselook - fired like a gun. Bullets: I believe for a straight fire you will need to script the bullet to launch itself once it is rezzed by the gun and not if it's merely lobbed. But for both types you should use either llCollision_Start or llSensor to get the bullet to register hitting a target. llRezObject("", pos, vel, rot, 1); is where you would put the bullet - llRezObject(" BULLET NAME", Position according to center of primative with the rez script, velocity if the bullet has physics, rotation of the bullet(<x ,y ,z , 1> , parameter number to be passed onto the bullet-Lets it know it has been fired so you dont shoot someone while editing it ); As for mounting, I'm still very new to this but I believe you'd have to first link it all, and then find out what the link number is for all the pieces of the turret and have them rotate as separate pieces  Also that script there is quite detailed and can be cut down quite a bit. For instance, mine is at least half that and uses a HUD for controls. - Jolan
|
|
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
|
07-30-2006 09:45
could you please give me the full script in game. i will be on all day monday tuesday and wendseday english time ok?
|
|
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
|
08-02-2006 17:17
From: LaZy Hulka Hope this works for ya. All you need do is add this to the prim. it's works better when its in the main or first prim of the turrent. key owner; key toucher; string toucherS; float SPEED = 80.0; integer LIFETIME = 7; float DELAY = 0.2; vector vel; vector pos; rotation rot; integer in_use; integer have_permissions = FALSE; integer armed = TRUE; default { on_rez(integer startParam) { llResetScript(); } state_entry() { owner = llGetOwner(); in_use = FALSE; llTriggerSound("", 1.0); // Add a rezz sound llTriggerSound("", 1.0); // Add a Lock Sound } touch_start(integer total_number) { if(in_use == FALSE) { toucher = llDetectedKey(0); if(toucher == owner) { llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION); llSetText("Requesting Permissions", <1,1,1>, 1); llTriggerSound("", 1.0); //Add a question sound } } if(in_use == TRUE) { if(llDetectedKey(0) == toucher && llDetectedKey(0) == owner) { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("Unit Offline", <1,1,1>, 1); llTriggerSound("", 1.0); //add beep sound in_use = FALSE; } } } sensor(integer sense) { rotation k = llDetectedRot(0); llRotLookAt(k, 1, 1); } no_sensor() { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("Unit Offline - Connection Lost", <1,1,1>, 1); llTriggerSound("", 1.0); // add Alert sound in_use = FALSE; } run_time_permissions(integer perm) { if(perm) { llSetText("", <1,1,1>, 1); llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1); llSetText("Unit Online", <1,1,1>, 1); llTriggerSound("beep yes", 1.0); //add beep sound llTriggerSound("", 1.0); //add lock load sound in_use = TRUE; } else { in_use = FALSE; llSetText("Unit Offline", <1,3,1>, 1); } } control(key name, integer levels, integer edges) { if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { llMessageLinked(LINK_THIS, 0, "fire_nonmistakable", NULL_KEY); ///This is the messagelinked that fires the bolt. It may need a short llSleep after the messagelinked to keep it from seeing a continuous mouseclick? } } link_message(integer sender_num, integer num, string fire_nonmistakable, key id) { rot = llGetRot(); vel = llRot2Fwd(rot); pos = llGetPos(); pos = pos + vel; pos.z += 0.0; vel = vel * SPEED; llTriggerSound("", 1.0); ///This is where the lag seems to start llSleep(2); llTriggerSound("", 1.0); //add bullet sound llRezObject("", pos, vel, rot, 1); ///This can be rezzed up to three or four times before the script is back to normal control } }
Haha, you know, you can't take a script you know nothing or very little about and use it. I designed that script around an object, trying to get it to work. After finding a few problems, I've updated the script. That script might work, though I didn't check over the whole thing. The way I know it was mine was that you left link_message(integer sender_num, integer num, string fire_nonmistakable, key id) and llTriggerSound("", 1.0); ///This is where the lag seems to startllSleep(2); llTriggerSound("", 1.0); //add bullet sound llRezObject("", pos, vel, rot, 1); ///This can be rezzed up to three or four times before the script is back to normal control in it. I'm not saying it's bad, but, the script may not be in its entirety.
|