Welcome, guest. Please login or register. Did you miss your activation email?

Author Topic: Using ghost files to customize a race [NFS4]  (Read 2396 times)

DrSpeed

  • Newbie
  • *
  • Posts: 25
    • View Profile
Using ghost files to customize a race [NFS4]
« on: October 01, 2016, 08:10:49 AM »
Greetings!
As I promised, I'll tell you how you can add additional AI-drivers to a race by simply edit a ghost data file.


What you need:
A HEX editor - I'm using HxD
Basic knowledge using HEX-values
Notepad - not really needed, but it's very useful to keep track of all the values
I'm using VEG's modern patch for NFS4, but I don't think it's required

Although this method is kind of advanced, sometimes it requires trial and error to achieve what you want.
(If you don't know how to use HEX editors, follow Zalcus method on using Cheat Engine instead, which is also much easier).
http://www.nfsaddons.com/forums//index.php?topic=1831.msg33827#msg33827


First things first:
Simply launch the game and choose either a normal Race or Hot Pursuit. I recommend that you don't choose Carrer, Knockout or Tournament modes, the game might just crash later on. In this example I'm going to choose Hot Pursuit and I'm going to drive a police car.

It doesn't matter what settings you have, you can change them later on. I'll also choose the classic gamemode, since I'm not so into getaway and time trap. Start the race. When the lights turn green and the AI starts to drive away, pause the game and exit. You can complete the race if you want, but... weird things happends if you do.

Since we can't save a ghost file in Hot Pursuit mode, we need to get it manually. Navigate to the SaveData folder and locate the ghost.gst file. This is the ghost file that records the latest race you did, even if you didn't complete it (also, look when it was last changed). Make a copy and change the name of it. I'll name mine: cop_07a.gst. Remember: when you're done with the editing, move it to the SaveData/Saves folder.

Now open the Hex-editor and look down here on what you can change:


00000FEC-00000FEE = XYZ Location (Getaway mode only)

00000FF0 = Gamemode
00 = Single Race
01 = Tournament
02 = Knockout
03 = Hot Pursuit

00001098 = Opponent Skill
00 = Amateur
01 = Pro
02 = Champion

0000109C = Hot Pursuit Gamemode
00 = Classic
01 = Getaway
02 = Time Trap

(Thanks to Zalcus20 for finding the 4 above addresses.)


000010A4 = Tickets Quota
Number of tickets for the police team. It should be a value that can be divided by 2. I feel skillful enough, I'll increase this to 14 (20 tickets)

000010A8 = Tickets
For each speeder. Since the police team must get 20 tickets, each speeder needs to have 10 tickets. So this value must be 0A. And if I change so there's 3 speeders in total, that value needs to be divided by 3.

000010E8 = Number of Laps: 2, 4 or 8 (you can use any number but I wouldn't recommend it)
000010EC = Direction (0=Forward, 1=Backward)
000010F0 = Mirrored (0=Off, 1=On)
000010F4 = Nighttime (0=Off, 1=On)
000010F8 = Weather (0=Off, 1=On)

000010E0 = Track
00 = Celtic Ruins
01 = Landstrasse
02 = Dolphin Cove
03 = Kindiak Park
04 = Route Adonf
05 = Durham Road
06 = Snowy Ridge
07 = Raceway 1
08 = Raceway 2
09 = Raceway 3
0A = Hometown
0B = Redrock Ridge
0C = Atlantica
0D = Rocky Pass
0E = Country Woods
0F = Lost Canyons
10 = Aquatica
11 = Summit
12 = Empire City
Note: If you completed a race and change this value, you'll notice that the ghost will in fact follow the track around, but will be facing the wrong way and will sometimes teleport to the center of the track. Amusing to watch but could crash the game.

00001140 = Number of Cars
How many cars will there be in the race? This is more advanced and there's a pretty complex way to increase the number of drivers. Max value: 10 (16 Cars). This post is going to be very long so I'll write that down another day. Hot pursuit is always set to 09. Set it to 07 to remove traffic. Let's leave it as it is and I'll teach you how you can add 2 additional police cars (replacing the traffic cars).


The adresses here is for Player One, to change for the next player simply add 70 in the adress, and another 70 for the next one et cetera.
Note: Each player always starts with the name, so it's quite easy to keep them apart.

00001160 = Name
Believe 10-12 characters is the max limit here?

00001170 = Car
This is the car serial number. To load from the traffic folder, this value must be: FF FF FF FF).

00001174 = Car in menu list
Where in the carlist does the car appear? If your car is selectable in the menu, this value is not required to change. Traffic cars have these values:
32 00 = Minivan
33 00 = Pickup
34 00 = Sedan 2
35 00 = Stationwagon
36 00 = Sedan 4
37 00 = Hatchback
38 00 = Bus
39 00 = 50's Truck
3A 00 = SUV
3B 00 = European Sedan
3C 00 = European Bus
3D 00 = European Semi
3E 00 = Semi
3F 00 = Snowplow
40 00 = Water Truck
F4 01 = Police Sedan
F5 01 = Police SUV
F6 01 = Police Hatchback
F7 01 = Police Caprice

0000117C = AI Type
This is a very important value to change. Players can't be AI controlled and AI's can't be playable.
Player values: 01=Racer, 09=Cop
AI values: 02=Racer, 04=Traffic, 08=Cop

00001188-0000118B = Primary Color
The color of the car, RGB(?) and Transparency. The ghost will always have the same color as player one.
Example: 05 05 05 7F = Black with 127 Transparency.

00001180 = Transmission (0=Manual, 1=Auto)
00001184 = Convertible Mode (0=Top up, 1=Top down)
(Thanks to Zalcus20 again for finding these 2.)


 :police: :police:
So, let's transform the 2 traffic cars into police cars:

Name:
00001470 and 000014E0
The police have the same names as they did in NFS3:
Shield, Smooth, Trigger, Blue, Moose, Blender, Fancy, Sterno
In game, their names is replaced with "Unit(nr)" so basicly, call them anything.

Car:
00001480-00001485 - This dude can have the Hatchback police:
FF FF FF FF F6 01
000014F0-000014F5 - And let's give this guy the La Niņa police car:
31 00 00 00 xx 00 - xx is where the La Niņa police shows up in your drop down list. This is a playable vehicle, so leave it or give it a low value.

AI:
0000148C and 000014FC is default to: 04, change them to 08.


That's all you need to know. Give it a test to see if it works.
Here's some examples on what you can do:


8 Cops + 6 Traffic + AI using any car

4 Speeders + 8 Cops + 4 Traffic vehicles

12 Racers + 4 Traffic vehicles

I do hope you'll get it to work and I bet you'll have more fun with NFS4 as I 'm having.
If you want to help me out with this and providing research, you're more than welcome to do so.
Have fun racing! :D
« Last Edit: October 16, 2016, 03:22:56 PM by DrSpeed »

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #1 on: October 01, 2016, 10:03:57 AM »
Wow! That was fast  :) Going to try it out now and let you know how it goes. Thanks again for sharing this  :)

noise

  • Full Member
  • ***
  • Posts: 203
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #2 on: October 01, 2016, 11:09:20 AM »
Great post, and fast indeed.Seeing all those numbers I almost get a headeache, but I will try it out.

What possibillities are there more with HEX editing?

-Changing carcolor opponent car? (I hate that poison green)
-Damage in singleplayer visible?
-More control of what opponent car is showing up?

DrSpeed

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #3 on: October 01, 2016, 12:20:30 PM »
Quote from: noise
What possibillities are there more with HEX editing?
Setting the timer for Getaway and Time Trap should be possible. If I'm lucky I should be able to find start positions as well. And maybe hide the ghost car from the race. But time will tell, I'm still just a beginner with this kind of stuff.  ;)

Quote from: noise
-Changing carcolor opponent car? (I hate that poison green)
Yes, you can change the opponent colors quite easily, your color is at: 00001188-0000118B
I was racing against Bogey and he used the MHRT Commodore, that car don't have a color, so it's green. His offset is: 000011F8-000011FB (+70 after my color offset). The value for the color is: 00 FF 00 FF replace it with: 8C 8D 8C 7F - to give him the Bonus Camaro color. If you don't know the color code for a car, use Color Picker in Photoshop if you have it.

Quote from: noise
-Damage in singleplayer visible?
Car damage, I don't know. I've only managed to find stuff related to the race itself and not any gameplay settings. But it could be in there somewhere.

Quote from: noise
-More control of what opponent car is showing up?
Again yes, you can control what car the opponent drives. One can drive the McLaren and someone else can have the Corvette while you drive around in a BMW Z3. I even belive that you can drive the Knockout truck outside of Knockout (without viv editing), I should test that. But the only problem is to change all 7 opponents in the file, it gets tideous. But I think the result is worth it. I could list the values for all the cars if you want. It's the same as the serial number, but it's written in HEX so you'll need to convert it. Offsets:
00001170 - Player 1
00001170 + 70 = 000011E0 - Opponent 1 Car (aka Player 2)
000011E0 + 70 = 00001250 - Opponent 2 Car
...and so on...

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #4 on: October 01, 2016, 12:45:20 PM »
I Just tried it out. This is so amazing!  =D The possibilities are limitless.

Does this mean I can edit a Hot Pursuit classic race to be one cop vs. a full-grid of perps, set the tickets to one each and chase them all down like Hot Pursuit mode in NFS3?!!!   ???

DrSpeed

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #5 on: October 01, 2016, 01:11:36 PM »
I recently tested it with 2 extra speeders and it spawned those cars in front of the starting line, stacked on top of each other. They also needed to complete an extra lap. So I would say, yes, it's quite possible to do it.  8)

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #6 on: October 01, 2016, 01:53:16 PM »
I just figured out how to do it. I was able to turn all ai cop cars into ai perps. I adjusted the laps and the tickets so that everything is set up right and...voila! It worked like a charm.  =D ^-^  I took a few in-game screenshots but I don't know how to use the Insert Image feature.

DrSpeed, you are the man  :) ;) :D

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #7 on: October 01, 2016, 02:06:50 PM »
OK. I'll just post the screen as an attachment.  Also here is another showing 7 cop cars (instead of the default 5) by the Old Church on the hometown track.

WiLL

  • Hero Member
  • *****
  • Posts: 2879
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #8 on: October 01, 2016, 03:52:32 PM »
Damn... I'm missing, the old game.. like rite now!. But hey, I got real new tires on my front anyway, Hi Zalcus20 nice pics, did you mode them Siren lights,on top of the Porches csrs? They look Great. Budd  :D
Man you guys sure are Cool Hackers on here! Sounds tuff this Hex stuff thanks Dr.Speed for showing us it  8)

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #9 on: October 01, 2016, 04:06:32 PM »
Hi Will.  :D

 The Porsche was already made that way. Didn't have to do anything, although I do agree it looks cool.  :)
It is quite complicated at first but once you learn how to understand hexadecimals it becomes very simple.

     You just made me wonder: If there is a way to create a user-friendly program in which the user could customize what he/she wants in the game in normal language and then the program will do the hard work and put it together like a batch file? Wonder if that's possible. Not too familiar with that level of programming.  :-\

It's really good to see that NFSHS is still being played by many  :) :) :) Thanks again DrSpeed. This has totally made my weekend  ^-^  8)

WiLL

  • Hero Member
  • *****
  • Posts: 2879
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #10 on: October 01, 2016, 05:49:23 PM »
Oh I see it came this,way the Cop cars np. Yes,it makes me think of JimD's Cool Simple T3Ed, Track View, Visibility text,program. I really love how that, made my Tracks more nicer!. So I bet Dr.Speed or someone,could make,it this way. Into a exe. Like an all they do. So that's my Rainy,night Comment,pal have a Good cheerful, Sunday. I'm staying Sober,  ::)  ^-^ an going to bed now. Yippy huh cya )

DrSpeed

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #11 on: October 02, 2016, 12:14:55 AM »
If I had the skill to create a program that edited the gst file I would. It does get quite messy with the numbers sometimes.

Great pictures Zalcus, I dunno if I should feel sorry for Mulligan, haha.


- I tried to add a 9th police car, but he decided to spam the spikestrip button constantly for some reason.
- I also tried add computer drivers/cops in 2 players mode (Player 1 - Speeder and Player 2 - Cop). It worked like a charm, but Player 1 can only spectate other speeders and Player 2 can only spectate police officers in replay. Otherwise, the game crashes.
- And another thing I tested. The Knockout truck can be used in Hot Pursuit and it's quite hard to stop it. The player however... can't use it, the truck will be sunken into the ground. HEX value: 21 (Serial number 33).

Thank you guys for those kind words! :D

XJ220

  • Sr. Member
  • ****
  • Posts: 423
  • Ramms+ein fan
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #12 on: October 02, 2016, 08:07:21 AM »
Wow. Very creative approach there!

Also, thanks for the quick post!

Though I'm wondering now where all the hard-coded counterparts are stored, e.g. foldernames. Inside the game's exe?

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #13 on: October 02, 2016, 08:24:00 AM »
2 player mode sounds fun now.  I guess the only workaround for the cop control issue is to only have a person who wants to be the cop play as player 1 and the person who wants to be the perp play as player 2.

Also that part where the game crashes when you hex edit the user car to be a traffic vehicle. The reason it crashes is because the game is looking for a fedata file. The traffic cars' viv file do not contain a fedata file. You have to create a fedata file for the desired traffic vehicle and make sure the extension matches the language you play in your game (fedata.eng for english fedata.ger for german).

One more thing: you can have any number of laps besides 2,4, or 8. I haven't tested what the max number of laps are.

I'll try to post as much as I can find out with this special hex editing trick and try to help you out, DrSpeed. I'm starting to see why they call you Doctor lol  :)

 

Zalcus20

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Using ghost files to customize a race [NFS4]
« Reply #14 on: October 02, 2016, 08:37:13 AM »
@ XJ220 my guess is that they are hardcoded to the exe. Veg's patch edits the .exe and he was able to remove the poly limit so that could mean everything else that we're looking for is in the exe. :)

The ghost.gst file seems to externalize these parameters from the exe making it possible to edit it (like an .ini file) and then use it to change the functionality of the game.

I wonder how many more things about nfshs are waiting to be discovered.  :-\