amarock Amat Posted April 16, 2012 Share Posted April 16, 2012 So, am brain dead and strugglign to rember, on how to make a avatar not move, I am making a sort of like crossbow turrent, but I don't want folks to cheat and walk half a mile away while fireing it, any suggestions? key toucher; string toucherS; float SPEED = 60.0; integer LIFETIME = 7; float DELAY = 0.2; vector vel; vector pos; rotation rot; integer in_use; integer have_permissions = FALSE; integer armed = TRUE; fire() { rot = llGetRot(); vel = llRot2Fwd(rot); pos = llGetPos(); pos = pos + vel; pos.z += 0.0; vel = vel * SPEED; llTriggerSound("shoot", 1.0); llRezObject("bullet", pos, vel, rot, 1); } default { state_entry() { in_use = FALSE; } touch_start(integer total_number) { if(in_use == FALSE) { toucher = llDetectedKey(0); llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION); llSetText("Requesting Permissions", <1,1,1>, 1); } if(in_use == TRUE) { if(llDetectedKey(0) == toucher) { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("", <1,1,1>, 1); 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("", <1,1,1>, 1); 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("Current User: "+llKey2Name(toucher), <1,1,1>, 1); in_use = TRUE; } else { in_use = FALSE; llSetText("", <1,3,1>, 1); } } control(key name, integer levels, integer edges) { if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { fire(); } } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 17, 2012 Share Posted April 17, 2012 Well..... you could separate the touch_start event and the control event in different states. Use the touch_start event to determine where the person is and then check in the control event to be sure that the person is no more than, say, 5m from that spot when he fires the crossbow. Let the script return to state default only when the crossbow has been fired. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted April 17, 2012 Share Posted April 17, 2012 Make them be able to fire only when they "sit" on an object The "sit" need not be a sitting animation, it can just as well be a "stand" Link to comment Share on other sites More sharing options...
amarock Amat Posted April 17, 2012 Author Share Posted April 17, 2012 *looks up codes to do that8 Link to comment Share on other sites More sharing options...
amarock Amat Posted April 17, 2012 Author Share Posted April 17, 2012 Okay did a scan effect, that so many meters and it turns "off" Although for now, I may be ditching the project as am having a major issue of lining up the point of vew camara, agaisnt how it is being aimed . Link to comment Share on other sites More sharing options...
Recommended Posts
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