Working Instances in Portal 2

Discussion in 'Portal 2' started by Ravidge, Apr 28, 2011.

  1. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,493
    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:
    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.
    [​IMG]
    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: Apr 28, 2011
  2. Ravidge

    aa Ravidge Grand Vizier

    Messages:
    1,544
    Positive Ratings:
    2,493
    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).
     
  3. Steff0o

    Steff0o L6: Sharp Member

    Messages:
    295
    Positive Ratings:
    115
    Do i get all the AS entities aswel?
     
  4. Frizi

    Frizi L1: Registered

    Messages:
    1
    Positive Ratings:
    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: May 7, 2011