|
Bashiri Mandelbrot
Registered User
Join date: 13 May 2006
Posts: 1
|
07-27-2006 17:36
I am a good builder and have created two things i need scripts for. (1) I need a script to launch missles from a stationary launcher (not attached to me), and have them home in on a commanded person, no push.(2) My second problem is with an automated turret. I need a script that will allow me to command the turret to fire and stop. I also need a tracking script to keep the turret aimed at the nearest person.I would like both of these objects to be command based. Please tell me if this is possible, and help if you can.
|
|
LaZy Hulka
Registered User
Join date: 11 Apr 2006
Posts: 32
|
07-27-2006 21:37
Here a script that might help your missle. Put this in the main part on the object. When object is rezz Click on the object. It well ask you if you would like to attech the animation. Hit Yes this well trun online. This well shoot the object/bullet or whatever. You just need add the missle or bullets name and sounds 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); //need add Sound llTriggerSound("", 1.0); //need add 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); //need add 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); //need add 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); //need add 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("", 1.0); //need add Sound llTriggerSound("", 1.0); //need add 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 bullet. 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); llRezObject("", pos, vel, rot, 1); ///This can be rezzed up to three or four times before the script is back to normal control } }
|