Difference between revisions of "Mapadd Scripts"

From Obsidian Conflict Wiki
Jump to: navigation, search
(Known limitations/bugs)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[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.
+
 
 +
== Description ==
 +
 
 +
Before we start, let me explain valves script format a bit. Brackets like these { } act like code blocks. They tell the engine where to look for information on the category above it.
  
 
Example:
 
Example:
Line 16: Line 18:
 
As you can see if I want to add comments that the engine will ignore, I use the forward slash twice before typing.
 
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
+
== Manual method Tutorial ==
  
 
Obsidian mapadd scripts allow you to make changes to current maps and add new entities such as NPCs or physical objects.
 
Obsidian mapadd scripts allow you to make changes to current maps and add new entities such as NPCs or physical objects.
Line 144: Line 146:
  
 
Please keep all further questions about this in this thread.
 
Please keep all further questions about this in this thread.
 +
 +
== Hammer method tutorial ==
 +
 +
The [http://www.obsidianconflict.net/forums/viewtopic.php?t=1432 Zteer's Mapadd Generator] allows you modificate a map with scripts using Hammer. This way is by far better than the manual method, since when you decompile a map and edit and add entities in Hammer, you can save the edited vmf and compare it to the original decompiled vmf. The program will extract the changes and put them in a mapadd file.
 +
 +
== Known limitations/bugs ==
 +
 +
*A brush entity cannot be added.
 +
*The output of a brush entity cannot be deleted or changed.
 +
*There is a key which cannot be changed depending on the kind of entity.
 +
*There is an entity which cannot be added depending on a kind.
 +
*A template entity cannot be changed.
 +
*The change of a brush is not reflected.
 +
*You cant parent an entity to a func brush entity (or to another entity, is unknown).
 +
 +
If those limitations/bugs can be fixed is unknown, but Zteer recently said that he would revise the Mapadd generator in order to improve it as he can.
  
 
[[Category:MapTuts]]
 
[[Category:MapTuts]]

Latest revision as of 10:13, 10 March 2012


Description

Before we start, let me explain valves script format a bit. 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 method 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.

Hammer method tutorial

The Zteer's Mapadd Generator allows you modificate a map with scripts using Hammer. This way is by far better than the manual method, since when you decompile a map and edit and add entities in Hammer, you can save the edited vmf and compare it to the original decompiled vmf. The program will extract the changes and put them in a mapadd file.

Known limitations/bugs

  • A brush entity cannot be added.
  • The output of a brush entity cannot be deleted or changed.
  • There is a key which cannot be changed depending on the kind of entity.
  • There is an entity which cannot be added depending on a kind.
  • A template entity cannot be changed.
  • The change of a brush is not reflected.
  • You cant parent an entity to a func brush entity (or to another entity, is unknown).

If those limitations/bugs can be fixed is unknown, but Zteer recently said that he would revise the Mapadd generator in order to improve it as he can.