Blockland Forums > Modification Help
Find all bricks (oh ya its solved)
Swollow:
Why doesn't this work?
for(%i=0;%i<ClientGroup.GetCount();%i++)
{
%bg = ClientGroup.GetObject(%i);
for(%a=0;%a<%bg.getCount();%a++)
{
%bg.getObject(%a).brickUnLocked = 0;
}
}
CityRPG:
Because you're going through the client group, and then going through objects attached to the client, which will be nothing.
--- Code: ---for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
%bg = mainBrickGroup.getObject(%a);
for(%b = 0; %b < %bg.getCount(); %b++)
{
%brick = %bg.getObject(%b);
// Do Stuff
}
}
--- End code ---
Lugnut:
that is soooo pertaining to my add-on >.>
Swollow:
--- Quote from: CityRPG on February 09, 2012, 08:27:15 PM ---Because you're going through the client group, and then going through objects attached to the client, which will be nothing.
--- Code: ---for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
%bg = mainBrickGroup.getObject(%a);
for(%b = 0; %b < %bg.getCount(); %b++)
{
%brick = %bg.getObject(%b);
// Do Stuff
}
}
--- End code ---
--- End quote ---
thanks new kalphiter Iban
--- Quote from: Lugnut1206 on February 09, 2012, 08:37:12 PM ---that is soooo pertaining to my add-on >.>
--- End quote ---
I'm making a mod that the bricks become locked when they are loaded
DontCare4Free:
--- Quote from: swollow on February 09, 2012, 10:21:29 PM ---I'm making a mod that the bricks become locked when they are loaded
--- End quote ---
Something like
--- Code: ---package bleh {
function FxDTSBrick::onLoadPlant(%this) {
if (%lock) {
%this.locked = true;
}
parent::onLoadPlant(%this);
}
}; activatePackage(bleh);
--- End code ---
?