Quantcast

Jump to content

» «
Photo

GTA2 speedrun timer livesplit script

4 replies to this topic
Sektor
  • Sektor

    GTAMP.com

  • GTA Series Staff
  • Joined: 28 Jan 2003
  • None

#1

Posted 15 September 2017 - 03:12 PM Edited by Sektor, 05 October 2017 - 05:10 AM.

I started writing a GTA2 speedrun timer but then I looked at livesplit and wondered why there wasn't a GTA2 livesplit ASL script. I made a simple one that starts the timer when in game and pauses timer on menu. It would be better to only pause timer on area complete/game complete but menu was easier to find.

While looking to see if livesplit could download the GTA2 level records (it can't without making a custom component, it only downloads full game records), I found GTA2 Check, a GTA2 checklist and speedrun tool created by Molotok! Nice program, please share the memory addresses if you still have them, it might save some time. Did you post about GTA2 Check anywhere? It would still be cool to add something like that to the radar with route logs.
 
I'm not actually sure what 0x1EE068 is supposed to store but it seems to be 0 on menu and 1 when in game. I have the frame count address, dividing that by 30 should return time in seconds.

This version should reset timer when you start a level (only useful for individual level timing) and pause timer when on menu.

edit: outdated script removed

Save as gta2.asl, run livesplit, right click, choose edit layout, load gta2.asl as an auto split file and set timer to game time since real time doesn't pause.

I haven't submitted it to github yet since I'm still updating it.
  • Molotok likes this

Molotok
  • Molotok

    K.G.B. Agent

  • Members
  • Joined: 01 Jun 2008

#2

Posted 16 September 2017 - 09:50 PM Edited by Sektor, 24 September 2017 - 01:37 PM.

About the gta2 check program I did that 3 years ago and the timer there is messed up (I think I used clock time which was not very smart :miranda: )... but as a checklist it works preperly. Of course I lost the file with the addresses which Lighnator from speedrun.com gave me, so I asked him again and here they are:
 
kgIiw7L.png
 
I will try to test your script when I figure out how to do it. Thanks for your efforts in advance!

Molotok
  • Molotok

    K.G.B. Agent

  • Members
  • Joined: 01 Jun 2008

#3

Posted 17 September 2017 - 05:20 PM Edited by Molotok, 17 September 2017 - 11:24 PM.

Kinda forgot, but a more useful explanation on the address stuff:

 

Main mission script start pointer contains the value with the base address to which you need to add some offsets to get the address for some other values like jobs done etc.

mission_script_ptr = 0x006644BC // or gta2.exe + 2644BC
mission_script_val = mission_script_ptr*

xy_address = mission_script_val + offset // see below for the different offsets
offset = 0x0310 // required score
* = 0x0328 // total jobs done
* = 0x032C // gang1
* = 0x0330 // gang2
* = 0x0334 // gang3
* = 0x0338 // frenzies

// token adress
0x005EC5E4 // or gta2.exe + 1EC5E4 

// player pointer
player_ptr = 0x005E3CC4 // or gta2.exe + 1E3CC4

// money
money = player_ptr* + 0x188

Edit: I made a mistake, this values work only in the 9.6 version, the splitter doesn´t work with 9.6 version, only on 11.44. Must be another address for 9.6.

Edit2: Replaced the picture in the previous post while running the 9.6 version, so all the values can be seen.


Sektor
  • Sektor

    GTAMP.com

  • GTA Series Staff
  • Joined: 28 Jan 2003
  • None

#4

Posted 18 September 2017 - 04:25 AM Edited by Sektor, 10 November 2017 - 09:59 AM.

This livesplit script should work on 9.6 and 11.x versions. It's only useful for individual level runs since it resets timer on levelstart and pauses on levelend. I will try to make a version for full runs but I don't know when I will get time for that.
 
state("gta2", "v9.6")
{
    bool ingame: 0x1DE068;
}
state("gta2", "v11.44")
{
    bool ingame: 0x1EE068;
}

init
{
    if ((int)modules.First().BaseAddress == 0x3F0000)
        version = "v11.44";
    else if ((int)modules.First().BaseAddress == 0x400000)
        version = "v9.6";
}

start {
  if (current.ingame)
  {
    return true;  
  }
}

isLoading {
  return !current.ingame;
}

reset {
  if(current.ingame && current.ingame != old.ingame)
  {
    return true;
  }
}
  • Molotok likes this

Molotok
  • Molotok

    K.G.B. Agent

  • Members
  • Joined: 01 Jun 2008

#5

Posted 18 September 2017 - 02:33 PM

Yes, it works nicely. I figured it also works with the main script pointer since the address is 0 if you are not ingame. Would be good to have it split after each job complete and only reset when you start a new game (checking the money value would solve it). I played around a bit and with tokens it is easy as you only have just one offset but so far didn´t find a way to get to the other values yet. 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users