Blockland Forums > Help
30000+ Bricks Eventing
(1/1)
Freeze:
Alright: I'm making a railway and basically I forgeted up big time. I need to make about 30000 - 50000 bricks all be  have collision on.

Luckily I named all the railway tracks 'rails'. The problem is when I do the basic OnActivate > NamedBrick > SetColliding > CheckBox it says to many events. I try to raise the schedule amount but I think it's to high sadly.

Please help me. :c
phflack:
modify this

--- Quote from: Chrono on February 16, 2010, 11:12:13 PM ---This will only work for the default colorset, and YOUR bricks.

%bg=localClientConnection.brickgroup; for(%x=0;%x<%bg.getCount();%x++){%b=%bg.getObject(%x);if(%b.getColorID() == 2){%b.setColliding(0);%b.setRayCasting(0);}}

All of that on one line.

--- End quote ---
Lugnut:

--- Quote from: phflack on February 26, 2012, 12:28:25 PM ---modify this

--- End quote ---
Let me break this up for you.


--- Code: ---%bg=localClientConnection.brickgroup; for(%x=0;%x<%bg.getCount();%x++){%b=%bg.getObject(%x);if(%b.getColorID() == 2){%b.setColliding(0);%b.setRayCasting(0);}}
--- End code ---


--- Code: ---%bg=localClientConnection.brickgroup;
--- End code ---
This defines %bg as your brick group. In case you didn't know, blockland breaks up all the bricks into ownership as per brickgroup_blidhere
EG:Brickgroup_16807


--- Code: ---for(%x=0;%x<%bg.getCount();%x++)
--- End code ---

This loops through every brick in your brickgroup and does the stuff within the brackets.


--- Code: ---{%b=%bg.getObject(%x);
--- End code ---
%b is the brick, you can do anything with the brick from here. You could destroy them all, fakekill them all, etc.


--- Code: ---if(%b.getColorID() == 2)
--- End code ---

This is an if statement. If the statement inside of the parenthesis is correct, do the stuff inside of the brackets. "getColorID()" will return the color ID of the brick. In most colorsets, red is 0. In any colorset, the color in the top left of your paint pallet will be 0, followed by 1 (going down)


--- Code: ---{%b.setColliding(0);%b.setRayCasting(0);}
--- End code ---

This is sort of self explanatory.
Navigation
Message Index

Go to full version