Author Topic: Trying to make a brick but it's not appearing....  (Read 1226 times)

So I made this function....
Code: [Select]
function serverCmdmakeabrick(%client)
{
messageclient(%client,'',"Hello.");
%pxp = mFloor(getWord(%client.player.getTransform(),0));
%pyp = mFloor(getWord(%client.player.getTransform(),1));

     %brick = new fxDTSBrick()
    {
client = %client;
datablock = "brick4xCubeData";
position = %pxp SPC %pyp SPC "10";
rotation = "0 0 0 0";
colorID = 6;
scale = "1 1 1";
angleID = "0";
colorfxID = "0";
shapefxID = "0";
isPlanted = 1;
stackBL_ID = %client.BL_ID;
    };

    $server::BrickCount++;
}
When I type /makeabrick the server's brick count goes up and it says hello but there is no brick to be seen. Can anyone help explain this?

you have to call %brink.plant(); after creating it i think

Code: [Select]
function serverCmdmakeabrick(%client)
{
messageclient(%client,'',"Hello.");
%pxp = mFloor(getWord(%client.player.getTransform(),0));
%pyp = mFloor(getWord(%client.player.getTransform(),1));

     %brick = new fxDTSBrick()
    {
client = %client;
datablock = "brick4xCubeData";
position = %pxp SPC %pyp SPC "10";
rotation = "0 0 0 0";
colorID = 6;
scale = "1 1 1";
angleID = "0";
colorfxID = "0";
shapefxID = "0";
isPlanted = 1;
stackBL_ID = %client.BL_ID;
    };
%brick.plant();
    $server::BrickCount++;
}
That dose the same thing, can't see the brick.

This worked for me:
Code: [Select]
%brk = new fxDTSBrick()
{
      position = ijuststuffbrix;
      datablock = brick4x4Fdata;
};
%brk.plant();

Replace position with what you want though, and datablock too.

Don't set isPlanted = 1; in the datablock. Don't set stackBL_ID either.

You should look at other add-ons for an example of how to do this. There is more to it than what you are doing.

This worked for me:
Code: [Select]
%brk = new fxDTSBrick()
{
      position = ijuststuffbrix;
      datablock = brick4x4Fdata;
};
%brk.plant();

Replace position with what you want though, and datablock too.

Code: [Select]
function serverCmdmakeabrick(%client)
{
messageclient(%client,'',"Hello..");
%pxp = mFloor(getWord(%client.player.getTransform(),0));
%pyp = mFloor(getWord(%client.player.getTransform(),1));

%brk = new fxDTSBrick()
{
      position = %pxp SPC %pyp SPC 10;
      datablock = brick4x4Fdata;
};
%brk.plant();

}

Strangely enough that doesn't do anything for me.
Code: [Select]
function serverCmdmakeabrick(%client)
{
messageclient(%client,'',"Hello...");
%pxp = mFloor(getWord(%client.player.getTransform(),0));
%pyp = mFloor(getWord(%client.player.getTransform(),1));

     %brick = new fxDTSBrick()
    {
client = %client;
datablock = "brick4xCubeData";
position = %pxp SPC %pyp SPC "10";
rotation = "0 0 0 0";
colorID = 6;
scale = "1 1 1";
angleID = "0";
colorfxID = "0";
shapefxID = "0";
    };
%brick.plant();
    $server::BrickCount++;
}


And neither does that.
(except they both say hello)

I guess I'll do what Ephialtes is saying and look at other mods.

My problem wasn't with the code at all!
It was just that I was making the brick 270 studs below the ground!
(though Ephialtes  is probably right on what he said)

You don't have to floor the position ever. The brick will automatically snap to the grid.

You don't have to floor the position ever. The brick will automatically snap to the grid.
I understand that but I need to make sure they are rounded down always, as that's how the rest of the mod that I needed this for works.

Quote from: DrenDran link=topic=117939.msg2456914#msg2456914
position = %pxp SPC %pyp SPC 10;

Floating bricks. As far as the brick datablock is a plate, just use the player height. I could maybe dig up the /fire command from World RPG.
« Last Edit: July 05, 2010, 12:12:59 AM by Bauklotz »

copy-paste from my RTB forum post:

Floating brick script:

Code: [Select]
function serverCmdFloatBrick(%client, %h)
  {
   %brick = %client.player.tempBrick;
   %pos = %brick.getPosition();

   %newPos = VectorAdd(%pos, "0 0 "@ %h );

   %newBrick = new fxDtsBrick()
    {
     position  = %newpos;
     rotation  = %brick.rotation;
     dataBlock = %brick.getDataBlock();
     angleId   = %brick.angleId;
     colorId   = %brick.colorId;
     colorFxId = %brick.colorFxId;
     shapeFxId = %brick.colorFxId;
     client    = %client;
    };

   %newBrick.plant();
   %newBrick.setTrusted(1);
   %client.brickGroup.add(%newBrick);
   }


how to use:
- place a ghost brick.
- type: /floatbrick <number>

this makes a floating brick above your temp brick.
You can build on it just fine -- but you cannot hammer it.
If you build a brick on it, and then undo that brick the whole thing will be destroyed.

Use at your own risk & Enjoy!

You also need to set rendering and collision and whatnot.

This is how i make my bricks.
Code: [Select]
%brick=new fxDTSbrick()
{
client=%client;
dataBlock= %this.getDatablock();
isBaseplate= %this.isBasePlate;
position= %positionX SPC %positionY SPC %positionZ;
rotation=%this.rotation;
scale="1 1 1";
colorID = %this.getColorID();
colorFXID = %this.getColorFXID();
printid = %this.printid;
};
%brick.setTrusted(1);
%brick.plant();
%client.brickGroup.add(%brick);
$Server::BrickCount++;

This is how i make my bricks.
Code: [Select]
%brick=new fxDTSbrick()
{
client=%client;
dataBlock= %this.getDatablock();
isBaseplate= %this.isBasePlate;
position= %positionX SPC %positionY SPC %positionZ;
rotation=%this.rotation;
scale="1 1 1";
colorID = %this.getColorID();
colorFXID = %this.getColorFXID();
printid = %this.printid;
};
%brick.setTrusted(1);
%brick.plant();
%client.brickGroup.add(%brick);
$Server::BrickCount++;
Me two but I rarely make brick's :P