Davey Bigwig
Registered User
Join date: 8 Dec 2005
Posts: 3
|
01-31-2006 12:22
alright. I have this turret that you could control manually. I also am working on a feature to make it AI if I wanted it to. The problem all the time is (and everything else works too, the rotating and stuff) that whenever I shoot a bullet, there's this really weird 5-second sleep that happens to my script before it runs again. I don't know why it does that at all, and I KNOW I don't have a llSleep(5); in my code either. I found out it HAS to do with my shooting of the ball, but I dunno what could cause it, I just know it's when I fire something cause I tested my AI thing and same thing happened. Anyways, here's my code snippet of when someone fires the bullet (and the preventhold variables aren't it, it happens with the AI shooting too and there's none of thoes variables in there). control(key id, integer level, integer edge) { if ((level & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { pos = llGetPos(); rot = llGetRot(); offset = <3, 0, 1>; offset *= rot; pos += offset; llPointAt(pos); vector fwd = llRot2Fwd(rot + llGetCameraRot()); fwd *= 30; rot *= llEuler2Rot(<0, PI_BY_TWO, 0>); llRezObject("Bullet", pos, fwd, rot, 1); preventhold = 1; } if ((edge & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { preventhold = 0; } } Thanks.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-31-2006 13:07
From the wiki page for llRezObject: http://secondlife.com/badgeo/wakka.php?wakka=llRezObjectFrom: someone Caveats: - This function delays the script for a period of time proportional to the mass of the object and the rezzed objects velocity (and quite possibly someting else as well) - this timer does not reset when script resets. Experimentation by JeffreyGomez (detailed in this ) thread resulted in the formula: rez delay = mass * magnitude(velocity) / 10
|