Difference between revisions of "Mapadd Scripts"

From Obsidian Conflict Wiki
Jump to: navigation, search
Line 1: Line 1:
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!
+
[http://www.obsidianconflict.com/forums/viewtopic.php?t=1432 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.
 
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.
Line 28: Line 28:
 
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.
 
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.
  
 
+
[[Image:Mapadd1.jpg]]
  
 
If the console doesn't come up go into options and under keyboard press advanced...
 
If the console doesn't come up go into options and under keyboard press advanced...
Line 35: Line 35:
 
Now when you type status in console you will get a window that looks like this.
 
Now when you type status in console you will get a window that looks like this.
  
 
+
[[Image:Mapadd2.jpg]]
  
 
The area I have boxed in red is what you need, shows your current location in the map.
 
The area I have boxed in red is what you need, shows your current location in the map.
Line 44: Line 44:
 
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.
 
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.
  
 
+
[[Image:Mapadd3.jpg]]
  
 
Now save this map with the new ents to the desktop or a place you can access it. Open the VMF file in notepad.
 
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.
 
This is what you should see.
  
 
+
[[Image:Mapadd4.jpg]]
  
 
The area I have highlighted is what you need. Now create a new txt document. Name it, [mymap]_modify
 
The area I have highlighted is what you need. Now create a new txt document. Name it, [mymap]_modify
Line 57: Line 57:
 
Open and inside it should look like this, based off the information from the VMF file you exported from hammer.
 
Open and inside it should look like this, based off the information from the VMF file you exported from hammer.
  
 
+
[[Image:Mapadd5.jpg]]
  
 
In place of origin fill in the location you got from the console as I have in the screenshot above.
 
In place of origin fill in the location you got from the console as I have in the screenshot above.
Line 63: Line 63:
 
And look what we have here, our red citizen ready for action!
 
And look what we have here, our red citizen ready for action!
  
 
+
[[Image:Mapadd6.jpg]]
  
 
Other useful commands in the modify scripts are Modify, Remove, and SpawnItems.
 
Other useful commands in the modify scripts are Modify, Remove, and SpawnItems.

Revision as of 04:45, 8 March 2008

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.

Mapadd1.jpg

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.

Mapadd2.jpg

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.

Mapadd3.jpg

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.

Mapadd4.jpg

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.

Mapadd5.jpg

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!

Mapadd6.jpg

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.