TheSparRow Mod | New Dealers in Stilwater [BETA3]
Many thanks to IdolNinja for his help finding related files.
NOTE : You may want to get the following tools if you haven't already.
- Gibbed's SR2 VPP Extractor/Builder
- IdolNinja's Powertools
- An XML Editor (optional)STEP 0: Extracting VPP_PCs
This step is mostly for beginner who doesn't know about modding. You'll need to find the following files in your SR2 folder (default: c:program filessteamsteamappscommonsaints row 2)
You'll have to use Gibbed's SR2 VPP Extractor and extract each file into a different folder (default: [Gibbed Folder]moddingextracted[File Name]). Then make a new folder named 'Modified', this will be your work folder.STEP 1: Finding dealers related files
Have those files copied to your work folder 'Modified'.COMMON
These are the files we found that are related to vehicle dealers. Other type of stores may require more files due to doors, clerks, hold up safes and alarms.
STEP 2: Have a look at XTBL files
If you are familiar with web programming you might know of XML files. XTBL are pretty similar. XML/XTBL uses custom tags to define data types like NAME, CATEGORY, TYPE, VARIANT, COST, so it is pretty easy to figure out what you wish to change.
It is important to correctly close tags or this will crash your game. <TAG> </TAG>.STEP 3: Car_Dealership.xtbl
Car_Dealership.xtbl hold information about vehicle listing in dealer stores.<root>
Dealer chain name must not contain space or it will break. The chain name is used to identify the store in other xtbl/cts files.
Other than character limitation you may name it how you want, it is not used to display the name of the store, but you may want to use something easy to identify. My mod used this name "SRM_Sparrow_Aircraft" so it can be identified by other modders and myself as linked to SparRow Mod and the Sparrow Aircraft store.<VehicleList>
<- We are starting this dealer's listing <Element> <- We are starting an element (car entry) <Vehicle>suv_4dr_06</Vehicle>
<- This is the vehicle ID
The vehicle ID uses the same naming as it's related vehicle information, texture and mesh files. All those files will use that unique ID for that vehicle only.<Variant>Standard</Variant>
<- Customisation and Texture variants
Some NPCs uses a variant that you won't see on the streets of SR2. They are often gang color schemes, unique decals, and unique functions. You may not notice at first since the vanilla (non modded) game dealer stores only have a few cars, but you probably noticed that some of the unlocks aren't simply recolored vehicles.Saints Modding Wiki | List of Vehicles
This wiki contains all the vehicles used in Saints Row 2. You may notice Gang_ variant which are often a specific color scheme for each gangs. Rewards are often diversion's unlocks. 'Jessica' 'Maero' 'Pierce' and other NPC names are vehicles that those NPC uses during the game.
The following variant is a big more difficult to tell at first: SS03, SH_BH_02. Those are mission specific variant: Son of Samedi 3rd mission, Stronghold Brotherhood 2nd mission. You may not notice any difference from normal variant for those.
You have some _CS named IDs... those are vehicles used in CutScenes. They might have some difference from those you unlocks. So far we didn't get better cars. For example: Maero's Atlasbreaker CS doesn't have a handbrake and Jessica's Phoenix CS is weapon restrained (can't shoot from it.)
Now for more common variant : Beater are rusty textured car, Standard are normal and Bling would have some rotating mags or fancy decoration.<Cost>30000</Cost>
<- The price set for this vehicle in store<Type>Misc</Type>
<- The vehicle type
Price is obvious, but type isn't. It currently does no change to the store, but if you are modding the cehicle itself, I have noticed that a hostage in a 'Exotic' type of vehicle will worth more than a hostage in a 'Standard' type vehicle. I'm assuming that Volition had planned to have more vehicles in Foreign Power and might need some menu on top like you have in Clothing Stores or Rim Job Garages so you can browse Sports, Classics, Misc cars independantly.</Element>
<- important to close tag. We are done with this vehicle<Element>
<- let's start a new car entry...
Tips : Have a new dealer at the end of your file before the tag definition, before closing tag for Table to find it faster. This also ease the use of WinMerge. WinMerge is used to compare an original file and a modified file and highlight differences.STEP 3: Quick look at shop_sr2_city_navpoints.xtbl and trigger.xtbl
Those files seems to be to predefine variable entries in the LUA. It is best to simply copy some lines, add necessary informations and leave quickly. Let's start with navpoints file.<root><NoSave></NoSave><Table>
We don't touch this. Let's keep going.<Navpoint>
Thise is for 'Museum' district Foreign Power. Make sure you wrote down the right tag or didn't copy them wrong. This will crash your game if you did it wrong. <Name> tag is was we are looking for, but careful, there is more navpoints to find for car dealers, even more for other stores.
- shops_sr2_$MU_car_store : location of the dealer.
- shops_sr2_$MU_car_car : location of the vehicle spawn.
- shops_sr2_$MU_car_own : location of the 'For Sale' sign when you own the district.
- shops_sr2_$MU_car_cam1 : location of camera start when buying store.
- shops_sr2_$MU_car_cam2 : location of camera end when buying store.
Just make sure all of them have a new entry. Help yourself by using a clear name for the variable. $MU is for museum, $SU for Stilwater University, $AIR for Airport... etc. Car can be changed for your store name. Don't make it too long, you might make mistakes while writing it in some other files.
To find them more easily, have them all together at the end of the file before the tag definition and </Table>.
Now for triggers. You need to do the same thing, but since a car dealer does not have as many triggers, you just need to find two of them. a car_own and a car_store. Those are what we call 'Lightcones' (light spot you see with little icons for buying stuff.)<Trigger>
</Trigger>STEP 4: Store discounts?
Looking at that file I guessed there might be some discounts in some stores when you hear their advertising on the radio. I never really noticed. We'll only have some blank spot, it might need this entry even if you don't have adversing on radio.<StoreDiscounts>
</StoreDiscounts>STEP 5 : Store name!!!
Open store_names.xtbl file.<Shop_Names>
Name tag is your chain name. The name you used to identify your dealer in the car_dealership.xtbl file.<Localized_Name>SPARROW AIRCRAFT</Localized_Name>
Here goes the name you'll see on the Map (default: Tab)
. You might notice that other stores have this : FOREIGN_POWER_NAME. That is a constant in the LUA programming, it containts the string "FOREIGN POWER" in it, but we couldn't find were it got defined at this moment. Just type in the name with space and it should be okay.<Ownership>
These are tags that define the price to buy the store, periodic income you'll get in your crib's safe, discount for owning this show, and discount for owning ALL the chain.
Let's close the shop name section.</Shop_Names>
Save and quit.STEP 6: Let get everything together.
We are almost done. Open shops_sr2_city.xtbl.<Shop>
<Name>AIR Sparrow Aircraft</Name>
You first give some name to the store. It did not seems to affect any of the display. Then you write down the chain name that is used in car_dealership.xtbl and store_names.xtbl.<Ownership_Trigger>shops_sr2_city_$AIR_sparrow_own</Ownership_Trigger>
Tell the file which is the variable for the ownership trigger.<Exterior_Elements>
It is pretty clear what goes here. Store lightcone, cam for viewing vehicles and large vehicles and where should the car be spawn. You are actually making link between the chain and those variables we have set earlier. There is no 'InteriorElement' for vehicle dealer, but there is many for music, clothing and other stores that have a clerk, doors and safe.<Flags>
Some flags about perticular details. There is no clerk so no hostile one.<_Editor>
Don't touch this.<Purchase_Start_Navpoint>shops_sr2_city_$AIR_sparrow_cam1</Purchase_Start_Navpoint>
These are camera navpoints for camera movement when you are buying a store. </Shop>
Case closed. "Where do we input coordinates? ". Next step.STEP 7: The lucky numbers?
Using IdolNinja's Powertool you'll be able to view the coordinate of your character in-world. So start moving and head to the place you wish to add something. In the case of a dealer, you'll need the position of the store (where you enter dealer menu), car (where the vehicle should spawn) and own (where the "For Sale" lightcone will be). For other store, you'll probably need the coords for the clerk, the safe when you make hold ups, doors and others...
Now you got the coordinates... what about the camera? You may use an helicopter for the coordinates or jump with low gravity cheat, press tab to get fixed coords. Camera rotation needs to be figured out with trial and error as I haven't found out yet how they work.
Let's open shops_sr2_city.cts.
OMFG!!! Yes it isn't XML. Those are used to define everything that has to do with coordinates. There is two sections we need to change for dealers.NAVPOINTS$Navpoint: "shops_sr2_city_$AIR_sparrow_own"
$Pos: <1017.079285 -4.496698 2153.105957>
$Pos: <978.687317 -3.775287 2115.917725>
$Pos: <1019.337463 -4.510568 2149.855957>
$Pos: <-638.353455 29.160440 -1373.745361>
$Orient: [<-0.815672 0 0.578515> <-0.133864 0.972861 -0.188740> <-0.562814 -0.231392 -0.793535>]
$Pos: <-629.589417 32.410637 -1398.046753>
$Orient: [<0.595935 0 0.803033> <-0.076695 0.995429 0.056916> <-0.799362 -0.095506 0.593211>]
I left camera as they are, they seems to be ignored when you look at vehicles, but when you purchase the store, it looks at Museum's Foreign Power dealer.
- $Navpoint is the navpoint name in shop_sr2_city_navpoints.xtbl.
- $Type is either on the "ground" or "floating".
- $Pos is for the coordinates you have gathered.
- $Orient is for orientation of the camera (or rotation).
Orient is fairly easy on ground type, lightcone does not really use it, but clerk might look silly watching the walls. Orient on floating is still unknown to me at the moment.TRIGGERS$Trigger: "shops_sr2_city_$AIR_sparrow_own"
$Trigger type: "bounding box"
$Trigger action: "store ownership"
$Trigger max fires: 0
$Trigger delay: 10000
$Start nav: "shops_sr2_city_$AIR_sparrow_own"
$Box size: -1.000000 0.000000 -1.000000 1.000000 2.000000 1.000000
$Trigger type: "bounding box"
$Trigger action: "car dealership"
$Trigger max fires: 0
$Trigger delay: 10000
$Start nav: "shops_sr2_city_$AIR_sparrow_store"
$Box size: -1.000000 0.000000 -1.000000 1.000000 2.000000 1.000000
Evade trouble and headache like I did and just change $Trigger for variable name you've set in shop_sr2_city_trigger.xtbl.
- $Trigger type is the type of trigger... yeah that makes senses...
- $Trigger action mainly define what action the trigger should start up.
- $Trigger max fires is how many times the trigger can be activated.
- $Trigger delay is how long before the trigger can be activated again.
- $Start nav calls the coordinates from where the trigger starts.
- +DemoDisabled, I have no idea...
- $Box size define the space where the character need to be to call the trigger.
- +Ignore Vehicles means the trigger will activate even if there is a vehicle in the way.STEP 8: Thank god it's done!!!
Not yet. Remember that lua file from patch folder? If you actually try your mod, you'd notice that it calls the new dealer 'UNKNOWN DEALER' while in-store, this has to do with earlier name definition in store_names.xtbl.
We'll just make a little change so it calls it 'VEHICLE DEALER'.if store_name_crc ~= 0 then
Cdl01_car_menu.header_label_crc = store_name_crc
Cdl01_color_menu.header_label_crc = store_name_crc
Cdl01_car_menu.header_label_str = store_name_str
Cdl01_color_menu.header_label_str = store_name_str
We'll change the last two lines before end for thisCdl01_car_menu.header_label_str = "Vehicle Dealer"
Cdl01_color_menu.header_label_str = "Vehicle Dealer"
And now you should have 'Vehicle Dealer' instead of 'Unknown Dealer' when you go in store.STEP 9: Let's pack everything.
We've worked hard, now it is time to pack everything up. No, you're not going home yet, althought you probably are there already. We extracted files earlier and now we have to make a new patch.vpp_pc file for SR2 folder.
"But didn't we changed common files?"
Saints Row 2 load common first and then load patch. if there is some files in patch that are the same as common, it will only consider the files in patch. Also, patch is much smaller/faster to build than common.
In the Gibbed's SR2 Tools folder, we'll made a new file named 'VPP Mod Packer.bat'. Current Gibbed's Build Package need some dos command to work and instead of writing over and over the command line at each repacking (you'll repack often) we make a batch file that will enter the command automatically.
Now write this and save.Gibbed.SaintsRow2.BuildPackage.exe "patch.vpp_pc" "modified" "moddingextractedpatch"
We call the exe Gibbed.SaintsRow2.BuildPackage.exe to create a file named 'patch.vpp_pc' from 'modified' folder and 'patch' folder. Gibbed's tool will take all patch files and replace those you changed then save it in Gibbed's folder as patch.vpp_pc. Now you'll copy and paste that file in your Saints Row 2 folder. WAIT!! Hope you didn't do it yet. Make a backup of the unmodded (also called vanilla) patch.vpp_pc you can always bring it back if you want to play the game without any mod.
You are good to go now and few last tips, make a shortcut to Saints Row 2 folder in Gibbed's Tool Folder, you'll be going there alot when you create mods. Use XML editors to check if you haven't forgotten or miswritten some tags, this is the main reason for broken mods, copy your file with xml file extension. I use DreamweaverCS4 and it has an odd habit to remove / before _underscore in </_Editor> so you might want to copy paste content from xtbl to xml file and xml to xtbl file once checked and corrected.Special thanks to IdolNinja for his help and support that made me create my first mod.