Page 1 of 1

Proper way to compile scripts?

Posted: 24 Mar 2019, 08:25
by BBBean
Hello, I wanted to change the weapons of some gangs in Residential district. But I didn't have success yet.

I used Epic GTA2 Map editor to decompile ste.scr and it worked well. It also asked if I want to decompile the mission scripts and I did that too.

Then I made the changes to the decompiled ste.mis and saved it. I only changed the weapons of the gangs. Script Pad highlighted the weapon names so they should be correct?

Next I tried to compile the script but I got stuck. Script Pad didn't seem to do anything when I clicked the compile button. Or perhaps I did something wrong.

MisPad (Vike's version) complained that some external scripts couldn't be found so I took the decompiled mission scripts and put them into the folder where it was searching from. Now the script was compiled but I got some error messages about forward declaration being illegal now??? I got an SCR file but when I put it into GTA2 folder, the game crashed when I tried to start the map.

Miss2.exe (DMA Design compiler) didn't give me a working SCR either.

So what am I doing wrong and what is the proper method to compile these scripts? [frenzy]

Re: Proper way to compile scripts?

Posted: 24 Mar 2019, 13:40
by T.M.
Epic GTA2 script decompiler does not decompile everything from SCR files, that might be the problem here.

Re: Proper way to compile scripts?

Posted: 24 Mar 2019, 15:37
by Logofero
irrelevant.

Re: Proper way to compile scripts?

Posted: 25 Mar 2019, 17:58
by BBBean
Hm, so does this mean that I can't change the gang weapons that way? Someone on GTAforums.com told to do it like this, a long time ago.

Why is it necessary to recompile the mission scripts when one only wants to edit the main level script?

When I tried to compile the script, the resulting ste.scr file had (almost?) equal size compared to the original. But it didn't work. There was something wrong.

What is the proper way to change the gang weapons then? (Or to do other simple changes to the level script?) The weapon IDs should be simple so should I just use a hex editor? Is there documentation available about the compiled script structure?

Re: Proper way to compile scripts?

Posted: 25 Mar 2019, 20:08
by Logofero
irrelevant.

Re: Proper way to compile scripts?

Posted: 27 Mar 2019, 17:54
by T.M.
If you edit main script file: you need to recompile all mission scripts (if the pointers change).
If you edit just a mission script: you need to recompile just that mission script.
All mission scripts refers to the main script, so if main script is modified, the references can get wrong in mission scripts.

Currently the fastest way would be to edit the SCR files directly with hex editors etc. Since my Epic GTA2 script decompiler does not decompile everything; IF/WHILE structures are missing etc.

I would like to have this simplified though... raw SCR data editing i mean, because hex editors are pain in the ass. I did start to make such editor once but didnt finish it. Maybe some day...

If my decompiler did decompile everything, then it would be possible to recompile it and have exactly same output as original SCR files, because original SCR files does not contain any hidden stuff that is not possible to decompile/recompile. (i went through them all, one command at time).
BBBean wrote:Hm, so does this mean that I can't change the gang weapons that way? Someone on GTAforums.com told to do it like this, a long time ago.
You can check the decompiler source code to see how gang weapons are defined, and use that information to modify the SCR file with hex-editor. Changing a byte to another does not require recompilation of mission scripts.

SCR Decompiler:
viewtopic.php?f=4&t=447

Re: Proper way to compile scripts?

Posted: 30 Mar 2019, 09:54
by BBBean
Ok, thanks. So looks like hex editor is the way to go for now.

But this raises more questions. I wonder how people have done this before. Were they able to decompile and compile all Residential district scripts? Did they use a hex editor? Or didn't they actually do it themselves?

Has anyone ever released modded versions of the single player maps? Industrial district scripts are provided with the official compiler so they should work?

It seems that there aren't any other decompilers available. Or are there?

I think it's also strange that the compiled ste.scr had almost(?) equal size compared to the original. It suggests that all parts of it were compiled. Or is there some placeholder space in the file?

It seems that Script Pad and MisPad come with the official compiler and its files. Is that all they use to compile the scripts?

Re: Proper way to compile scripts?

Posted: 31 Mar 2019, 14:42
by BBBean
Anyway, I got something done. [frenzy]

https://www.youtube.com/watch?v=E3uwDR23DDI

I got some other ideas as well but they would require inserting new commands into the script and I guess it's hard with a hex editor...

I also tried Electro Baton. It works but it's not dropped on death. They only drop Pistols. :|

Re: Proper way to compile scripts?

Posted: 08 Apr 2019, 13:13
by T.M.
BBBean wrote:It seems that there aren't any other decompilers available. Or are there?
I dont think so.
BBBean wrote:I think it's also strange that the compiled ste.scr had almost(?) equal size compared to the original. It suggests that all parts of it were compiled. Or is there some placeholder space in the file?
Those missing commands doesnt take many bytes each, and there arent that many such commands in the scripts. Also there is some unnecessary padding in the output SCR files when you use official compiler.
BBBean wrote:It seems that Script Pad and MisPad come with the official compiler and its files. Is that all they use to compile the scripts?
Thats right.