Call of Duty 4: Prefab

From COD Modding & Mapping Wiki
Share/Save/Bookmark
Jump to: navigation, search
Noobs.png

A prefab is a .map file that represents an instance of an object. Using prefabs makes it easy to place and edit multiple objects quickly. Changes made to a prefab affect all objects built from it. It is also very handy to rotate brush made objects without having the brush information getting corrupted.

Using prefabs

Lets say you have built a large building with a lot of windows. You can make your window once in its own prefab, saving you from having to make the window multiple times. In addition to using its own prefab, you can edit your window in its prefab and it will update all of the other prefabs instantly.

A better example is if you want to change your windows from a wood texture to a metal texture. Before, you would have to do it manually to each window; with a prefab you only need to change it once.

Creating custom prefabs

Create a new .map file in Radiant and build your prefab on the origin (0,0 on the grid). This will make it easier to work with instances of the prefab when added into your main map. Save this file into the prefabs folder along with all the existing prefabs. It is a good idea to create a new folder here to place your prefabs. For example, if you are creating prefabs for your map "mp_testmap", then save your prefabs into "prefabs/mp_testmap/". Now you can add an instance of this prefab into your map by right-clicking on the 2D window and selecting "misc->prefab" and then select your prefab from the location you saved it to. You can then step into an instance and edit it in place if you wish.

Editing prefabs

You can step in and out a prefab in your main map file. Selecting the prefab using Alt + Page Down will allow you to step into the prefab. To step back out from the prefab to the main map file use Alt + Page Up.

Sources

IW Wiki