Blockland Forums > Modification Help
Toppling entire structures with fakeKillBrick.
<< < (2/3) > >>
Mr. Wallet:
I helped him on ietherpad
Nexus:

--- Quote from: otto-san on August 29, 2011, 10:57:54 PM ---I may just be too tired to think, but this is the code I have right now.


--- Code: ---function testTopple(%obj) { if(%obj.getClassName() $= "fxDTSBrick") { for(%i = 0; %i < %obj.getNumUpBricks(); %i++) { %obj.getUpBrick(%i).fakeKillBrick("0 0 0", 15); } } }
--- End code ---

--- End quote ---

Up bricks are only the bricks that are touching a brick on top.  This is what I did for my Client_Duplicator:



--- Code: ---for(%a=0; %a<buildbot_SavingSO.brickcount; %a++)
{
if(%a >= $buildbot::maxdup)
{
buildbot_SavingSO.brickcount = %a;
break;
}
%homebrick = buildbot_SavingSO.brick[%a];

if(%a) //don't want to get bricks below first one.
{
for(%b=0; %b<%homebrick.getnumdownbricks(); %b++)
{
%testbrick = %homebrick.getdownbrick(%b);

if(buildbot_SavingSO.brickid[%testbrick] $= "")
{
buildbot_SavingSO.brick[buildbot_SavingSO.brickcount] = %testbrick;
buildbot_SavingSO.brickid[%testbrick] = true;
buildbot_SavingSO.brickcount++;
}
}
}

for(%b=0; %b<%homebrick.getnumupbricks(); %b++)
{
%testbrick = %homebrick.getupbrick(%b);

if(buildbot_SavingSO.brickid[%testbrick] $= "")
{
buildbot_SavingSO.brick[buildbot_SavingSO.brickcount] = %testbrick;
buildbot_SavingSO.brickid[%testbrick] = true;
buildbot_SavingSO.brickcount++;
}
}
}
--- End code ---

To adapt this code, you would the loop through all the bricks that were added to buildbot_savingso and fake kill them.
otto-san:
I was adapting it into something that looks similar to that. Thanks to the both of you.
Destiny/Zack0Wack0:
It won't be laggy unless it's a massive structure, and note that there's a limit to the amount of fake killed bricks that will have physics applied to them.
Chrono:

--- Quote from: Destiny/Zack0Wack0 on August 30, 2011, 03:51:20 AM ---It won't be laggy unless it's a massive structure, and note that there's a limit to the amount of fake killed bricks that will have physics applied to them.

--- End quote ---
Wasn't it 400? Let me double check.

Edit: Close.

$pref::Physics::MaxBricks = 300;
This is what it gets set to when you set it to 'best'.
I'm not sure if tweaking this would do anything.
Navigation
Message Index
Next page
Previous page

Go to full version