Author Topic: How the hell do CityRPG lots work?  (Read 852 times)

Okay, before the thousand screams of hell break my eardrums for mentioning CityRPG, I'd like to note that I'm making my own, from scratch.
Currently, I have two copies of iBan-based CityRPGs. But, the file structure is extremely convoluted and there is hardly any documentation for me to learn off of. This is fine, though. I've been able to figure out how to emulate all of the mechanics the mod has, BUT lots. The code seems to be all over the add-on, and I can't exactly figure out what's doing what.

It seems to have something to do with triggers. I already have the code for creating them, and have made the bank menu bricks with them.

My first problem is that I need people to only be able to plant lots on the ground.
So, in order to restrict it to lots only, I'd hammer this onto the plant function:
%plantedBrick = %client.brickGroup.getObject(%client.brickGroup.getCount() - 1);
if(%plantedBrick.getDistanceFromGround() == 0 && %plantedBrick.getdataBlock().subcategory !$= "Lots")
{
      %plantedBrick.delete();
}

So this restricts us from planting lot baseplates, the first thing. I'm able to figure out how to make them cost money on my own. I just need to figure out how to build on top of them without spending additional money, and the no-cost planting being restricted to the baseplate's area. Any help? I'll continue digging around the CityRPG code.
Edit: This might have something to do with it. It handles creating lots, and makes a trigger for them if they don't have any.
« Last Edit: May 04, 2015, 09:09:26 PM by Johnny Blockhead »

This will trap you in a corner. Use fxDTSBrick::OnPlant and build a hierchy from there. (Branch: if(%brick.getDataBlock().getName() $= ...){..} if(...){..}

Also, try to search, yes search, don't let people spell it out for you, a method to get the brick below a brick and from then figure out IF there's a brick below the brick. Coding help search is a good place to start.

%error = %brick.plant();

Usually this returns a type of error

Thanks guys. I got it working.