|
Crunch Underwood
Mr. Grown up, Go away sir
Join date: 25 Sep 2007
Posts: 624
|
08-03-2008 21:48
hey guys, i'm scripting a canon and while i can get it to fire and a few othe things i'd really like to make a wait of about 10-20 seconds befor it can be fired again, what would i need to add for that? please remember i'm a scripting boob and am only good at changing numbers. here's the script below:
vector skew; rotation myRot; vector myEuler;
default { touch_start(integer total_number) { //Get the current rotation myRot=llGetRot(); //Convert from 4 value rot to 3 value euler vector myEuler=llRot2Up(myRot); //Play a Sound llPlaySound("launch", 2.0); //Fire the projectile llRezObject("Canon Bullet", llGetPos()+<-.5, 0, 0>, myEuler*50+skew, <0,0,0,0>,0); } }
thank in advance
-Crunch
_____________________
---------------------------------------------- So your final Nimbus Score is 8.15, a quite remarkable achievement for a biped. Congratulations Crunch, you should be very proud. 
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
08-03-2008 22:28
You can use a little timer to put it to sleep. float sleep_seconds = 15; // How long to rest between earth shattering kabooms integer sleeping = FALSE; // Are we awake now?
vector skew; rotation myRot; vector myEuler;
default { touch_start(integer total_number) { if (sleeping) { llWhisper(0, "I are tired cannon, Zzzzzzzz."); return; } //Get the current rotation myRot=llGetRot(); //Convert from 4 value rot to 3 value euler vector myEuler=llRot2Up(myRot); //Play a Sound llPlaySound("launch", 2.0); //Fire the projectile llRezObject("Canon Bullet", llGetPos()+<-.5, 0, 0>, myEuler*50+skew, <0,0,0,0>,0);
// Go to sleep llSetTimerEvent(sleep_seconds); sleeping = TRUE; }
timer() { // wake up and stop the timer llSetTimerEvent(0.); sleeping = FALSE; } }
|
|
Crunch Underwood
Mr. Grown up, Go away sir
Join date: 25 Sep 2007
Posts: 624
|
08-03-2008 23:13
absolutly perfect, your the best!
_____________________
---------------------------------------------- So your final Nimbus Score is 8.15, a quite remarkable achievement for a biped. Congratulations Crunch, you should be very proud. 
|