1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. I will no longer be hosting XLNation as of March 1, 2017. Unless some one steps forward to take over the domain name and provide hosting XLNation will shutdown. If you are seriously interested in taking on this project and can technically and financially support the project please contact me.

Tutorial Modding for dummies: Small collision, no collision and OWP

This tutorial teaches you how to make a simple mod

  1. Ole
    Modding for dummies-first tutorial of the series

    IMPORTANT INFO
    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:
    [​IMG]
    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:
    [​IMG]
    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.

    Requirements:
    -Pakunpak
    - 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:
    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:
    [​IMG]
    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.
    If you open data folder inside your unpack folder, it should look like this:
    [​IMG]
    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 .
    Text explanation
    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.

    Picture explanation
    [​IMG]
    Next:
    [​IMG]
    COPY^^
    Then:
    [​IMG]
    Next:
    [​IMG]
    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:
    Text explanation:
    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:
    Code:
     <Tag>Commerce;Hotel;T4;MS18;GemCity;PRIVATE;UnqualifiedWorker;HolidayHotel;NOZAC</Tag>
    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.
    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:
    Small collision:

    Go to the <collisionshape> part of the file, what looks like this:
    Code:
     <CollisionShape>
                <Dimension>60,80</Dimension>
                <Height>69.59999847</Height>
                <FundamentHeight>40</FundamentHeight>
                <Use>1</Use>
            </CollisionShape> 
    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.
    continue in the SMALL collision box or the NO collision box spoiler
    SMALL 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> 
    NO collision box:
    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:
    Code:
     <CollisionShape>
                <Dimension>0,0</Dimension>
                <Height>69.59999847</Height>
                <FundamentHeight>40</FundamentHeight>
                <Use>1</Use>
            </CollisionShape> 
    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>0</Use>
            </CollisionShape> 
    Also change the
    Code:
    <MustConnectToRoad>1</MustConnectToRoad>
    to
    Code:
    <MustConnectToRoad>0</MustConnectToRoad>
    to prevent the game saying it's not connected and showing a red dot

    OWP
    Search the <placement> part in the file, it looks like this:
    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>
    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>
    ……
    </placement>
    To make the building OWP, change the GroundType to ANY:
    Code:
     <Placement>
            <Type>BUILDING</Type>
            <GroundType>ANY</GroundType>
            <DelegatePrototype>""</DelegatePrototype>
            <OverPickable>1</OverPickable>
            <Merge>0</Merge>
            <LinkPrototypeFile>""</LinkPrototypeFile>
    ……
    </placement>
    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/_t4
    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:
    D:/myfirstmod/data/design/buildings
    The design and buildings folders aren’t mandatory, but I strongly advice to use them.
    [​IMG]
    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
    [​IMG]
    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.

    Results:
    [​IMG]
    As you can see, the building is now fully OWP and has a small collision box

    Pre-requisites for your mods:
    -UIM

    Tutorial files and the mod I made:
    http://sharesend.com/wklqizoo

    Extra info
    -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:
    Code:
    XML ParseError, while parsing "ï": 
    make sure the coding is set to ANSI and not to UTF-8 BOM
    -if you’re getting an error while packing in Pakunpak, try to run it as admin

Recent Reviews

  1. Andrea Simone
    Andrea Simone
    5/5,
    Thanks for sharing, useful!
  2. Miguel
    Miguel
    5/5,
    Thanks for sharing this tutorial. Very well explained.
  3. Peter912
    Peter912
    5/5,
    A very useful and simple tutorial!