Ask the Experts / [Tutorial] Hacking vehicle spawning using OpenRCT2 and VS Debugger
- 
					
 29-December 17
				 
- 
						
			
		
		
 spacek531
			
			
				
				
					Offline
				
			
		EDIT: I am producing a series of videos to replace the streamed content, because I can much-better control the quality of the content. Here is the first in the series: https://youtu.be/kEH5QlOkg2c
Change vehicle properties, vehicle spawn order, and even mix vehicles from other ride types using OpenRCT2's source code and the Visual Studios debugger: https://www.twitch.tv/videos/213625054
Here are some important timestamps:
11:00 changing the order of vehicles being spawned
 vlc_2017-12-29_13-48-57.png (113.87KB)
downloads: 6513:40 changing the speed of a train (despite what I say, the speed the train travels at will persist if I save the game. Just not the speed the train spawns with)
 vlc_2017-12-29_13-39-15.png (123.65KB)
downloads: 7929:35 adding cars from different ride types
 vlc_2017-12-29_13-59-04.png (114.88KB)
downloads: 6636:00 programming OpenRCT2 to make combination trains every time
 vlc_2017-12-29_14-07-08.png (162.12KB)
downloads: 6441:50 changing the order OpenRCT2 spawns the vehicles in (with code this time)
 vlc_2017-12-29_14-09-28.png (86.65KB)
downloads: 7149:30 programming OpenRCT2 to spawn trains with different lengths
 vlc_2017-12-29_14-12-54.png (140.51KB)
downloads: 50Sorry about the crummy framerate later in the video, I have yet to find good options for recording for long periods of time.
Please post if you have any questions.
Although I never talk about it, changes to vehicle speed, vehicle order, and vehicle types once they are spawned will persist across all versions of RCT2 and OpenRCT2.
An important piece of info that I was reminded of: if you are mixing vehicle types, you must have a ride on the map that uses that subtype or the mixed cars will vanish when remove_unused_objects or parkdat is used. Setting the mixed cars' types on trackitecture or on dummy rides is sufficient. The train ride on this park is missing cars because there were no rides that had the subtype when remove_unused_objects was run.
 - 
						
			
		
		
 X7123M3-256
			
			
				
				
					Offline
				
			
		This is the first tutorial I've seen on this topic - I'm surprised it hasn't received more of a response. Hopefully it will prove useful to somebody. - 
						
			
		
		
 Jappy
			
			
				
				
					Offline
				
			
		This will be useful when I want to simulate freight trains. Or mixed passenger ones. Great job!
 - 
						
			
		
		
 spacek531
			
			
				
				
					Offline
				
			
		The first ride to use this hack aside from Pioneer Train has appeared: https://www.reddit.c..._crazy_coaster/
 - 
						
			
		
		
 X7123M3-256
			
			
				
				
					Offline
				
			
		I used the hack on this park a while ago ... both the SCAD tower and the trucks that return the rafts were hacked in this way.
 - 
						
			
		
		
 Deurklink
			
			
				
				
					Offline
				
			
		The first ride to use this hack aside from Pioneer Train has appeared: https://www.reddit.c..._crazy_coaster/
I updated it with more spaced out trains:
 - 
						
			
		
		
 Coasterbill
			
			
				
				
					Offline
				
			
		Yeah, I just checked that out... I loved it! It may not win an accolade but it's a blast to look at. I'd submit it.
 - 
						
			
		
		
 spacek531
			
			
				
				
					Offline
				
			
		An important notice to anyone who is mixing vehicles: you must have a ride on the map that uses that subtype or the mixed cars will vanish when remove_unused_objects or parkdat is used. Setting the mixed cars' types on trackitecture or on dummy rides is sufficient. The train ride on this park is missing cars because there were no rides that had the subtype when remove_unused_objects was run.