Working Instances in Portal 2

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,818
PART 1: Setting up hammer to fix func_instance + portal 2

If you're using a custom .fgd to map for portal 2 atm, and you've tried to place some func_instances you will without a doubt have noticed that it's kinda broken.
All portal 2 entities will spawn at 0,0,0 on compile (and leak if that is outside the level). Which makes it impossible to instance any of the new stuff.

Well. Randdalf and I have been working on trying to get this fixed for a couple of days now, and we've found some interesting stuff. Mainly that it actually does in fact work.

How to get instances working in your portal 2 sdk:
1) Get http://dl.dropbox.com/u/1085379/swarm.fgd and put it in your Steam/Steamapps/common/alien swarm/bin/ folder (you may want to backup the existing one, just in case).
You should not change the name of this file.

2) go to Steam/Steamapps/common/Portal 2/Portal2/ Open gameinfo.txt and make sure that it says:
GameData "swarm.fgd"
near the top of the file (line 5).

3) Open hammer and set it to load only your new swarm.fgd and nothing else.
Save and restart the SDK just to be sure.

And that should be it, you should be able to continue mapping for portal just as you did before these changes, but now func_instance works with portal entities too.

================================================

PART 2: How to use instances
Go to where ever you keep your vmf files. Usually a folder called "mapsrc" but this may vary. Unzip this small instance sample archive http://dl.dropbox.com/u/1281220/instances_sample.zip into that folder. You should now have a new folder called "instances" with a couple of vmf files inside it.

Next, go into hammer, place a func_instance and set the "VMF filename" keyvalue to for example "instances/cube_dropper_clean.vmf" (minus quote marks). There's a browse button there, but it rarely works so just type manually.
Set the "Fix Up Name" keyvalue to whatever you like. This will act as the regular targetname (or Name) you see on other entities.
Leave the rest as default.
Hit apply and close the properties window. If you don't have a massive cube dropper in your map now, you have either put the vmf files in the wrong place, or not typed in the path to it correctly on the VMF filename.
Your map must also be saved before instances can be loaded into it!

If you do have a massive cube dropper, congratulations.

Here's an example logic_auto set up to target the instance that I set the fix up name of to "cubedropper1". It tells it to drop one cube, and then continue to drop a cube when the current one gets dissolved/fizzled.
logic_auto_instances.png

They work, they just look like broken outputs.

================================================

I'm working on getting more instances ready. Most importantly the elevators and level transition entities. I have most of it working, but still some parts that are being uncooperative.

If you have problems with/suggestions for this guide please leave a message and I'll try to help.
 
Last edited:

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,818
If anyone tries this, It would be great to report back if it worked or not.
I may very well have forgotten a step or two, it was very messy to get it to work the first time (since we tried several setups and methods before finding one that worked).
 

Steff0o

L6: Sharp Member
May 31, 2009
295
132
Do i get all the AS entities aswel?
 

Frizi

L1: Registered
Apr 30, 2011
1
0
It doesn't work for me or I'm doing something wrong (probably not). Still looking for a way to do so, with no luck. I cant understand why its broken (wiki says it works with alien swarm and I thought it depends on vbsp). Can you explain it more precisely?

@edit:
the solution is:
-edit instance
-select all
-tools->center origins
-save

easy...
 
Last edited: