Basic Mining Rock

Well, I originally made this for *Alex on Noddess, but he decided he’d make his own. You can easily alter the hit to a triggeraction through a weapon. It comes with an image too, though! I know it’s bulky, but don’t complain unless you make your own and post it, lol. If you use it, all I ask for is a little credit.

if (created || playerenters){ timereverywhere; setshape 1,32,32; setimg mining_rock1.png; this.health=15; this.drop=random(1,100); timeout = .05; } if (washit && this.health>0){ this.health-=1; message #v(this.health); } if (timeout){ if (this.drop>0 && this.drop<=10 && this.health<=0){ setstring client.rubies,#v(strtofloat(#s(client.rubies))+1); setplayerprop #c,I got some rubies!; } if (this.drop>=11 && this.drop<=20 && this.health<=0){ setstring client.copper,#v(strtofloat(#s(client.copper))+1); setplayerprop #c,I got some copper!; } if (this.drop>=21 && this.drop<=30 && this.health<=0){ setstring client.emerald,#v(strtofloat(#s(client.emerald))+1); setplayerprop #c,I got some emerald!; } if (this.drop>=31 && this.drop<=60 && this.health<=0){ setplayerprop #c,I got nothing.; } if (this.drop>=61 && this.drop<=70 && this.health<=0){ setstring client.topaz,#v(strtofloat(#s(client.topaz))+1); setplayerprop #c,I got some topaz!; } if (this.drop>=71 && this.drop<=80 && this.health<=0){ setstring client.coal,#v(strtofloat(#s(client.coal))+1); setplayerprop #c,I got some coal!; } if (this.drop>=81 && this.drop<=90 && this.health<=0){ setstring client.crystal,#v(strtofloat(#s(client.crystal))+1); setplayerprop #c,I got some crystal!; } if (this.drop>=91 && this.drop<=100 && this.health<=0){ setplayerprop #c,I got nothing.; } timeout = .05; } if (timeout){ if (this.health<=0){ this.drop=random(1,100); hide; setshape 1,0,0; sleep 5; show; this.health=15; setshape 1,32,32; message ; } timeout = .05; }

if (created || playerenters){ timereverywhere; setshape 1,32,32; setimg mining_rock1.png; this.health=15; this.drop=random(1,100); timeout = .05; } if (washit && this.health>0){ this.health-=1; message #v(this.health); timeout=0.05; } if (timeout && this.health<=0){ if (this.drop<=10){ setstring client.rubies,#v(strtofloat(#s(client.rubies))+1); setplayerprop #c,I got some rubies!; } else if (this.drop<=20){ setstring client.copper,#v(strtofloat(#s(client.copper))+1); setplayerprop #c,I got some copper!; } else if (tthis.drop<=30){ setstring client.emerald,#v(strtofloat(#s(client.emerald))+1); setplayerprop #c,I got some emerald!; } else if (this.drop<=60){ setplayerprop #c,I got nothing.; } else if (this.drop<=70){ setstring client.topaz,#v(strtofloat(#s(client.topaz))+1); setplayerprop #c,I got some topaz!; } else if (this.drop<=80){ setstring client.coal,#v(strtofloat(#s(client.coal))+1); setplayerprop #c,I got some coal!; } else if (this.drop<=90){ setstring client.crystal,#v(strtofloat(#s(client.crystal))+1); setplayerprop #c,I got some crystal!; } else setplayerprop #c,I got nothing.; timeout = .05; } else if (timeout){ if (this.health<=0){ this.drop=random(1,100); hide; setshape 1,0,0; sleep 5; show; this.health=15; setshape 1,32,32; message ; } timeout = .05; }
Learn to use else statements and look for similarities in your code. Not only does make the script look nicer it also creates less lag as the compiler has to do less work. Its a win win for all :animesmiley:

Thanks, Kondie!

But yeah, see Tricxta’s script? That is the EXACT same format as mine had…like EXACTLY the same. I didn’t like the way yours looked because I didn’t get why you didn’t use else :stuck_out_tongue:

The rock image is GREAT! If we can’t find anyone else to make us one, we will use that one. Thank you <3

Because I didn’t feel like testing the script in the editor. Just made that one in PM and fixed up a few errors I found. I’m not a good scripter, just trying to help people.

Lol, I’m not saying anything bad lol. Just so you don’t get mad that I didn’t use your script lol. You are a better scripter than me (obviously :P).

I’m using that rock image. It is great, thanks.