| Blockland Forums > Modification Help |
| Spawning new bricks = multiple problems? |
| (1/3) > >> |
| soba:
package MinifigBrick { function fxDTSbrick::PlantedTrustCheck(%brick) { Parent::PlantedTrustCheck(%brick); if(%brick.GetDatablock().getName() $= brickMinifigV2Data) { %pos = %brick.position; %rot = %brick.rotation; %brick.delete(); new fxDTSbrick() { datablock = "brickLeftShoeData"; isPlanted = 1; position = %pos; rotation = %rot; isTrusted = 1; }; new fxDTSbrick() { datablock = "brickRightShoeData"; isPlanted = 1; position = %pos; rotation = %rot; isTrusted = 1; }; } } }; ActivatePackage(MinifigBrick); This is the code I am using for my upcoming minifig brick, uses the whole brick as a template, then deletes the template and plants each body part seperatly after spawning for decal/paint customization the bricks spawn, they just render and thats it, they don't have any collision, you can't target them with /getId, you can't clear them and they don't appear to count as bricks yes they are meant to be planted in themselves, I know what I'm doing |
| Amade:
--- Code: ---function CreateBrick(%data, %pos, %angleID, %color, %owner, %colorFx, %shapeFx) { %brick = new FxDTSbrick() { datablock = %data; position = %pos; rotation = "0 0 1 " @ %angleID * 90; colorID = %color; scale = "1 1 1"; angleID = %angleID; colorFxID = %colorFx; shapeFxID = %shapeFx; isPlanted = 1; isBaseplate = 1; client = %owner; }; %brick.setTrusted(1); %brick.plant(); if(%owner.brickGroup) { %owner.brickGroup.add(%brick); } $Server::BrickCount++; return %brick; } --- End code --- |
| Port:
--- Code: (Original) ---new fxDTSbrick() { datablock = "brickLeftShoeData"; isPlanted = 1; position = %pos; rotation = %rot; isTrusted = 1; }; --- End code --- --- Code: ---%obj = new fxDTSBrick() { datablock = "brickLeftShoeData"; position = %pos; rotation = %rot; isPlanted = true; }; %obj.setTrusted(true); %obj.plant(); if(isObject(%group = %brick.getGroup())) %group.add(%obj); --- End code --- EDIT: Damn it. :V --- Quote from: Amade on December 09, 2011, 04:06:08 PM --- --- End quote --- |
| soba:
I'm trying to spawn multiple bricks, and if one brick is already parented to %brick, would multiple %brick = new fxDTSbrick's replace it? |
| Ipquarx:
--- Quote from: Amade on December 09, 2011, 04:06:08 PM ---function CreateBrick(%data, %pos, %angleID, %color, %owner, %colorFx, %shapeFx) { %brick = new FxDTSbrick() { datablock = %data; position = %pos; rotation = "0 0 1 " @ %angleID * 90; colorID = %color; scale = "1 1 1"; angleID = %angleID; colorFxID = %colorFx; shapeFxID = %shapeFx; isPlanted = 1; isBaseplate = 1; client = %owner; }; %brick.setTrusted(1); %brick.plant(); if(%owner.brickGroup) { %owner.brickGroup.add(%brick); } $Server::BrickCount++; return %brick; } --- End quote --- Remove the $Server::BrickCount++, %brick.plant does that automatically as far as ive seen, resulting in double the brickcount then there should be. Also, is there any way to prevent a brick from being placed in the same spot through script? I've been working on that problem but I cant figure it out. |
| Navigation |
| Message Index |
| Next page |