Because I have no loving clue how to work out Blender nor the .blb files, I decided to go oldschool.
I've got this
function buildComplexBrick(%brk, %client, %i) {
echo(1);
%bricks = %brk.getDatablock().complexBuild[0];
echo(2);
//while(i < %bricks) {
%data = getField(%brk.getDatablock().complexBuild[i],0);
%rx = getField(%brk.getDatablock().complexBuild[i],1);
%ry = getField(%brk.getDatablock().complexBuild[i],2);
%rz = getField(%brk.getDatablock().complexBuild[i],3);
%col = getField(%brk.getDatablock().complexBuild[i],4);
%rota = getField(%brk.getDatablock().complexBuild[i],5);
%rotb = getField(%brk.getDatablock().complexBuild[i],6);
%rotc = getField(%brk.getDatablock().complexBuild[i],7);
%rotd = getField(%brk.getDatablock().complexBuild[i],8);
%print = getField(%brk.getDatablock().complexBuild[i],9);
echo(3);
%newbrick = new fxDTSBrick() {
dataBlock = %data;
scale = "1 1 1";
client = %client;
stackBL_ID = %client.BL_ID;
angleID = "0";
colorID = %col;
colorFXID = "0";
//shapeFXID = "0";
isPlanted = true;
rotation = %rota TAB %rotb TAB %rotc TAB %rotd;
print = %print;
};
echo(4);
%newbrick.setTransform(%brk.x+%rx SPC %brk.y+%ry SPC %brk.z+%rz);
echo(5);
%newbrick.plant();
%newbrick.setTrusted(1);
echo(6);
%client.brickGroup.add(%newbrick);
echo(7);
%i++;
//schedule(0,0,"buildComplexBrick",%brk, %client, %i);
//}
}
and in the test datablock, the following:
complexBrick = true;
complexBuild[0] = 2;
complexBuild[1] = "bick2x2Data 0.5 0.5 0.4 48 rot1 rot0 rot0 rot0 0";
complexBuild[2] = "brick2x2crestLowdata 0.5 0.5 1 45 rot1 rot0 rot0 rot0 0";
//format: Datablock retaliveX relativeY relativeZ color rot1 rot2 rot3 rot4 printID
Now, here's the thing. I swear on my Blockland Key that I have no clue what is wrong with the code. Whenever I get the ID of a brick to try out buildComplexBrick();, it returns the following in the console:
1
2
3
base/server/scripts/allGameScripts.cs (21116): Unable to find object: '0' attempting to call function 'onRemove'
BackTrace: ->buildComplexBrick->fxDTSBrick::onRemove
Add-Ons/Server_[secret, lol]/server.cs (68): Register object failed for object (null) of class fxDTSBrick.
4
Add-Ons/Server_[secret, lol]/server.cs (70): Unable to find object: '0' attempting to call function 'setTransform'
BackTrace: ->buildComplexBrick
5
Add-Ons/Server_[secret, lol]/server.cs (72): Unable to find object: '0' attempting to call function 'plant'
BackTrace: ->buildComplexBrick
Add-Ons/Server_[secret, lol]/server.cs (73): Unable to find object: '0' attempting to call function 'setTrusted'
BackTrace: ->buildComplexBrick
6
Set::add: Object "0" doesn't exist
7
So the brick isn't created. Alright. Except that I don't know what causes it to not create. Particularly because of fxDTSBrick::onRemove which isn't in my code and I doubt it has something to do with new fxDTSbrick();
Could someone point me in the right direction? I've used the search function and compared codes but one of the two solutions isn't posted and the second one is pretty hard to interpret because the OP posted parts of his code instead of the entire function.