Talk:Prefab

Insertion problems

I copied a grouped light from a Valve map, and inserting it through pressing Return didn't work. Only "Insert original prefab" worked. Why?? Pressing Return has worked before. The instructions need changing, but first I'd like to sort out thre reasons behind this behavior. Is this because of transfers from map to map, from VALVE map to map, grouping, or something else? --Andreasen 20:26, 16 Sep 2006 (PDT)

Andreasen, I had the same problem. the solution is to add the .vmf document type. I could save on other parts of the hard drive fine but when I saved to the prefab folder it just saved it as a .file .
good luck, Z --Zeviousman 03:14, 4 Sep 2007 (PST)
If you are talking about the bin/prefabs folder, I just tested it, and it works fine. The prefabs I save are automatically ended with ".vmf". Are you using the same folder? --Andreasen 08:25, 21 Sep 2007 (PDT)
Okay, after further discussion with Bluestrike, this seems to vary from user to user. I wonder what is causing this apparent bug. Summary: Apparently, this bug is independent of the Windows version (unless its a Windows XP Professional specific issue), and appears only in the Hammer editor application, so it's definitely a Hammer bug. It might depend on if the prefab is created for an official game or for a 3rd party mod. Bluestrike encountered the bug when creating prefabs in a mod. Please provide further information to establish what exactly is causing this bug. --Andreasen 04:09, 21 Oct 2007 (PDT)

Prefab sources

This article sure could use some more links to popular prefab sites. They're pretty hard to find, most sites only have a handful of them. --RF 10:40, 29 Jan 2007 (PST)

Complex Placement bug?

Been 2 years since anyone has changed this page, however this bug still remains and still makes placing custom prefabs annoying.
Ok scenario is; I've just created a prefab using the "Create Prefab" button in Hammer, now i've closed that map and opened up a totally different map to place my new custom prefab inside.
I select the entity tool and choose my prefab from the Prefabs folder, but this is where i think it is bugged, my prefab does not spawn where i click the mouse, nor when i press "Enter" when using 2D mode.
The prefab is infact inserted in its Original Location from the previous map that i created the Prefab inside of. To fix this is quite an annoying and VERY long process if you have just made 25 prefabs for yourself. (Especially if they contain lots of brushes or models/entities etc)
I have to open each of the VMF Prefabs in notepad, and carefully edit the lines "origin" "X Y Z" where X Y Z is the origin to the center of the world relative to the Hammer grid
Example, i created a prefab for 2 basic entities, logic_auto and env_tonemap_controller...
Here is the original VMF Prefab
Notice the lines "Origin" on both entities...

versioninfo
{
   "editorversion" "400"
"editorbuild" "4271"
"mapversion" "5"
"prefab" "1"

}
world
{
   "id" "3737"
"mapversion" "5"
"classname" "worldspawn"
"skyname" "sky_day01_01"

}
entity
{
   "id" "3738"
"classname" "logic_auto"
"spawnflags" "1"
connections
{
"OnMapSpawn" "env_tonemap,SetAutoExposureMin,0.9,0,-1"
"OnMapSpawn" "env_tonemap,SetAutoExposureMax,1.1,0,-1"
"OnMapSpawn" "env_tonemap,SetBloomScale,1.1,0,-1"
}
"origin" "67.1574 -229.236 73"
editor
{
"color" "220 30 220"
}

}
entity
{
   "id" "3740"
"classname" "env_tonemap_controller"
"targetname" "env_tonemap"
"origin" "63.5744 -187.449 73"
editor
{
"color" "220 30 220"
}

}

Now this is my slightly but carefully edited version (notice the difference in Origin);

versioninfo
{
   "editorversion" "400"
"editorbuild" "4271"
"mapversion" "5"
"prefab" "1"

}
world
{
   "id" "3737"
"mapversion" "5"
"classname" "worldspawn"
"skyname" "sky_day01_01"

}
entity
{
   "id" "3738"
"classname" "logic_auto"
"spawnflags" "1"
connections
{
"OnMapSpawn" "env_tonemap,SetAutoExposureMin,0.9,0,-1"
"OnMapSpawn" "env_tonemap,SetAutoExposureMax,1.1,0,-1"
"OnMapSpawn" "env_tonemap,SetBloomScale,1.1,0,-1"
}
"origin" "0 0 0"
editor
{
"color" "220 30 220"
}

}
entity
{
   "id" "3740"
"classname" "env_tonemap_controller"
"targetname" "env_tonemap"
"origin" "40 0 0"
editor
{
"color" "220 30 220"
}

}

This subtle changes makes a world of difference when placing this small prefab.
the "origin" "X Y Z" for a prefab should NOT be relative to the center of the Hammer grid, instead it should almost read 0 0 0 however if all your objects/entities in the prefab reads 0 0 0 then they will all be placed inside one another.
For the example above, the logic_auto's origin is "0 0 0" which means 0 units on the X plane, 0 on the Y place (verticle) and 0 on the Z plane (Because it's the first entity in the prefab that one entity is OK to have as 0 0 0)
However, the env_tonemap_controller's origin is a bit different because i want it 40 units to the side of the logic_auto.
By now you might have realised how difficult this can be to fix for more than 1 or 2 prefabs especailly when you have alot of brushes
(Brushes are much more complex to fix because you have to worry about the relative position of the brush to the other brush etc.)
Can somebody confirm that it's not just my SDK even tho it's been happening to me since i first started using SDK more than a year ago?
Peace, --Jenkins08 16:13, 4 April 2009 (UTC)

Saving Prefabs (Directory)

In my version of Hammer (for Left4dead maps), prefabs have to be saved to \steamapps\common\left4dead\bin\prefabs\ - this is different to what the wiki says. Should this be added or is it unique for my PC for some reason?

Saving crashing

When I try to save my prefab Hammer crashes. It's a complex prefab with many elements, anyone can help? --erwaitin 09:42, 15 August 2009 (UTC)