LOKIOLR
Enthusiast
Hello everyone,
Sorry this took so long to post. I just haven't had a lot of free time away from the baby to work on stuff like this. I hope this is somewhat complete enough to get people on the right track. Sorry, it's a bit long winded. Anyways without further ado, here is the object and vehicle placement tutorial (map editing).
THE FINE ART OF MAP EDITING: OBJECT AND VEHICLE PLACEMENT
GETTING STARTED:
Map editing in GTA4 or EFLC isn't too difficult to do it just takes a lot of planning and testing. Until somebody comes up with or decides to share an easier way of doing this, this will have to work for now. Here are some things you'll need to do these mods:
*A pc copy of Grand Theft Auto IV or Episodes From Liberty City (it doesn't really matter which since most map mods are interchangeable)
*Simple Native Trainer (This is for doing
layout work to generate your object/vehicle placement coordinates)
*OpenIV or SparkIV (for extracting files and rebuilding RPF & IMG files)
*GTA IV Placement Tool 2.2 by Daegon (for editing the XPL files)
*IV Placement Editor by Chipsman (for checking your work, more on that later...)
*XBOX Backup Creator (for extracting and replacing files off your GTA ISO)
*A Jtagged XBOX 360 (optional, but recommended, for testing so you're not blowing through discs)
*A dump of the Episodes From Liberty City ISO (optional, but it will save you time from constantly having to copy files from the retail disc)
1) Setting up your static objects with the Simple Native Trainer.
With your selected PC version of GTA4 and Simple Native Trainer installed, launch GTA4 and activate the Simple Native Trainer using the hot key (F3). Using the Object Spawner layout the map objects (not vehicles, we'll get to that in a bit) you'd like to add. If you aren't feeling creative you can simply download a pre-made object.ini file from one of the many websites hosting them (like http://www.gta4-mods/misc, just make sure they're from one of the recent versions of the Simple Native Trainer. Older versions of the object.ini files were missing the correct rotation data which results in the objects spawning, but they are all rotated wrong).
If you decide to load a pre-made file make sure you make a backup of any object.ini file that may be in your root directory of your GTA4 installation (for example: C:/Program Files/Rockstar Games/GTA4 or
C:/Program Files (x86)/Rockstar Games/GTA4 for a 64 bit OS). Under the object spawning menu you'd select "Load Objects from objects.ini". This will spawn the objects contained in that file. Check to see if everything looks OK, and make any changes that you want to make, then save the objects to the objects.ini file by selecting the menu item "Save All Spawned Objects to objects.ini".
If you are creating stuff from scratch you can use some of the preloaded object selections available in the object spawning menu (like skate ramps, shipping containers, boat ramps, etc.) or you can spawn specific objects using the "spawn object by entering model hash or model name" option. I find that GTAMODDING.com has a good list of object names and hashes for your reference. Remember, not all objects are solid, so you'll have to play around a bit until you find objects that work well for you.
2) Setting up your new vehicle spawns with the Simple Native Trainer.
I usually wait until the end of my map editing before I add vehicles. What we're going to do now is get coordinates for your spawn points by placing an object where you want to spawn your vehicle. I normally use a small object like CJ_APPLE_1 to mark my spawn points. Simply place your objects to mark your spawns and save them with the objects.ini file by using the "Save All Spawned Objects to objects.ini" menu item. Take note of how many object spawns you have created. Once that is done you can move on to the next step.
3) Adding your objects to the XPL files.
If you don't have a copy of your console version of GTA4 or EFLC dumped to your hard drive then you'll need to use the XBOX Backup Creator to copy and extract the XBOX360.RPF file from the root directory of the game disc since you'll need that file to have access to the map XPL files. Once you have the XBOX360.RPF file open it in either SparkIV or OpenIV. Once you have it open navigate to the DATA/MAPS/ directory. In here you'll see a bunch of folders referencing the real life locations in NYC which correspond to the sections of Liberty City. Pick a file to edit from within those directories and extract it to your PC. It doesn't seem to matter which file you use because your objects will spawn anywhere on the map regardless which file you use. For example, I use the Happiness Island XPL file, nj_liberty.xpl for all my edits so far. Open the extracted file in the GTA IV Placement Tool 2.2. Also at this time you'll want to open the object.ini file you created in a text editor like Notepad.
Once you have your XPL file open you have a couple options with how you go about adding items. The GTA IV Placement Tool 2.2 is a little buggy so there are a few things you'll want to remember when editing:
* It's a good idea to export your XPL to a DAT file using the menu item in the GTA IV Placement Tool 2.2.
* Only enter in coordinate up to 3 digits past the decimal point. Anymore and the file won't save properly.
* Make sure to keep backups for your XPL files because it's easy to accidentally delete lines in them.
The first method is to just edit within the GTA IV Placement Tool 2.2.
Sometimes the program will error out if you try to save. Usually this is caused by having a number under one of the columns with more than 3 digits past the decimal or a mismatch with the number of lines that are actually in the file versus the number of lines the program shows under "section info" are there. The latter of the two usually occurs when doing vehicle spawns (more on that later).
The second method is to export your loaded XPL file as a DAT using the menu item in the GTA IV Placement Tool 2.2. Open the DAT file in a text editor like notepad, make and save your edits, then import your DAT file back into a newly created, blank XPL file in GTA IV Placement Tool 2.2. With either method you'll need to follow the steps below.
With your objects.ini file open you'll notice the spawned objects are each listed with their coordinate and rotation values, as well as a model hash number for the object's model name.
To add an object, first add a new line to the file using the menu option or the "insert" key. Once you done that you'll enter your model name in the first column. You can refer to the object.ini file for the hash if you don't remember the object name. You can use the "calculate name from hash" tool to calculate the object name from the hash, just as long as the hash isn't negative. Negative hashes won't work in the tool included in the GTA IV Placement Tool 2.2. Usually I'll try to make note of which objects I use so that I don't run into that problem. Also you can make notes in the object.ini file so you don't forget which hash refers to which object. Don't forget to make a backup of the objects.ini file if you plan on doing that.
The next 3 columns will be the POS X, POS Y, and POS Z coordinates of the object. Copy those from the objects.ini file. They of course are listed under X, Y, and Z in that file. Continue on to do the same with the ROT X, ROT Y, and ROT Z values which are listed under QX, QY, and QZ in the objects.ini file. The next column, ROT W needs to be inverted once it is copied from the objects.ini file under the QW value. So if it's 1.61 in the objects.ini file, it needs to be -1.61 in XPL file.
Honestly the next few I'm not entirely sure what the values mean but here it goes...
Unknown 1 I usually leave at 384. It's worked for me so far.
LOD is left at -1 unless you want to specify an LOD (Low Object Detail) object to use. Honestly, I think that would be a ton of work to get LODs in place as well as other objects. In case you decide to go through with it this column refers to which line number that the LOD entry is on that corresponds with this object.
Unknown 2 is left as a 1 and Unknown 3 as -1.
Just repeat until you have entered all of the items in objects.ini file, making sure not to add the objects you used as placeholders for your vehicle spawns. You'll be using those soon. Before you save your file export it as a DAT file just in case you run into any errors. Now save and if everything went well we can move on.
4) Adding vehicles to your Stream XPL files
Vehicles get added in a similar way as objects but in a completely different file. Stream XPL files contain the spawn data for parked cars and other misc. detail objects like weeds, barriers, etc. The objects in a Stream XPL file do not spawn in online games, so they shouldn’t used for adding objects to the map, unless of course you want some items not to spawn online. The stream files are located in various IMG files under the xbox360/data/maps directory on the game disc. You’ll find a similar directory structure as what was in the xbox360.rpf file. These IMG files contain the textures and object data corresponding to the map files. Also within them are stream XPL files. These files will be named after the file they are contained in. For example within the manhat01.img file you find stream XPLs named manhat01_stream##.xpl. Pick the file you wish to use and open it up in OpenIV or SparkIV. Extract the stream XPL file you plan on using and open it with the GTA IV Placement Tool 2.2.
Pick your method of editing as described in step 3, and continue on. If you use the GTA IV Placement Tool 2.2 you will need to select the stream tab to open the parked car data. You’ll notice its setup similar to the object placement portion of the XPL file. Please note, I usually overwrite lines in these files rather than add new ones. In fact I usually clear out a few lines just to be sure that the file size stays the same if not smaller than the original. This is important since you can’t have the IMG file size end up larger than it originally was.
The first three columns are the X, Y, Z, coordinates of the vehicle you are spawning. Use the coordinates you got from the objects you saved from the Simple Native Trainer to mark the vehicle spawns. Copy those numbers into the corresponding columns.
Unknown4 is still unknown to me. I usually leave this at 0.
Unknown5 & Unknown6 have to do with rotation, I think. I need to play around with it some more. I’ve been using -10 and 6. This hasn’t really been a big deal for me since I haven’t been creating vehicle spawns that I needed to face in a specific direction.
Unknown7 is the vehicle model name hash. To generate that simply use the “calculate hash from name” tool in the GTA IV Placement Tool 2.2. Enter the vehicle name (which would be the same name used in the handling.dat file) and it will calculate a hash value for you. Be sure to enter the positive value in the Unknown7 column. Here’s where the IV Placement Editor comes in handy. You’ll notice that in the GTA IV Placement Tool 2.2 that that column is all zeros. Unfortunately that program doesn’t quite display the stream section correctly. However you can view it correctly in the IV Placement Editor. But that program is unable to edit XPL files. If you do enter a hash value in the GTA IV Placement Tool 2.2 and save it, it will actually save it to the XPL file but it just won’t show up if you reload the file in the GTA IV Placement Tool 2.2.
Also if you’re just looking to swap which car spawns in a specific location on the map you can simply change this value to the desired vehicle model hash and be done with it.
Unknown8 – Unknown11 are all left at -1.
Unknown12 corresponds to the cargrp the vehicle will be associated with. This is different than how you’d normally think of the cargrps, since these vehicles are not driving around. Associating a helicopter to the Ambulance group, for example won’t, all of the sudden, cause helicopters to spawn at all of the hospitals. I leave mine at 1633 which is the Ambulance group. In fact if you left Unknown7 blank it would spawn an ambulance instead. You can use these groups to spawn random cars at a location. They are used in the parking lots this way for example. But the specific vehicles will take on the properties of the group. Ambulances spawn in multiplayer at the hospitals, and at all times of the day, so associating it with a helicopter will cause it to spawn at all times of the day and should allow it to spawn in multiplayer. Certain cargrps are limited to spawning at certain times of the day. Play around with these values until you find something that works best for you.
Unknown13 & Unknown14 are left at zero as well.
Once you have made your edits, save your stream XPL file.
5) Building your modded files.
Using OpenIV or SparkIV overwrite the files you used in their corresponding RPF or IMG files. The stream file would go back in the IMG file you chose to edit. The editing XPL file with your added objects would, of course go back inside the XBOX360.RPF file. Now you’ll want to make sure that the XBOX360.RPF file doesn’t increase in size. To avoid this I’d recommend freeing up space by deleting some of the webpage data from the in-game computers or overwriting them with smaller webpage files. These can be found under the HTML directory in the XBOX360.rpf file. This unfortunately is untested at the moment, but I believe you should be fine as long as you don’t try to access the in-game computers.
EDIT: Overwriting the ingame webfiles and rebuilding the XBOX360.rpf will drop the file size down while letting the game load up as normal. You can chop almost 30MB off the file size using this method. That's way more than you'll need but it's nice to know it can be done. I used aboutus.xhm from the craplist.com folder to overwrite the larger xhm files in other directories. Obviously you probably will crash the game if you use the computer terminals in-game. That's untested but I assume that would be the result.
For IMG files, I usually try to delete a couple of the entries in the stream XPLs to free up space for the vehicles I add. You probably won’t miss a couple random parked car spawns anyways. Just make sure the file size is smaller or the same as the original, unedited file.
Once you’re files are rebuilt you are ready to test. So copy the IMG and/or XBOX360.rpf files to your JTAG system or import them into your ISO using the XBOX Backup Creator.
6) Testing
There are a few things you’ll want to consider when testing your files.
*Make sure your objects are spawning at the right height. Some may need to have their Z axis values tweaked a bit. For example the object NJ04ladder04 spawns about 2.5 units lower than it should from what you have in the Simple Native Trainer. So you’ll need to add 1.5 to whatever value you get in the Simple Native Trainer when you’re adding that object into the XPL file. I find that if something is off it helps to raise or lower the object by small increments
*Make sure you don’t have any major frame rate hits. I found that when I used the MANHAT01.xpl I got lots of slowdown with added objects in the lower Algonquin construction site. When I added those objects to the NJ_LIBERTY.xpl file instead, everything was smooth as silk. You may consider moving your objects from one XPL to another if you experience major slowdown.
*Test everything. That means if, for example, you spawn ladders; make sure you can use your ladders. I ran into trouble with an 8 object ladder up the side of a sky scraper. It worked well in the Simple Native trainer but on the console game the player would fall off midway down, to his death. Make sure everything works well since nobody wants to play on a buggy map.
*Remember map editing takes time. Don’t rush it.
I’m sure there’s stuff I haven’t figured out yet. I know there’s plenty that I haven’t tested yet. If anything it will give you a nudge in the right direction and hopefully we can make corrections and additions as we go along.
ADDITIONAL TUTORIALS AND HELP
TUTORIAL/TOOL: AUTO MAP MOD IMPORT TOOL FOR EXCEL(DOES ABOUT 95% OF THE FORMATTING WORK FOR YOU, AUTOMATICALLY.)
Want to import your modded map files even quicker than before. Now you can using my custom made excel file importing your modded object.ini file couldn't be easier. This tool will format your file properly, the only thing you'll need to do is replace any unknown negative object hashes with the object names.
LOKI's MAP MOD IMPORTER V3.0 FOR EXCEL
Download V3
Change Log:
V3:
Now can calculate supported positive and negative hashes
Added Support for calculating 161 negative object hashes
Hash lists can be added to as more unknown hashes are found
V2:
Calculates all positive object hashes supported by the Item Placement Tool 2.2
V1:
First release
You'll notice the object hash and object hash negative tabs at the bottom of the file. You can add any additional hashes you run into that are unsupported here. I'll try to update it as we find object hashes that aren't supported.
Thanks to Cathering(Punishment) for the Negative Hash Calculator, and LCBradley3K for his work on the official negative hash thread (all of which were added to the list)
Here's a step by step tutorial on using this file:
Step 1: Click this link to download the Map Mod Import Tool for Excel V3.0. (Compatible with all versions of Microsoft Excel and Open Office Calc)
Step 2: Open the downloaded XLS file in Excel or an Excel compatible program.
Step 3: Open your object.ini file you wish to import in a text editor such as Notepad. Select everything in the object.ini file(CTRL+A) and copy (CTRL+C).
Step 4: In the 2nd tab of the Excel file marked "Paste Object.ini Contents Here" select cell A1 (the upper-leftmost cell) and Paste (CTRL+V) Your Excel sheet should look similar to the picture below. Tabs are located at the bottom of the Excel sheet. Refer to the picture below.
Step 5: Click on the 1st tab of the Excel file marked "Processed File". You should see your formatted object.ini file like the picture below.
Step 6: Select Save-As and save the file as a .CSV file. Feel free to name it whatever you'd like. It will ask you if you want to save only the active sheet in that format and leave out the rest. Select YES. It will then say that the file contains features that are incompatible with the CSV format. Select Yes again.
Step 7: From here you can either reload the saved CSV file in Excel or Notepad. You'll then use the Find & Replace function to replace the any left over negative object hash values in column A(highlighted in yellow on the picture below) with the object names. These hash values can be calculated by using the Simple Native Trainers spawn by hash value tool in the Object Spawning menu (see what object spawns when you enter the hash in) or by using [Click here to view this link] to convert those negative hashes into positive ones. I'd recommend if you use his tool that you replace the values in the object.ini before loading it in to be converted. It will save you from having to look up the hashes later on.
That's it. Note: You do not need to do any of the formatting from the other excel tutorial below. The W Rotation value has already been inverted, values rounded up to 3 decimal points, and extra columns have been already added.
TUTORIAL: USING MICROSOFT EXCEL TO QUICKLY IMPORT OBJECTS INTO AN XPL FILE
Using this method you can import large sets of object into the item placement tool and an xpl in just minutes.
You will need the following:
*An objects.ini file with your edits created from the simple native trainer
*A copy of Microsoft Excel (doesn't matter which version and other similar programs may work) or if you don't have Excel, CALC from http://www.openoffice.org will work just the same.
*The Item Placement Tool 2.2
*Notepad or other text editor
*An extracted XPL that you wish to add objects to.
Step 1 Preparing for Excel:
Open your objects.ini file, select all (ctrl-a) and copy the entire contents of the file (ctrl-c).
Open Excel and start a new blank workbook. Paste your copied content into the first cell (A:1) in the top left corner of the worksheet. You should now have the same contents in this excel file as you did in the objects.ini
Step 2 Sorting and Formatting:
In column B, type 1 - 11 in each cell below. Once you have the first set of numbers typed, highlight them, select copy, then select the rest of the column down to the last row of your objects.ini data in column A and select paste. What you should get after pasting is each number lining up with the same portion of each object for every object. See the picture below to see what you're trying achieve.
Once you have that completed, highlight columns A and B and select sort. Sort by column B.
Once you've sorted everything we're going to start arranging the data to a format similar to what's in the xpl files. With each number in column cut and past the data into columns following column B. You'll end up with something like the picture below.
Once that's done, you can delete the following columns (refer to the picture above if you're unsure): A,B,D,F,H,I,J,L,N,P,R,T,U,V.
Move your column with the model numbers (column D, the one with the "Model=" lines in it) to column A.
Now we have everything where it needs to be to move on to the next step.
Step 3 Cleaning it up:
Now to get rid of the extra date in each cell. To remove the x=, y=, z=, etc. portions of each cell, we'll need to use the find and replace tool. I usually work backwards from qw= to model=. Open the replace tool and enter qw= in the top text box (find what), leave the bottom text box (replace with) blank. Select replace all, and you'll get a confirmation that the changes were made. Do this for each column. Once you are done you should only have numbers in the columns, no text, like below.
Replace the hash in column a with it's appropriate item name. You can use the simple native trainer (spawn by hash) or item placement tool's calculate name by hash tool to find it. Use the replace option to replace these quickly. The hash value would go in the top text box, object name in the bottom, then replace all. Do this for every item in that column. You are done when only object names remain in column A.
Next highlight columns B through H and select format cells. Under the number tab, select number and make sure the drop down box marked decimal places is set to 3.
Next thing to do is to inverse the ROTW column. To do this fill column I with the number -1 for the entire length of your data. Select that column, copy, and paste special on column H. Select Multiply from the menu.
Finally we need to add the missing columns. For this you'll fill in the following into the next few columns 384,-1,1,1. See below for how it should look.
Finally it's time to save. Select save-as and change the file type to .csv as shown below.
Step 4: It's all coming together
Open the item placement tool and then open your xpl you plan to add objects to. Once it's open select Export To DAT. This will create a text file which we'll be adding our data to then reimporting into the program.
Open your newly created DAT file and CSV file in notepad. Copy the contents of the CSV file and paste them at the bottom of [SECTION0] in the DAT file right before the [ENDSECTION] tag. Now save the changed DAT file.
Reopen the Item Placement tool and select CREATE -- XENON PLACEMENT FILE. It will ask you to name it. Choose a name and hit OK. Next select Import from DAT. Select the newly edited DAT file you created and hit OK. You should now have your original XPL file with plus the objects you imported from the objects.ini file.
TA DA!
TUTORIAL: DEBUGGING FLOATING POINT ERRORS IN THE ITEM PLACEMENT TOOL
Getting frustrated with the item placement tool? Running into errors and corrupt files with repeating entries? I can help...
It is actually a pretty easy fix. Here's what you'll want to do. Once you have all of your objects entered into the item placement tool, try to save.
If you get the floating point error, before you exit the program or close the file, use the export to dat function in the file menu. Open that newly created dat file in notepad or another text editor.
Next close the item placement tool then reopen it as well as your xpl file. Scroll down the corrupted xpl file in the item placement tool. You should get to a point where stuff looks like it's repeating. For example:
Object 1.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Ok, so like in the example above you will want to pin down where it begins repeating. In the example above it would be. The 2nd line, y axis value (highlighted in blue). Because if you notice after the object name and the 1st coordinate (x axis) it starts to repeat the values above it.
So what you'll need to do is in that exported dat file you'll want to find that same object line (of course in the dat file it won't be corrupted.) So using the example above let's pretend this 2nd line was the problem line from above.
Object 1.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 3.009 4.123 5.32 0.001 0 0.3 384 -1 1 -1
You can see that the y axis is not the same as the corrupted file. So to fix this problem all you would need to do is add or subtract 0.001 to the value of the entry that is giving you problems. In this case it would be the 3.009 entry so you'd edit that entry in the dat file to 3.01 or 3.008. Once you've done that, save your dat file and close and reopen the item placement tool.
This time select create new xenon placement list (xpl). It will prompt you for a file name enter either the same name of the file you are editing or anything else, just be sure to add the .xpl extension to the file name when selecting it. It will then open a blank file fir you. Now use the import from dat function and re-import the data from your dat file you just edited. Now try to save. If you get an error simply repeat these steps until you've fixed all the problems. If not then awesome. When repeating the step for additional errors it's not necessary to re-export the dat file each time, just keep using the same one, editing out each problem until the file works.
I'm not sure why this program doesn't like certain numbers but it doesn't. It's just what we have to do to get around the limitations of it. You shouldn't notice the .001 shift either on your objects.
I hope that helps and wasn't too confusing. You should only probably have 1 or 2 errors per file, so it will go quick.
***Special thanks to LiteralExertus for pointing out that the GTA IV Placement Tool 2.2 wasn’t displaying the XPL files correctly in the stream section. That information let me figure out that the cargrp number in unknown12 was not actually the vehicle hash. Also to Punishment for his Negative Hash Value Converter. ***
Sorry this took so long to post. I just haven't had a lot of free time away from the baby to work on stuff like this. I hope this is somewhat complete enough to get people on the right track. Sorry, it's a bit long winded. Anyways without further ado, here is the object and vehicle placement tutorial (map editing).
THE FINE ART OF MAP EDITING: OBJECT AND VEHICLE PLACEMENT
GETTING STARTED:
Map editing in GTA4 or EFLC isn't too difficult to do it just takes a lot of planning and testing. Until somebody comes up with or decides to share an easier way of doing this, this will have to work for now. Here are some things you'll need to do these mods:
*A pc copy of Grand Theft Auto IV or Episodes From Liberty City (it doesn't really matter which since most map mods are interchangeable)
*Simple Native Trainer (This is for doing
layout work to generate your object/vehicle placement coordinates)
*OpenIV or SparkIV (for extracting files and rebuilding RPF & IMG files)
*GTA IV Placement Tool 2.2 by Daegon (for editing the XPL files)
*IV Placement Editor by Chipsman (for checking your work, more on that later...)
*XBOX Backup Creator (for extracting and replacing files off your GTA ISO)
*A Jtagged XBOX 360 (optional, but recommended, for testing so you're not blowing through discs)
*A dump of the Episodes From Liberty City ISO (optional, but it will save you time from constantly having to copy files from the retail disc)
1) Setting up your static objects with the Simple Native Trainer.
With your selected PC version of GTA4 and Simple Native Trainer installed, launch GTA4 and activate the Simple Native Trainer using the hot key (F3). Using the Object Spawner layout the map objects (not vehicles, we'll get to that in a bit) you'd like to add. If you aren't feeling creative you can simply download a pre-made object.ini file from one of the many websites hosting them (like http://www.gta4-mods/misc, just make sure they're from one of the recent versions of the Simple Native Trainer. Older versions of the object.ini files were missing the correct rotation data which results in the objects spawning, but they are all rotated wrong).
If you decide to load a pre-made file make sure you make a backup of any object.ini file that may be in your root directory of your GTA4 installation (for example: C:/Program Files/Rockstar Games/GTA4 or
C:/Program Files (x86)/Rockstar Games/GTA4 for a 64 bit OS). Under the object spawning menu you'd select "Load Objects from objects.ini". This will spawn the objects contained in that file. Check to see if everything looks OK, and make any changes that you want to make, then save the objects to the objects.ini file by selecting the menu item "Save All Spawned Objects to objects.ini".
If you are creating stuff from scratch you can use some of the preloaded object selections available in the object spawning menu (like skate ramps, shipping containers, boat ramps, etc.) or you can spawn specific objects using the "spawn object by entering model hash or model name" option. I find that GTAMODDING.com has a good list of object names and hashes for your reference. Remember, not all objects are solid, so you'll have to play around a bit until you find objects that work well for you.
2) Setting up your new vehicle spawns with the Simple Native Trainer.
I usually wait until the end of my map editing before I add vehicles. What we're going to do now is get coordinates for your spawn points by placing an object where you want to spawn your vehicle. I normally use a small object like CJ_APPLE_1 to mark my spawn points. Simply place your objects to mark your spawns and save them with the objects.ini file by using the "Save All Spawned Objects to objects.ini" menu item. Take note of how many object spawns you have created. Once that is done you can move on to the next step.
3) Adding your objects to the XPL files.
If you don't have a copy of your console version of GTA4 or EFLC dumped to your hard drive then you'll need to use the XBOX Backup Creator to copy and extract the XBOX360.RPF file from the root directory of the game disc since you'll need that file to have access to the map XPL files. Once you have the XBOX360.RPF file open it in either SparkIV or OpenIV. Once you have it open navigate to the DATA/MAPS/ directory. In here you'll see a bunch of folders referencing the real life locations in NYC which correspond to the sections of Liberty City. Pick a file to edit from within those directories and extract it to your PC. It doesn't seem to matter which file you use because your objects will spawn anywhere on the map regardless which file you use. For example, I use the Happiness Island XPL file, nj_liberty.xpl for all my edits so far. Open the extracted file in the GTA IV Placement Tool 2.2. Also at this time you'll want to open the object.ini file you created in a text editor like Notepad.
Once you have your XPL file open you have a couple options with how you go about adding items. The GTA IV Placement Tool 2.2 is a little buggy so there are a few things you'll want to remember when editing:
* It's a good idea to export your XPL to a DAT file using the menu item in the GTA IV Placement Tool 2.2.
* Only enter in coordinate up to 3 digits past the decimal point. Anymore and the file won't save properly.
* Make sure to keep backups for your XPL files because it's easy to accidentally delete lines in them.
The first method is to just edit within the GTA IV Placement Tool 2.2.
Sometimes the program will error out if you try to save. Usually this is caused by having a number under one of the columns with more than 3 digits past the decimal or a mismatch with the number of lines that are actually in the file versus the number of lines the program shows under "section info" are there. The latter of the two usually occurs when doing vehicle spawns (more on that later).
The second method is to export your loaded XPL file as a DAT using the menu item in the GTA IV Placement Tool 2.2. Open the DAT file in a text editor like notepad, make and save your edits, then import your DAT file back into a newly created, blank XPL file in GTA IV Placement Tool 2.2. With either method you'll need to follow the steps below.
With your objects.ini file open you'll notice the spawned objects are each listed with their coordinate and rotation values, as well as a model hash number for the object's model name.
To add an object, first add a new line to the file using the menu option or the "insert" key. Once you done that you'll enter your model name in the first column. You can refer to the object.ini file for the hash if you don't remember the object name. You can use the "calculate name from hash" tool to calculate the object name from the hash, just as long as the hash isn't negative. Negative hashes won't work in the tool included in the GTA IV Placement Tool 2.2. Usually I'll try to make note of which objects I use so that I don't run into that problem. Also you can make notes in the object.ini file so you don't forget which hash refers to which object. Don't forget to make a backup of the objects.ini file if you plan on doing that.
The next 3 columns will be the POS X, POS Y, and POS Z coordinates of the object. Copy those from the objects.ini file. They of course are listed under X, Y, and Z in that file. Continue on to do the same with the ROT X, ROT Y, and ROT Z values which are listed under QX, QY, and QZ in the objects.ini file. The next column, ROT W needs to be inverted once it is copied from the objects.ini file under the QW value. So if it's 1.61 in the objects.ini file, it needs to be -1.61 in XPL file.
Honestly the next few I'm not entirely sure what the values mean but here it goes...
Unknown 1 I usually leave at 384. It's worked for me so far.
LOD is left at -1 unless you want to specify an LOD (Low Object Detail) object to use. Honestly, I think that would be a ton of work to get LODs in place as well as other objects. In case you decide to go through with it this column refers to which line number that the LOD entry is on that corresponds with this object.
Unknown 2 is left as a 1 and Unknown 3 as -1.
Just repeat until you have entered all of the items in objects.ini file, making sure not to add the objects you used as placeholders for your vehicle spawns. You'll be using those soon. Before you save your file export it as a DAT file just in case you run into any errors. Now save and if everything went well we can move on.
4) Adding vehicles to your Stream XPL files
Vehicles get added in a similar way as objects but in a completely different file. Stream XPL files contain the spawn data for parked cars and other misc. detail objects like weeds, barriers, etc. The objects in a Stream XPL file do not spawn in online games, so they shouldn’t used for adding objects to the map, unless of course you want some items not to spawn online. The stream files are located in various IMG files under the xbox360/data/maps directory on the game disc. You’ll find a similar directory structure as what was in the xbox360.rpf file. These IMG files contain the textures and object data corresponding to the map files. Also within them are stream XPL files. These files will be named after the file they are contained in. For example within the manhat01.img file you find stream XPLs named manhat01_stream##.xpl. Pick the file you wish to use and open it up in OpenIV or SparkIV. Extract the stream XPL file you plan on using and open it with the GTA IV Placement Tool 2.2.
Pick your method of editing as described in step 3, and continue on. If you use the GTA IV Placement Tool 2.2 you will need to select the stream tab to open the parked car data. You’ll notice its setup similar to the object placement portion of the XPL file. Please note, I usually overwrite lines in these files rather than add new ones. In fact I usually clear out a few lines just to be sure that the file size stays the same if not smaller than the original. This is important since you can’t have the IMG file size end up larger than it originally was.
The first three columns are the X, Y, Z, coordinates of the vehicle you are spawning. Use the coordinates you got from the objects you saved from the Simple Native Trainer to mark the vehicle spawns. Copy those numbers into the corresponding columns.
Unknown4 is still unknown to me. I usually leave this at 0.
Unknown5 & Unknown6 have to do with rotation, I think. I need to play around with it some more. I’ve been using -10 and 6. This hasn’t really been a big deal for me since I haven’t been creating vehicle spawns that I needed to face in a specific direction.
Unknown7 is the vehicle model name hash. To generate that simply use the “calculate hash from name” tool in the GTA IV Placement Tool 2.2. Enter the vehicle name (which would be the same name used in the handling.dat file) and it will calculate a hash value for you. Be sure to enter the positive value in the Unknown7 column. Here’s where the IV Placement Editor comes in handy. You’ll notice that in the GTA IV Placement Tool 2.2 that that column is all zeros. Unfortunately that program doesn’t quite display the stream section correctly. However you can view it correctly in the IV Placement Editor. But that program is unable to edit XPL files. If you do enter a hash value in the GTA IV Placement Tool 2.2 and save it, it will actually save it to the XPL file but it just won’t show up if you reload the file in the GTA IV Placement Tool 2.2.
Also if you’re just looking to swap which car spawns in a specific location on the map you can simply change this value to the desired vehicle model hash and be done with it.
Unknown8 – Unknown11 are all left at -1.
Unknown12 corresponds to the cargrp the vehicle will be associated with. This is different than how you’d normally think of the cargrps, since these vehicles are not driving around. Associating a helicopter to the Ambulance group, for example won’t, all of the sudden, cause helicopters to spawn at all of the hospitals. I leave mine at 1633 which is the Ambulance group. In fact if you left Unknown7 blank it would spawn an ambulance instead. You can use these groups to spawn random cars at a location. They are used in the parking lots this way for example. But the specific vehicles will take on the properties of the group. Ambulances spawn in multiplayer at the hospitals, and at all times of the day, so associating it with a helicopter will cause it to spawn at all times of the day and should allow it to spawn in multiplayer. Certain cargrps are limited to spawning at certain times of the day. Play around with these values until you find something that works best for you.
Unknown13 & Unknown14 are left at zero as well.
Once you have made your edits, save your stream XPL file.
5) Building your modded files.
Using OpenIV or SparkIV overwrite the files you used in their corresponding RPF or IMG files. The stream file would go back in the IMG file you chose to edit. The editing XPL file with your added objects would, of course go back inside the XBOX360.RPF file. Now you’ll want to make sure that the XBOX360.RPF file doesn’t increase in size. To avoid this I’d recommend freeing up space by deleting some of the webpage data from the in-game computers or overwriting them with smaller webpage files. These can be found under the HTML directory in the XBOX360.rpf file. This unfortunately is untested at the moment, but I believe you should be fine as long as you don’t try to access the in-game computers.
EDIT: Overwriting the ingame webfiles and rebuilding the XBOX360.rpf will drop the file size down while letting the game load up as normal. You can chop almost 30MB off the file size using this method. That's way more than you'll need but it's nice to know it can be done. I used aboutus.xhm from the craplist.com folder to overwrite the larger xhm files in other directories. Obviously you probably will crash the game if you use the computer terminals in-game. That's untested but I assume that would be the result.
For IMG files, I usually try to delete a couple of the entries in the stream XPLs to free up space for the vehicles I add. You probably won’t miss a couple random parked car spawns anyways. Just make sure the file size is smaller or the same as the original, unedited file.
Once you’re files are rebuilt you are ready to test. So copy the IMG and/or XBOX360.rpf files to your JTAG system or import them into your ISO using the XBOX Backup Creator.
6) Testing
There are a few things you’ll want to consider when testing your files.
*Make sure your objects are spawning at the right height. Some may need to have their Z axis values tweaked a bit. For example the object NJ04ladder04 spawns about 2.5 units lower than it should from what you have in the Simple Native Trainer. So you’ll need to add 1.5 to whatever value you get in the Simple Native Trainer when you’re adding that object into the XPL file. I find that if something is off it helps to raise or lower the object by small increments
*Make sure you don’t have any major frame rate hits. I found that when I used the MANHAT01.xpl I got lots of slowdown with added objects in the lower Algonquin construction site. When I added those objects to the NJ_LIBERTY.xpl file instead, everything was smooth as silk. You may consider moving your objects from one XPL to another if you experience major slowdown.
*Test everything. That means if, for example, you spawn ladders; make sure you can use your ladders. I ran into trouble with an 8 object ladder up the side of a sky scraper. It worked well in the Simple Native trainer but on the console game the player would fall off midway down, to his death. Make sure everything works well since nobody wants to play on a buggy map.
*Remember map editing takes time. Don’t rush it.
I’m sure there’s stuff I haven’t figured out yet. I know there’s plenty that I haven’t tested yet. If anything it will give you a nudge in the right direction and hopefully we can make corrections and additions as we go along.
ADDITIONAL TUTORIALS AND HELP
TUTORIAL/TOOL: AUTO MAP MOD IMPORT TOOL FOR EXCEL(DOES ABOUT 95% OF THE FORMATTING WORK FOR YOU, AUTOMATICALLY.)
Want to import your modded map files even quicker than before. Now you can using my custom made excel file importing your modded object.ini file couldn't be easier. This tool will format your file properly, the only thing you'll need to do is replace any unknown negative object hashes with the object names.
LOKI's MAP MOD IMPORTER V3.0 FOR EXCEL
Download V3
Change Log:
V3:
Now can calculate supported positive and negative hashes
Added Support for calculating 161 negative object hashes
Hash lists can be added to as more unknown hashes are found
V2:
Calculates all positive object hashes supported by the Item Placement Tool 2.2
V1:
First release
You'll notice the object hash and object hash negative tabs at the bottom of the file. You can add any additional hashes you run into that are unsupported here. I'll try to update it as we find object hashes that aren't supported.
Thanks to Cathering(Punishment) for the Negative Hash Calculator, and LCBradley3K for his work on the official negative hash thread (all of which were added to the list)
Here's a step by step tutorial on using this file:
Step 1: Click this link to download the Map Mod Import Tool for Excel V3.0. (Compatible with all versions of Microsoft Excel and Open Office Calc)
Step 2: Open the downloaded XLS file in Excel or an Excel compatible program.
Step 3: Open your object.ini file you wish to import in a text editor such as Notepad. Select everything in the object.ini file(CTRL+A) and copy (CTRL+C).
Step 4: In the 2nd tab of the Excel file marked "Paste Object.ini Contents Here" select cell A1 (the upper-leftmost cell) and Paste (CTRL+V) Your Excel sheet should look similar to the picture below. Tabs are located at the bottom of the Excel sheet. Refer to the picture below.
Step 5: Click on the 1st tab of the Excel file marked "Processed File". You should see your formatted object.ini file like the picture below.
Step 6: Select Save-As and save the file as a .CSV file. Feel free to name it whatever you'd like. It will ask you if you want to save only the active sheet in that format and leave out the rest. Select YES. It will then say that the file contains features that are incompatible with the CSV format. Select Yes again.
Step 7: From here you can either reload the saved CSV file in Excel or Notepad. You'll then use the Find & Replace function to replace the any left over negative object hash values in column A(highlighted in yellow on the picture below) with the object names. These hash values can be calculated by using the Simple Native Trainers spawn by hash value tool in the Object Spawning menu (see what object spawns when you enter the hash in) or by using [Click here to view this link] to convert those negative hashes into positive ones. I'd recommend if you use his tool that you replace the values in the object.ini before loading it in to be converted. It will save you from having to look up the hashes later on.
That's it. Note: You do not need to do any of the formatting from the other excel tutorial below. The W Rotation value has already been inverted, values rounded up to 3 decimal points, and extra columns have been already added.
TUTORIAL: USING MICROSOFT EXCEL TO QUICKLY IMPORT OBJECTS INTO AN XPL FILE
Using this method you can import large sets of object into the item placement tool and an xpl in just minutes.
You will need the following:
*An objects.ini file with your edits created from the simple native trainer
*A copy of Microsoft Excel (doesn't matter which version and other similar programs may work) or if you don't have Excel, CALC from http://www.openoffice.org will work just the same.
*The Item Placement Tool 2.2
*Notepad or other text editor
*An extracted XPL that you wish to add objects to.
Step 1 Preparing for Excel:
Open your objects.ini file, select all (ctrl-a) and copy the entire contents of the file (ctrl-c).
Open Excel and start a new blank workbook. Paste your copied content into the first cell (A:1) in the top left corner of the worksheet. You should now have the same contents in this excel file as you did in the objects.ini
Step 2 Sorting and Formatting:
In column B, type 1 - 11 in each cell below. Once you have the first set of numbers typed, highlight them, select copy, then select the rest of the column down to the last row of your objects.ini data in column A and select paste. What you should get after pasting is each number lining up with the same portion of each object for every object. See the picture below to see what you're trying achieve.
Once you have that completed, highlight columns A and B and select sort. Sort by column B.
Once you've sorted everything we're going to start arranging the data to a format similar to what's in the xpl files. With each number in column cut and past the data into columns following column B. You'll end up with something like the picture below.
Once that's done, you can delete the following columns (refer to the picture above if you're unsure): A,B,D,F,H,I,J,L,N,P,R,T,U,V.
Move your column with the model numbers (column D, the one with the "Model=" lines in it) to column A.
Now we have everything where it needs to be to move on to the next step.
Step 3 Cleaning it up:
Now to get rid of the extra date in each cell. To remove the x=, y=, z=, etc. portions of each cell, we'll need to use the find and replace tool. I usually work backwards from qw= to model=. Open the replace tool and enter qw= in the top text box (find what), leave the bottom text box (replace with) blank. Select replace all, and you'll get a confirmation that the changes were made. Do this for each column. Once you are done you should only have numbers in the columns, no text, like below.
Replace the hash in column a with it's appropriate item name. You can use the simple native trainer (spawn by hash) or item placement tool's calculate name by hash tool to find it. Use the replace option to replace these quickly. The hash value would go in the top text box, object name in the bottom, then replace all. Do this for every item in that column. You are done when only object names remain in column A.
Next highlight columns B through H and select format cells. Under the number tab, select number and make sure the drop down box marked decimal places is set to 3.
Next thing to do is to inverse the ROTW column. To do this fill column I with the number -1 for the entire length of your data. Select that column, copy, and paste special on column H. Select Multiply from the menu.
Finally we need to add the missing columns. For this you'll fill in the following into the next few columns 384,-1,1,1. See below for how it should look.
Finally it's time to save. Select save-as and change the file type to .csv as shown below.
Step 4: It's all coming together
Open the item placement tool and then open your xpl you plan to add objects to. Once it's open select Export To DAT. This will create a text file which we'll be adding our data to then reimporting into the program.
Open your newly created DAT file and CSV file in notepad. Copy the contents of the CSV file and paste them at the bottom of [SECTION0] in the DAT file right before the [ENDSECTION] tag. Now save the changed DAT file.
Reopen the Item Placement tool and select CREATE -- XENON PLACEMENT FILE. It will ask you to name it. Choose a name and hit OK. Next select Import from DAT. Select the newly edited DAT file you created and hit OK. You should now have your original XPL file with plus the objects you imported from the objects.ini file.
TA DA!
TUTORIAL: DEBUGGING FLOATING POINT ERRORS IN THE ITEM PLACEMENT TOOL
Getting frustrated with the item placement tool? Running into errors and corrupt files with repeating entries? I can help...
It is actually a pretty easy fix. Here's what you'll want to do. Once you have all of your objects entered into the item placement tool, try to save.
If you get the floating point error, before you exit the program or close the file, use the export to dat function in the file menu. Open that newly created dat file in notepad or another text editor.
Next close the item placement tool then reopen it as well as your xpl file. Scroll down the corrupted xpl file in the item placement tool. You should get to a point where stuff looks like it's repeating. For example:
Object 1.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Ok, so like in the example above you will want to pin down where it begins repeating. In the example above it would be. The 2nd line, y axis value (highlighted in blue). Because if you notice after the object name and the 1st coordinate (x axis) it starts to repeat the values above it.
So what you'll need to do is in that exported dat file you'll want to find that same object line (of course in the dat file it won't be corrupted.) So using the example above let's pretend this 2nd line was the problem line from above.
Object 1.0 1.4 1.5 -1 -1.2 0.3 0.5 384 -1 1 -1
Object 2.0 3.009 4.123 5.32 0.001 0 0.3 384 -1 1 -1
You can see that the y axis is not the same as the corrupted file. So to fix this problem all you would need to do is add or subtract 0.001 to the value of the entry that is giving you problems. In this case it would be the 3.009 entry so you'd edit that entry in the dat file to 3.01 or 3.008. Once you've done that, save your dat file and close and reopen the item placement tool.
This time select create new xenon placement list (xpl). It will prompt you for a file name enter either the same name of the file you are editing or anything else, just be sure to add the .xpl extension to the file name when selecting it. It will then open a blank file fir you. Now use the import from dat function and re-import the data from your dat file you just edited. Now try to save. If you get an error simply repeat these steps until you've fixed all the problems. If not then awesome. When repeating the step for additional errors it's not necessary to re-export the dat file each time, just keep using the same one, editing out each problem until the file works.
I'm not sure why this program doesn't like certain numbers but it doesn't. It's just what we have to do to get around the limitations of it. You shouldn't notice the .001 shift either on your objects.
I hope that helps and wasn't too confusing. You should only probably have 1 or 2 errors per file, so it will go quick.
***Special thanks to LiteralExertus for pointing out that the GTA IV Placement Tool 2.2 wasn’t displaying the XPL files correctly in the stream section. That information let me figure out that the cargrp number in unknown12 was not actually the vehicle hash. Also to Punishment for his Negative Hash Value Converter. ***