function fxDTSBrick::replaceBrick(%this, %newBrick)
{
%brickOffset = ((%newBrick.getDataBlock().brickSizeZ / 5) / 2) - ((%this.getDataBlock().brickSizeZ / 5) / 2);
%brickGroup = getBrickGroupFromObject(%this);
%posX = getWord(%this.position, 0);
%posY = getWord(%this.position, 1);
%posZ = getWord(%this.position, 2) + %brickOffset;
%this.delete();
%newBrick.setTransform(%posx SPC %posy SPC %posz);
%newBrick.plant();
%newBrick.setTrusted(1);
%brickGroup.add(%newBrick);
}
Everything works for this besides it appears that the new brick doesn't actually exist. I can't use a wrench on it or delete it or anything, but it shows up in my brick count. If I use killBrick instead of delete it works though. The only thing wrong with that is I don't want the sound and animation that comes with it.