Author Topic: Spawning a brick to a grid  (Read 759 times)

How would i check if a brick is existing, then spawn bricks in a square grid where there are no bricks?

would i use 2 for loops?
like
for(%x = getWords(%loc,0,1)-5; %x < getWords(%loc,0,1)+5; %x+=Somethinghere)
  {
    again for y
      {
        block stuff here with x and y as locations and z static?
      }
  }

%block = new fxDTSBrick()
   {
               %obj = %this.player;
      datablock = brick4xCubeData;
      %loc = %obj.getTransform();
      position = getWords(%loc,0,1) getWords(%loc,0,2) 12;
      isPlanted = 1;
      colorID = 1;
      client = %client;
      };

You need to be more clear. Do you want a script that will only give you positions that align with a 4xCube grid?

You need to be more clear. Do you want a script that will only give you positions that align with a 4xCube grid?
Yes

Something involving use of modulus like this:
51 - (51 % 5)

I don't think modulus works with decimals though, so you'll have to do some math there.

%posToGrid = mFloatLength(getWord(%pos,0)/2,0)*2 SPC mFloatLength(getWord(%pos,1)/2,0)*2 SPC 1+mFloatLength(getWord(%pos,2)/2,0)*2;

That'll lock positions into the 4x cube grid.
« Last Edit: September 07, 2012, 08:53:03 PM by TripNick »