Page 1 of 1

Spawning Cars

Posted: 14 Jul 2017, 22:16
by BeepBoop
Is there a way to spawn cars on command? Can you only do it by script?

Re: Spawning Cars

Posted: 15 Jul 2017, 01:17
by Sektor
I don't know how to spawn anything without using script but it would be useful. You need to find out how to execute existing gta2.exe functions from your own process/DLL.

Re: Spawning Cars

Posted: 14 Jan 2018, 13:03
by Logofero
It would be useful to know this. I also asked myself this question

Re: Spawning Cars

Posted: 21 Feb 2018, 13:06
by Sektor
GTA2 loads the SCR file into memory, so you can edit that part of the memory and change the script commands while it's running. I would prefer a direct way of executing existing commands but I don't know how to do that yet.

The SCR file is stored around here:

GTA2.EXE+0x2744BC, offset 35C

I tried simple one byte changes like changing the model of car that was constantly being created with a custom script and that worked, so you could try changing an entire hex SCR command to a SCR hex create_car command. You'll have to read up on the GTA2 SCR file format, look at the decompiler.dll sources or ask the SCR experts.