NFSAddons Forums

Mar 28, 2024, 8:31 AM

Using ghost files to customize a race [NFS4]

This is a discussion for the topic Using ghost files to customize a race [NFS4] on the board General NFS.

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

165 Replies on Using ghost files to customize a race [NFS4]
on: Oct 01, 2016, 8:10 AM
Sr. Member
Posts: 79 Joined: August 06, 2016

  • ***
  • Personal Text
    Retro racer excellence
Greetings!
This thread will teach you how you can add additional AI drivers to a race by simply edit a ghost data file. Want to have more and unique police cars in a Hot Pursuit race? Tired of only having 7 AI opponents? More traffic cars to dodge? How about additional racers and cops in two player mode? All is possible!


What you'll need:
A HEX editor - I'm using HxD
or use Cheat Engine (see below)
Knowledge in HEX numbers.

If you don't know how to use HEX editors, follow Zalcus method on using Cheat Engine instead, which is also much easier. The rest in this post can also be ignored.



First things first:
  • Simply launch the game and choose either a normal Race or Hot Pursuit. I recommend that you don't choose Career, Knockout or Tournament modes, because the game might crash later on.
  • Start the race. When the lights turn green and the AI starts to drive away, pause the game and exit. A gst file will be created in the SaveData folder. Note: If you want to edit a 2 player race, you need to copy config.dat and rename it into a gst file.
  • (Since we can't save a ghost file in Hot Pursuit mode, you 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. Make a copy and change the name of it. Like: cop_07a.gst. Remember: when you're done with the editing, move it to the SaveData/Saves folder (or move it there before you edit).
  • Now open the Hex-editor and start editing, here's the addresses that's possible to change:



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



00000FF0 = Gamemode
00 = Single Race
01 = Tournament
02 = Knockout
03 = Hot Pursuit
04 = High Stakes (Will crash the game when the race is done. The car upgrades is activated in this mode.)

0000109C = Hot Pursuit Gamemode (only activated if 00000FF0=3)
00 = Classic
01 = Getaway
02 = Time Trap



00001098 = Opponent Skill
00 = Amateur
01 = Pro
02 = Champion
03 = Getaway Mode



000010A4 = Tickets Quota
Number of tickets for the police team. This value should be the total number of tickets for the speeders. I changed my game to have 4 speeders instead of 2, so for me this will be: 4*5=20 (14 in HEX).
NumberOfRacers * MaxTickets = TicketsQuota

000010A8 = Max Tickets for each speeder
Since the police team must deliver 20 tickets, each speeder needs to have 5 tickets. So this value must be 05.



000010E8 = Number of Laps: 2, 4 or 8. You can use any number here, but I wouldn't personally recommend it since I don't know how the game will keep any track records.
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 = The Summit
12 = Empire City



0000112C = Cheat Codes
00 = Deactivated
01 = GOFAST
08 = MOON
0A = MADLAND
14 = SKYVIEW
28 = OUTMYWAY
50 = RESETYA
02 00 00 xx = TR00 - TR15 (00-0F)
To add 2 cheats, simply add the two values together. Example: MOON and MADLAND: 8 + A = 12



0000115C = Enable/Disable Helicopter (0=Disable, 1=Enable)
0000114C = Helicopter Sounds (0=Off, 1=On)
000010AE = Helicopter Lights and countdown timer (0=Off, 1=On)



00001140 = Number of Cars in total (Max=10)
00001144 = Number of Humans in total (Max=02)

00001148 = Number of Human Drivers (Max=02)
0000114C = Number of Human Cops (Max=02)
00001150 = Number of AI Drivers (Max=0E)
00001154 = Number of AI Cops (Max=08)
00001158 = Number of AI Traffic (Max=0F)
All addresses above is to help the game to spawn the cars correctly. Always double check the AI types for each racer, cop or traffic driver. Otherwise the game crashes or will not spawn them correctly.




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

00001160 = Name
Believe 10-12 characters is the max limit. 7 if you want to make it fit the number plate. Note: if you have 9-15 racers at once, their number plate will be blank.



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

00001174 = Car in your menu list and the traffics "serial number"
Where in the carlist does your car appear? Starts with 0. If your car is selectable in the menu, this value is not required to change. Traffic cars have the following 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 + Transparency.

00001180 = Transmission (0=Manual, 1=Auto)
00001184 = Convertible Mode (0=Top up, 1=Top down)

000011CC = AI driver ID (Values: 00-47, 71 in total)
This is the AI driver ID, hair color, skin color and I think even their driving style. It's hard to observe their behaviour, but their looks will change however. An example is: 35 - Jammin (from the Career mode), he has cool green hair.  8)



That's all you need to know. I 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. This post will be updated with additional information or discoveries.

Big thanks to Zalcus20 for finding additional addresses! Also big thanks for everyone that have tested and confirmed various values.

Have fun racing! :D

« Last Edit: May 17, 2017, 6:54 AM by DrSpeed »

Reply #1
on: Oct 01, 2016, 10:03 AM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
Wow! That was fast  :) Going to try it out now and let you know how it goes. Thanks again for sharing this  :)

Reply #2
on: Oct 01, 2016, 11:09 AM
Hero Member
Posts: 463 Joined: November 03, 2005

  • *****
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?

Reply #3
on: Oct 01, 2016, 12:20 PM
Sr. Member
Posts: 79 Joined: August 06, 2016

  • ***
  • Personal Text
    Retro racer excellence
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...

Reply #4
on: Oct 01, 2016, 12:45 PM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
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?!!!   ???

Reply #5
on: Oct 01, 2016, 1:11 PM
Sr. Member
Posts: 79 Joined: August 06, 2016

  • ***
  • Personal Text
    Retro racer excellence
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)

Reply #6
on: Oct 01, 2016, 1:53 PM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
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

Reply #7
on: Oct 01, 2016, 2:06 PM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
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.

Reply #8
on: Oct 01, 2016, 3:52 PM
Hero Member
Posts: 3,210 Joined: January 22, 2008

  • *****
  • Personal Text
    I keep trying so far... Hmm 😶‍🌫️ ☮️ 😎
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)
Let's have a better day...?

Reply #9
on: Oct 01, 2016, 4:06 PM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
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)

Reply #10
on: Oct 01, 2016, 5:49 PM
Hero Member
Posts: 3,210 Joined: January 22, 2008

  • *****
  • Personal Text
    I keep trying so far... Hmm 😶‍🌫️ ☮️ 😎
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 )
Let's have a better day...?

Reply #11
on: Oct 02, 2016, 12:14 AM
Sr. Member
Posts: 79 Joined: August 06, 2016

  • ***
  • Personal Text
    Retro racer excellence
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

Reply #12
on: Oct 02, 2016, 8:07 AM
Hero Member
Posts: 423 Joined: May 21, 2006

  • *****
  • Personal Text
    Ramms+ein fan
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?

Reply #13
on: Oct 02, 2016, 8:24 AM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
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  :)

 

Reply #14
on: Oct 02, 2016, 8:37 AM
Sr. Member
Posts: 163 Joined: March 22, 2014

  • ****
@ 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.  :-\

 


Support NFSAddons: