Modding for dummies-first tutorial of the series
I've heard questions about this and I though, let's get this clear:
-your mod ONLY exists from the class files, no need to add the ddstextures, layout files, sgbins and localizations
-if there is no <GroundType>ANY</GroundType> in the <placement> section, add it yourself
-don't use windows notepad for your mod, use Notepad ++ instead (and make sure the coding is set to ANSI in the coding menu in Notepad++)
Question test results:
As you can see, the NO collision box mods work, except that they say they aren't connected to the road, I've updated that part of the tutorial to fix that.
The third building is the suggestion of Lextacy to use a collision box of 0,80 meters, which has the extra that even when the two buildings are exactly on eachother, you can place them though eachother. And you can place the back side through for example roads now. Here's an example:
The German Pack building has a collision box of 1,40 and the hotel a collision box of 0,80
I hope the 0 meters wide collision box will work for more buildings, time will tell, I'll keep the 1 meters wide collision box in the tutorial in case the 0 wide doesn't work for all buildings
This tutorial might seem hard with all the code, but it's the easiest you can get with modding.
This tutorial is about making buildings small/no collision and Over Water Placeable
ATTENTION: A mod like this with just one or a couple buildings isn’t enough to be uploaded on the XL Exchange. If you want to make a mod that is, you should make a pack with more than 30 buildings with a small collision box or OWP
Be aware that your mod could be in conflict with other mods if it adds a small collision version of the SAME building.
Making a small collision/ OWP version of a MOD can be a bit different, so pay attention and always test it before you share it. Some modders won’t be glad if you make a new XLEX entry for your addon, if the modder is still active please discuss before uploading.
- Notepad ++
-unpacked Cities XL
First, make sure you have all cities xl game files unpacked. There are other tutorials on this site that explain how to do that in more detail, I will give a quick explanation below:
If you open data folder inside your unpack folder, it should look like this:First, make sure you have moved all your mods out of the paks folder before you begin, just cut and paste it in another folder. (it will work if there are mods in the paks folder, but there is a chance that you pick a mod file instead of a game file when you are modding and the game of people who don’t have that mod (where the mod file is from) will crash when they use your mod.)
Then open pakunpak go to outils(French)/Tools (English and select décompresser tout CXL (French)/ Unpack CXL (English). You’ll get this window:
Select the location of your paks folder and the folder you want it to unpack to (be aware that the folder is gonna be 6gb+)
Then press décompresser(French)/Uncompress(English) and let it work for about half an hour.
This time, we are interested in the design folder, you can open it now.
When you open it, you see a shitload of folders, don’t worry about it. Basically we’re just interested in the “buildings” folder, you can open it.
Okay, okay, just as much folders as the previous one, and this time we’re interested in almost every one of them.
Now the hard part, finding the building that you saw in game, the one you want to be small collision or over water placeable, maybe even both. If you remember the in-game icon, you should open a new tab and go back to the “data” folder again. This time you’ll click interface and then ddstexture. If it’s a normal building, click buildings. You’ll see a list of pictures, if you can’t see the pictures, even with the ‘big icon’ mode on you should find yourself a “dds” viewer, because these pictures are .dds .
If you have found your building in the icon list, cope its name and go back to the folder you had already opened. This folder is full of .class files, and if you search for the name of that dds icon you found, a class file with the same name will pop up, open it.
When you open the class file you’ll see a lot of code, we’re interested in a couple of sub-sections of the code:
The first section we’re interested in is the menu location, aka the tag. Changing this is needed for both over water mods as small collision mods. This is a code line that tells the game where to show to model. Browse the file for a code that looks like this:
Except if you want to change it to a whole other location, it’s very easy: Change MS18 to MSNOCOLLISION if you want it in the small collision box menu or change MS18 to MSOVERWATER if you want it in the OWP menu. If you want it in the custom content menu, change MS18 to MSCUSTOM.Code:<Tag>Commerce;Hotel;T4;MS18;GemCity;PRIVATE;UnqualifiedWorker;HolidayHotel;NOZAC</Tag>
BE CAREFUL: You HAVE to change this, you won’t be able to see which one is no collision/OWP or the real version if you don’t
Now to the next step:
Go to the <collisionshape> part of the file, what looks like this:
The code tells us that the building is 60 meters wide by 80 meters long by 69,5 meters high. We don’t have any problems with the height, except if you want the building to go through something like a bridge.Code:<CollisionShape> <Dimension>60,80</Dimension> <Height>69.59999847</Height> <FundamentHeight>40</FundamentHeight> <Use>1</Use> </CollisionShape>
continue in the SMALL collision box or the NO collision box spoiler
SMALL collision box:
NO collision box:We can’t really change how long the collision box is because the mid of the collision box is in the centre of the building, so if you change that, the snap-to-road location will be in the middle of the building.
What we can change is how wide the building is, which can be really useful when you want to place buildings through another building. So let’s change it to 1. It will look like this now:
Code:<CollisionShape> <Dimension>1,80</Dimension> <Height>69.59999847</Height> <FundamentHeight>40</FundamentHeight> <Use>1</Use> </CollisionShape>
Be careful, I know how this method works but I could have made a small mistake. I haven't tested this mod yet, please be careful when testing
To have no collision box at all, change both dimensions to 0:
If you want to be able to move it up and down as well, change <use> to 0 as well:Code:<CollisionShape> <Dimension>0,0</Dimension> <Height>69.59999847</Height> <FundamentHeight>40</FundamentHeight> <Use>1</Use> </CollisionShape>
Also change theCode:<CollisionShape> <Dimension>0,0</Dimension> <Height>69.59999847</Height> <FundamentHeight>40</FundamentHeight> <Use>0</Use> </CollisionShape>
to prevent the game saying it's not connected and showing a red dotCode:<MustConnectToRoad>0</MustConnectToRoad>
Now, for both the OWP and the small/no collision mod, add something to the description part of the name of the class file. Don’t change too much though, and make sure that it’s a unique name, and there isn’t another file called like that, or will ever be. (The description part is the part before _t1/_t2_/_t3/_t4Search the <placement> part in the file, it looks like this:
That’s a lot of code, let’s cut (imaginary, not in your file) it to the part we need:Code:<Placement> <Type>BUILDING</Type> <GroundType>TERRAIN</GroundType> <DelegatePrototype>""</DelegatePrototype> <OverPickable>1</OverPickable> <Merge>0</Merge> <LinkPrototypeFile>""</LinkPrototypeFile> <Terraform> <Enabled>1</Enabled> <LevelWidth>15</LevelWidth> <CutWidth>0</CutWidth> <UseDefault>1</UseDefault> <DigDepth>0.3000000119</DigDepth> <AngleMax>60</AngleMax> <HeightMax>20</HeightMax> <Type>NORMAL</Type> </Terraform> <LayerConstraint> <Layer01> <LayerName>Array_Holidays_Posing</LayerName> <MinValue>90</MinValue> </Layer01> </LayerConstraint> <DefaultHeightOffset>0</DefaultHeightOffset> <SnapPlugToPlug>0</SnapPlugToPlug> <LayerDisplay>Array_Holidays_Posing</LayerDisplay> </Placement>
To make the building OWP, change the GroundType to ANY:Code:<Placement> <Type>BUILDING</Type> <GroundType>TERRAIN</GroundType> <DelegatePrototype>""</DelegatePrototype> <OverPickable>1</OverPickable> <Merge>0</Merge> <LinkPrototypeFile>""</LinkPrototypeFile> …… </placement>
Code:<Placement> <Type>BUILDING</Type> <GroundType>ANY</GroundType> <DelegatePrototype>""</DelegatePrototype> <OverPickable>1</OverPickable> <Merge>0</Merge> <LinkPrototypeFile>""</LinkPrototypeFile> …… </placement>
For example, change b_hotr04_t3.class to b_hotr04OLE_t3.class
Save your changed class file to a new “mod folder” (a mod folder is a folder called data inside a folder with any name)
My new mod folder for this mod looks like this:
The design and buildings folders aren’t mandatory, but I strongly advice to use them.
Now the last step, export it to the game:
Open pakunpak and select the data folder in the source tab. Select a save location for your mod, call it something like [your name]_[name of the mod]_v1.0.patch.
Then hit compress
If you haven’t done it yet, place back the mods your moved before unpacking CXL and place your new mod in the paks folder too.
As you can see, the building is now fully OWP and has a small collision box
Pre-requisites for your mods:
Tutorial files and the mod I made:
-If you want a pack of OWP/SC buildings, you can put all class files together in one patch file. (so just place them all in your “mod folder”.
-if the game crashes when you try the mod, and you get this error in your log:make sure the coding is set to ANSI and not to UTF-8 BOMCode:XML ParseError, while parsing "ï":
-if you’re getting an error while packing in Pakunpak, try to run it as admin
XLNation has a new domain name: http://xlnation.city Please make a note and update your browser bookmarks.Dismiss Notice
Tutorial Modding for dummies: Small collision, no collision and OWP
This tutorial teaches you how to make a simple mod