%player = %client.getControlObject();
if(!isObject(%player))
return;
%start = %player.getEyePoint();
%scld = vectorScale(%player.getEyeVector(), 5);
%end = vectorAdd(%start, %scld);
%result = containerRaycast(%start, %end, $Typemasks::FxBrickObjectType, %client.player);
//BEEP BEEP, BUILDMODE COMING THROUGH
if(%client.buildmode == 1 && %client.bmstock !$= "")
{
%mat = getWord(%client.bmstock, 1);
%amt = getWord(%client.bmstock, 0);
%pos = posFromRaycast(%result);
%pos = vectorAdd(%pos, "0 0 0.2");
if(%pos $= "" || %amt <= 0)
return;
if(%mat $= "Silver")
{
%db = SilverBrickData;
%color = 46;
%client.removeFromBP(%mat, 1);
}
else if(%mat $= "Iron")
{
%db = IronBrickData;
%color = 51;
%client.removeFromBP(%mat, 1);
}
else if(%mat $= "Steel")
{
%db = SteelBrickData;
%color = 49;
%client.removeFromBP(%mat, 1);
}
else if(%mat $= "String")
{
%db = StringBrickData;
%color = 1;
%client.removeFromBP(%mat, 1);
}
else if(%mat $= "WoodPlank")
{
%db = WoodPlankBrickData;
%color = 57;
%client.removeFromBP(%mat, 1);
}
else
{
%client.chatMessage("\c3You aren't allowed to place that item.");
return;
}
if(!isObject(%db))
return;
%brick = new fxDTSBrick()
{
datablock = %db;
position = %pos;
isPlanted = 0;
colorID = %color;
client = %client;
};
Brickgroup_888888.add(%brick);
%error = %brick.plant();
talk(%error);
if(%error)
{
%client.chatMessage("\c3Plant Error!");
if(isObject(%brick))
%brick.schedule(33, delete);
%client.addToBP(%mat, 1);
}
%client.bmstock = %amt - 1 SPC %mat;
return;
}
//BUILDMODE ENDED
I'm having troubles, again. I'd artificially place a brick on a baseplate, but it would give me error code 1. If I understand correctly, it's saying there is something it's colliding with. I saw that it was being placed a little bit into the baseplate. So, as you may have seen, I elevated %pos by 0.2 on the Z axis. This works fine, but whenever you try to place any brick on top of it, or within a 1 stud radius to it, it refuses to plant because of collision errors. I checked, and it isn't at some weird height compared to any regular bricks. Anyone know what this is about?