FANDOM


Introduction Edit

This tutorial will teach you how to spawn bricks.



Script Edit

Spawning a 1x1 brick Edit

%posx = 1;
%posy = 1;
%posz = 1;

%temp = new fxDTSBrick()
{
    datablock = "brick1x1Data";
    position = %posx SPC %posy SPC %posz;
    rotation = "0 0 0 0";
    colorID = "1";
    scale = "1 1 1";
    angleID = "0";
    colorfxID = "0";
    shapefxID = "0";
    isPlanted = 1;
};

To spawn a brick with a rainbow effect or other special effects, use the following script:

%posx = 1;
%posy = 1;
%posz = 1;

%temp = new fxDTSBrick()
{
    datablock = "brick1x1Data";
    position = %posx SPC %posy SPC %posz;
    rotation = "0 0 0 0";
    scale = "1 1 1";
    angleID = "0";
    colorfxID = "7";
    shapefxID = "0";
    isPlanted = 1;
};

Simply change the number on the "colorfxID = "7"" line to whatever FX you like.

1 None
2 Pearl
3 Chrome
4 Glow
5 Blink
6 Swirl
7 Rainbow
8 Stable

To set the alternate animated FX, set the "shapefxID = "0"" line.

0 None
1 Undulo
2 Water Brick FX

CreateBrick Function Edit

This is a function created by Xalos which allows creating bricks owned by clients - or not, if you prefer.

function createBrick(%cl, %data, %pos, %color, %angleID)
{
	if(!isObject(%data) || %data.getClassName() !$= "fxDTSBrickData")
		return -1;
	if(getWordCount(%pos) != 3)
		return -1;
	if(%angleID $= "")
		%angleID = 0;
	if(isObject(%cl) && (%cl.getClassName() $= "GameConnection" | %cl.getClassName() $= "AIConnection"))
	{
		%blid = %cl.bl_id;
		if(%blid $= "")
			%blid = -1;
		%flag = 1;
	}
	else if(isObject(%cl) && %cl.getClassName() $= "SimGroup" && MainBrickgroup.isMember(%cl))
		%group = %cl;
	else
		%cl = 0;
	switch(%angleID)
	{
		case 0:
			%rot = "1 0 0 0";
		case 1:
			%rot = "0 0 1 90";
		case 2:
			%rot = "0 0 1 180";
		case 3:
			%rot = "0 0 -1 90";
	}
	(%brick = new fxDtsBrick()
	{
		client = %cl;
		colorFxID = 0;
		colorID = %color;
		datablock = %data;
		isPlanted = 1;
		position = getWord(%pos, 0) SPC getWord(%pos, 1) SPC getWord(%pos, 2);
		rotation = %rot;
		shapeFxID = 0;
		stackBL_ID = %blid;
	}).angleID = %angleID;
	%err = %brick.plant();
	%brick.setTrusted(1);
	missionCleanup.add(%brick);
	if(%flag)
		%cl.brickgroup.add(%brick);
	else if(isObject(%group))
		%group.add(%brick);
	return %brick TAB %err;
}

An example of using this function in a script is:
createBrick(0, brick1x4Data, "0 3 0.5", 0, 1);

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.