Mapadd Scripts

From Obsidian Conflict Wiki
Revision as of 05:37, 8 March 2008 by Skidz (talk | contribs)
Jump to: navigation, search

Zteer's Mapadd Generator is a great tool for doing this. When you decompile a map and edit and add entities, you save the new vmf and compare it to the decompiled vmf. The program will extract the changed and put them in a mapadd file. Great little program, check it out!

Before we start, let me explain valves script format abit. Brackets like these { } act like code blocks. They tell the engine where to look for information on the category above it.

Example:

We have a Classname keyword you use to search for a specific classname to edit or remove.

Code:

Classname
{
//Put information here!
}


As you can see if I want to add comments that the engine will ignore, I use the forward slash twice before typing.

Manual Tutorial

Obsidian mapadd scripts allow you to make changes to current maps and add new entities such as NPCs or physical objects.

Scripts are located in the obsidian\maps\cfg folder.

First off lets add a new npc to a map.

Since you may not have the source to the map you will need to get coordinates for the object you want to place. Please keep in mind that you can decompile a map and get coordinates without having to do any real work in-game. Download VMEX to decompile maps.

To manually get coordinates in-game, move to the location you want your ent to spawn, and type status in the console. To open the console press the tilde key (~). This looks like a good place, on the snow hill.


If the console doesn't come up go into options and under keyboard press advanced... Turn on Enable Developer Console in this window and close. Back in game the console should come up with the tilde key (~).

Now when you type status in console you will get a window that looks like this.


The area I have boxed in red is what you need, shows your current location in the map.

Now what shall we put here... A citizen named joe thats red and has an smg weapon.

For entity information open Valve Hammer and create a new map. In this map create an npc_citizen or whatever you want and in its properties type in anything you want.


Now save this map with the new ents to the desktop or a place you can access it. Open the VMF file in notepad. This is what you should see.


The area I have highlighted is what you need. Now create a new txt document. Name it, [mymap]_modify Replace [mymap] with the name of your map.

Place this document in the obsidian\maps\cfg folder. Open and inside it should look like this, based off the information from the VMF file you exported from hammer.


In place of origin fill in the location you got from the console as I have in the screenshot above. Save this file and load up the map. And look what we have here, our red citizen ready for action!


Other useful commands in the modify scripts are Modify, Remove, and SpawnItems.

Spawnitems works like this.

Code:

SpawnItems
   {
      "weapon_smg1" "1"
      "weapon_uzi" "2"
      "item_battery" "1"
      "item_ammo_smg1" "3"
      "weapon_healer" "1"
   }

Any weapons added after SpawnItems will be given to each player as the default spawn items.

Remove works like this.

Code:

Remove
   {
      Classname
      {
         "prop_physics" {}
      }

      Targetname
      {
         "lawlfire1" {}
      }

      Origin
      {
         "178 446 9" {}
      }
   }


Classname will remove all entities under the entity category prop_physics, Targetname will remove all entities with the name lawlfire1 and origin will remove entities with that particular origin.

Modify works like this.

Code:

Modify
   {
      Classname
      {
         "npc_combine_s"
         {
            "rendermode" "2"
            "renderamt" "200"
         }
      }

      Targetname
      {
         "pet_headcrab"
         {
            "targetname" "txtcrab"
         }
      }

      Origin
      {
         "64 -424 14"
         {
            "angles" "0 0 90"
            "rendermode" "2"
            "renderamt" "150"
         }
      }
   }


Same as remove, all entity category npc_combine_s will have those values changed on them. Targetname will change the entity with the name pet_headcrab and Origin will change ents at that origin.

For a good example of how this should all look in the txt files open the map modify files in the obsidian\maps\cfg folder.

Please keep all further questions about this in this thread.