76
Modification Help / Mining? messageClient
« on: June 01, 2008, 12:46:16 PM »
Hello again, Well this time I am trying to make it so that after your done mining it will say GoldOre: Number, SilverOre: Number, CopperOre: Number, But when your done mining it show's just the number like
10
6
7
10
6
7
Code: [Select]
//Oreearning////////////////////////////////////////////////////////////////////
function regrow(%brick){//recreate the brick
%brick.setcolor(%brick.realcolor);//reset its color
%brick.setcolliding(1);//make it collidable
%brick.setraycasting(1);//make it hammerable
}
package Ore
{
function hammerProjectile::oncollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(!isobject(%col)){return;}//if there isnt a %col, dont continue
if(%col.getDatablock() $= nametoid("brick2x2discData"))// nametoid(blah);
{
%col.hits++;//amount of hits taken plus 1
if(%col.hits>=15){//10 hits
%random = getRandom(1,100);
if(%random >= 1 && %random <= 10)
{
%obj.client.quantity["GoldOre"]+=getrandom(1,1);
}
else if(%random >= 11 && %random <= 30)
{
%obj.client.quantity["SilverOre"]+=getrandom(1,1);
}
else if(%random >=31 && %random <= 100)
{
%obj.client.quantity["CopperOre"]+=getrandom(1,1);
}
messageClient(%obj.client,'Ore : %1',%obj.client.quantity["CopperOre"]);
messageClient(%obj.client,'Ore : %1',%obj.client.quantity["GoldOre"]);
messageClient(%obj.client,'Ore : %1',%obj.client.quantity["SilverOre"]);
%col.realcolor = %col.getColorID();//get the bricks color
%col.setcolor(63);//make it invisible
%col.setcolliding(0);//make it walk-through
%col.setraycasting(0);//make it unhammerable
%col.hits=0;//reset the number of hits it takes
%col.sched = schedule(15000,0,regrow,%col);//schedule the regrow in 25 seconds
return;
}else{return;}//otherwise return so it doesnt get hammered
}
Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}
};
ActivatePackage(Ore);