I am making a Resource mod but for some reason when I hit the tree or rock with the hammer it break's like normal any Ideas. At first I thought brick collision changed but now I have no idea.
//////////////////////////////////
//Kunits Woodcutting //
/////////////////////////////////
//RPGbrick's
datablock fxDTSBrickData (brickTreeData)
{
brickFile = "base/data/bricks/special/pineTree.blb";
category = "Special";
subCategory = "RPG";
uiName = "RPGtree";
iconName = "add-ons/brickIcons/pinetree";
collisionShapeName = "base/data/shapes/bricks/pinetree.dts";
};
//WoodCutting////////////////////////////////////////////////////////////////////
function regrow(%brick) //recreate the brick
{
%brick.setcolor(%brick.realcolor);
%brick.setcolliding(1);
%brick.setRendering(1);
}
package Wood
{
function HammerProjectile::oncollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(!isobject(%col)){return;}
if(%col.getDatablock() $= nametoid("brickTreeData"))
{
%col.hits++;//amount of hits taken plus 1
if(%col.hits>=25) //10 hits
{
%random = getRandom(1,150);
if(%random >= 1 && %random <= 40)
{
%obj.client.quantity["MapleWood"]+=1;
%obj.client.WCE+=getrandom(1,80);
messageClient(%obj.client, '', '\c2You gained One Maplewood!',%ammount);
}
else if(%random >= 50 && %random <= 80)
{
%obj.client.quantity["OakWood"]+=1;
%obj.client.WCE+=getrandom(1,40);
messageClient(%obj.client, '', '\c2You gained One Oakwood!',%ammount);
}
else if(%random >= 80 && %random <= 100)
{
%obj.client.quantity["PineWood"]+=1;
%obj.client.WCE+=getrandom(1,80);
messageClient(%obj.client, '', '\c2You gained One Pinewood!',%ammount);
}
else if(%random >= 80 && %random <= 150)
{
messageClient(%obj.client, '', '\c2That wood is rotten!',%ammount);
%col.realcolor = %col.getColorID();
%col.setcolor(63);
%col.setcolliding(0);
%col.setraycasting(0);
%col.hits=0;
%col.sched = schedule(15000,0,regrow,%col);
return;
}
else
{
return;
}
}
}
else
{
Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}
}
function serverCmdplantbrick(%client)
{
if($woodon == 0)
{
Parent::ServerCmdplantbrick(%client);
return;
}
else if(%client.isSuperAdmin)
{
Parent::ServerCmdplantbrick(%client);
return;
}
else if($woodon == 1 && %client.quantity["PineWood"] < 1 && %client.quantity["OakWood"] < 1 && %client.quantity["MapleWood"] < 1 )
{
messageClient(%client,'','Not enough wood!');
return;
}
else if(%client.quantity["PineWood"] > 0)
{
%client.quantity["PineWood"]--;
Parent::ServerCmdplantbrick(%client);
return;
}
else if(%client.quantity["OakWood"] > 0)
{
%client.quantity["OakWood"]--;
Parent::ServerCmdplantbrick(%client);
return;
}
else if(%client.quantity["MapleWood"] > 0)
{
%client.quantity["MapleWood"]--;
Parent::ServerCmdplantbrick(%client);
return;
}
}
};
ActivatePackage(Wood);
//Cmd's
function ServerCmdcheckWood(%client)
{
if(%client.quantity["Pinewood"] <= 0)
{
%client.quantityPinewood = 0;
}
if(%client.quantity["Oakwood"] <= 0)
{
%client.quantity["Oakwood"] = 0;
}
if(%client.quantity["Maplewood"] <= 0)
{
%client.quantity["Maplewood"] = 0;
}
bottomprint(%client, "\c2PineWood: \c1" @ %client.quantity["Pinewood"] @" \c2MapleWood: \c1" @ %client.quantity["Maplewood"] NL "\c2OakWood: \c1" @ %client.quantity["Oakwood"],5,3);
}
//Status
function serverCmdWoodStatus(%client)
{
if($woodon == 1)
{
messageClient(%client,'','\c2Wood is on!',$Woodon);
}
else if($woodon == 0)
{
messageClient(%client,'','\c3Wood is off!',$Woodon);
}
}
//End
//WoodOn
function serverCmdWoodOn(%client)
{
$woodon = 1;
messageClient(%client,'','\c2Wood is now On!',$Woodon);
}
//End
//WoodOff
function serverCmdWoodOff(%client)
{
$woodon = 0;
messageClient(%client,'','\c3Wood is now Off!',$Woodon);
}
//End