Chaos% mod project

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
Word of Wind
Ped
Ped
Posts: 4
Joined: 16 Apr 2019, 14:09
GH nick: WordofWind

Chaos% mod project

Post by Word of Wind »

Hello.

I'm currently on a project to create chaos% mod for GTA2. For those who don't know what Chaos% is in general, its a "common" mod among GTA speedrunners where the game will trigger random effects and events during the speedrun attempt. Here's an example that was made for Vice city: https://github.com/Lighnat0r-pers/gta-v ... Readme.txt

I'm currently trying to figure out a solid way to create this, although I'm not a great of programmer yet. I cannot do anything with DLL's yet (dont know how use them tbh), and been mainly just using game addresses to change values randomly. Then I remembered that GTA2 manager has plenty of debug options that could be useful to trigger whilst in game. The issue here is that I'm not sure how to access those debug options by script, so this is where I ask if anyone has advice here. Also asking help in general, what would be good way to approach this situation overall?

What I've done so far is I've had invincibility and invisibility trigger on and off in cycles by changing the address values. It's kinda tedious to work with addresses but that's what im using now. Obviously the chaos% mode should have a lot of effects and even multiple that are on at same time, so this project has long way to go, but gotta start from somewhere.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Chaos% mod project

Post by elypter »

Word of Wind wrote: The issue here is that I'm not sure how to access those debug options by script, so this is where I ask if anyone has advice here.
Depends on how you want to activate them. afaik all of them are registry values and i think for changes to take effect you have to restart the game. if you want to change them in game you have to figure out the addresses. then you can change them with an external application like cheat engine or your own script or internally with vikes peek and poke commands in mission scripting.

there is this thread about known memory addresses which might help as a starting point. i dont have any expierience with memory poking but vike, sektor or rick might be able to help.
yur sa'nok ngeyä
Logofero
Serial Killer
Serial Killer
Posts: 264
Joined: 09 Dec 2015, 14:18
Location: Russia, Gelendzhik
Contact:

Re: Chaos% mod project

Post by Logofero »

Hi, Word of Wind.

To work with the virtual memory of the game, MISI can help you with this. You do not need to recompile the library if you are not going to add new functions to it. Link to the MISI topic: viewtopic.php?f=4&t=1136

To create a mod, you need to learn the LUA syntax - this will give you more freedom for creativity. Link to LUA official documentation: http://www.lua.org/docs.html

To start working with MISI, you need:

1. Install patch v11.44 at this link: http://gtamp.com/forum/viewtopic.php?f=4&t=73

2. Download misi_setup.7z at this link: http://gtamp.com/forum/download/file.ph ... ew&id=1887 (I recommend downloading version v0.4.2 - this is the latest update with all the features and fixes)

3. Unzip the archive to any place (for example, to the desktop)

4. Run the installer misi_setup.exe, then specify the root directory of the game GTA2. After successful installation, the scripts pack and the MISI.ASI library will appear in your directory.

Here is an example of changing game memory through the LUA script:

1. Open notepad create a new text file, named it firstmod.txt, save it in the root of the game in the folder "Here is your path to GTA2"/scripts

2. Add this code to the text file firstmod.txt:

Warning: This code was not tested by me in the game so it may not work correctly!

Code: Select all

--[[
-- Mod Name
-- Author: Your Name
-- Mod version: v1
-- MISI since version: v0.4.2
]]--

local gamestate = 0
local ped_pool = {}

while (true) do
wait (0)
if (GetGameFrame()> 0) then
if (gamestate == 0) then -- If start new game
for i = 1, 6 do
ped_pool[i] = GetPedStruct(i) -- Save to array all ped struct
end
if (#ped_pool> 0) then
gamestate = 1 -- If array 0 ped not defined
end
else
if (gamestate == 1) then
for i, ped in ipairs(ped_pool) do
        If (GetPedHealth(ped) <3) then
          -- If the player’s hp is below 3 then music will play.
          WriteProcessMemory(0x5E202C, 0x2, 2) --[[ By changing the address 0x5E202C to another, you can overwrite the values ​​in the virtual memory of the game. In this example, 2 bytes are written in the address 0x5E202C as a result of this, the game play the music.
         ]]--
        end
end
end
end
else
gamestate = 0 -- If not frame to game restart or game not loaded
end
end
save the file.

3. Run the game. We check our changes, if everything is done correctly, you will see. Enjoy your modding and mastering the new!

P.S.: Now I’m looking for work, I will not be able to quickly answer all questions if they arise. For this, read Doc.txt (they are included in the misi_setup.exe installer), and also study the sources, this will help you understand the scripting device better than any teacher. In addition, in Russia in November 2019 I plan to limit the Internet. I don’t know if this will affect the entire segment, but maybe I can’t go to gtamp.com.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Chaos% mod project

Post by Sektor »

Logofero's MISI is great and should help. Some of the MISI scripts like spawning a car will replace the SCR in memory with an empty one, so that wouldn't work with the existing missions like you need.

I haven't had a chance to test out h0x91b's work but it looks like he figured out how to spawn cars without replacing the whole script in memory. I just have to figure out how to use it.

Removing reload delay, changing ammo and run speed can easily be done with memory writes and cause a bit of chaos.

The best chaos has only been done by modifying mis files and as you know, only bil.mis was released for the official scripts.



All of that could be done without the mis source code but a lot harder and hasn't really been documented. I wrote a script once that made all cars fly towards the player like he was an electromagnet, that would be a funny chaos mod. I don't think I ever got it stable but it should be possible.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Chaos% mod project

Post by elypter »

another way to quickly get results is playing with the car physics. for example setting antistrength to a high value results in cars exploding with a single hit which make collisions very unforgivable
yur sa'nok ngeyä
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Chaos% mod project

Post by Sektor »

//show ped and car ID
COUNTER showpedid = 6204833
COUNTER one = 1
CHANGE_GANG_CHAR_RESPECT (showpedid, one, 111)

That's one of the debug registry keys, so the others are probably near there.
Word of Wind
Ped
Ped
Posts: 4
Joined: 16 Apr 2019, 14:09
GH nick: WordofWind

Re: Chaos% mod project

Post by Word of Wind »

Sektor wrote://show ped and car ID
COUNTER showpedid = 6204833
COUNTER one = 1
CHANGE_GANG_CHAR_RESPECT (showpedid, one, 111)

That's one of the debug registry keys, so the others are probably near there.
I tried it and it indeed works. However I'm not really genius on how to find the other addresses, so if you would like to drop a piece of advice that would be nice. Or if possible you could find all the others too and post them there, that would be amazing, but if its not too difficult to find the others I can try it too

so far I've only been using addresses already in this forum, haven't actually tried finding any myself
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Chaos% mod project

Post by Sektor »

I found some more near there just by trial and error in Cheat Engine memory view. I was just changing 00 to 01 and seeing if anything visible happens.

5EAD52 Show Object IDs
5EAD95 Show Counters
5EAD96 Show Traffic Light Info
5EAD9C Skip Lids (this makes most roads and tiles black, could be funny in chaos%)
5EAD9E Keep Weapons After Death
5EADA1 Show Ped/Vehicle IDs
5EADA7 Show Cycles

I was hoping they would be in a predictable order but it doesn't seem to match the order in debug manager or the text order in gta2.exe.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Chaos% mod project

Post by Sektor »

What debug options would be useful as options in chaos% ?

My choices would be:

Get All Weapons
Keep Weapons After Death
Infinite Lives
Player Invulnerable
Free Shopping (not really needed if you give player millions)

Most of those can be done without using debug memory addresses but if it's cleaner, might as well use them.

You will need to display text and timers for a chaos% and since you can't do that with MISI, it's probably easier to just use your preferred language and make a stand alone program.
Logofero
Serial Killer
Serial Killer
Posts: 264
Joined: 09 Dec 2015, 14:18
Location: Russia, Gelendzhik
Contact:

Re: Chaos% mod project

Post by Logofero »

Sektor wrote:You will need to display text and timers for a chaos% and since you can't do that with MISI, it's probably easier to just use your preferred language and make a stand alone program.
During the active stage of MISI development, I came up with the idea of ​​integrating SDL into a library to display formatted text, but these were just thoughts. This update would allow to display any custom textures and create custom HUD through LUA scripts.

By the way, I saw an example of the work of SDL in the sources of the "Radar" mod from Sector's download at this link: download/file.php?id=1631 But due to the fact that MISI was supported by few people and almost no one writes about it, I decided to stay on the stable version, since the development of even 1 update took my time and a lot of energy, while not bringing feedback. And since the project is non-commercial, only a fan of other players could help keep it updated.

Everyone can continue to update MISI themselves, add to it the functions that they need. In order to continue the development of MISI, you do not need to ask anyone for permission, the sources are open and available for download in the main topic of the project at this link: http://gtamp.com/forum/download/file.ph ... ew&id=1880 (stable MISI v0.4.2)

To continue updating MISI: Create a new forum topic, name the library in your own way or indicate in the name that this is an alternative version of MISI. Enjoy modding!
Word of Wind
Ped
Ped
Posts: 4
Joined: 16 Apr 2019, 14:09
GH nick: WordofWind

Re: Chaos% mod project

Post by Word of Wind »

I forgot to post this but I was indeed looking for the debug addresses and found plenty of them just by testing a lot of stuff. There are still some missing that I didnt figure out but heres what I got:

5EAD55 = show counters (some useful)
5EAD59 = skip left textures
5EAD5B = no traffic car spawns
5EAD5E = no police/remove wanted levels
5EAD5F = skip top textures
5EAD61 = infinite lives
5EAD64 = disable HUD
5EAD67 = skip right textures
5EAD69 = no pedestrian spawns
5EAD6D = mini cars!!
5EAD72 = no audio
5EAD78 = skip slopes
5EAD79 = show fps
5EAD7F = show car horn
5EAD81 = show a lot of random counters
5EAD82 = show camera info
5EAD85 = show vehicle stuff inside car
5EAD87 = debug keys
5EAD88 = freeze screen + insane speed
5EAD89 = junction ID
5EAD8C = skip bottom? textures
5EAD8D = show number of peds
5EAD90 = skip textures
5EADA0 = nekkid peds
5EADB2 = all arrows
Word of Wind
Ped
Ped
Posts: 4
Joined: 16 Apr 2019, 14:09
GH nick: WordofWind

Re: Chaos% mod project

Post by Word of Wind »

One of the effects I'm having in my chaos% mod is turning off framelimiter temporarily, however there seems to be an issue with it. Turning it off and on worked fine on my laptop, however when I tried it again on my normal PC, the game screen would freeze when turning frame limiter back on. This seems like an issue depending on PC and I have no clue how to try fixing that. Sektor suggested messing with other gta2 graphics settings but screen still kept freezing. Does anyone happen to have any idea how to make it not freeze?
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Chaos% mod project

Post by elypter »

maybe there is an external influence. think some screen capture tools can have an impact on the fps.
yur sa'nok ngeyä
Post Reply