Page 3 of 6

Re: GTA2 memory addresses

Posted: 15 Dec 2015, 16:52
by Jones
I would want so much to wrap those messy hacks into one function call, such as: frame = get_framecount(). I thought this could be done in JavaScript, so you write the new style code there and "compile" it into MIS file which contains all those ugly hacks and temporary variables etc. When it is made in JS, anyone could tamper with the code and develop further easily without needing to dl any tools, also insta cross-platform.
In my opinion the next/first step would be adding this feature in B-$hep and your's compiler. Add get_framecount as an internal declared function which will converted to the right bytecodes :) Not sure if adding the JS layer would be worth all the trouble.

Re: GTA2 memory addresses

Posted: 17 Dec 2015, 01:56
by Logofero
Has anyone tried to get the address of the memory at the time of the declaration of a new Object in the script, it is possible?

It would be very helpful to declare the Objects COUNTERS/DOORS/OBJECTS/CARS/CHARS in the game. You can then create an external engine and load your scripts without compilation.

I have previously suggested is here http://gtamp.com/forum/viewtopic.php?f=4&t=815#p9571
16. There was more epic question: Is it possible to create an external engine (for multiplayer) that will use their scripts and work through the memory game (server -> client-side)?
We need to find addresses Declaration objects to create/delete dynamically through memory. Then you can forget about the complexities of the language syntax: add many missing features to work with files (load/save data to a file) and make full GTA2 base for mods.

I think this is the most important step to create something new in GTA2

Re: GTA2 memory addresses

Posted: 17 Dec 2015, 03:40
by Sektor
We already have the memory addresses to change the coordinates of existing objects. New object creation is best done by hooking GTA2 and executing the existing functions, rather than just writing to memory. I don't know how to execute existing functions from external code but I know it's possible.

Re: GTA2 memory addresses

Posted: 17 Dec 2015, 14:24
by T.M.
Sektor wrote:I've only seen a few other people even attempt to use these memory addresses but making it easier might attract some more scripters.
Indeed! Its too tedious currently, so not many people dare to mess with the code.

Re: Help for scripters (One topic - all questions)

Posted: 17 Dec 2015, 18:13
by B-$hep
If i could have memory addresses and examples how each can be used then i could add single or two commands into mis2 syntax and write this all into .scr file.

So users dont have to mess with direct memory. But can just script it.

Re: GTA2 memory addresses

Posted: 02 Jan 2016, 18:42
by Razor
We need to find addresses Declaration objects to create/delete dynamically through memory. Then you can forget about the complexities of the language syntax: add many missing features to work with files (load/save data to a file) and make full GTA2 base for mods.

I think this is the most important step to create something new in GTA2
Can't WAIT! I would definitely back to gta2 if there was no desync and you just could join to servers :)

I'll just stay here and stalk those changes

B-$heep - I agree some mapmakers like kamil/heri would definetly use that.

Cheers!

Re: GTA2 memory addresses

Posted: 22 Aug 2016, 07:29
by Sektor
Run faster than Usain Bolt!

pedsprite + 57 = walk/run speed. Speed 1 to 3 walk, 4 and above run. Any faster than 12 and you will outrun the camera.

[mis]IF (NOT(IS_CHARACTER_IN_ANY_CAR(p1)))
COUNTER speed = 12
COUNTER speed_addr
COUNTER pedsprite_ptr
COUNTER pedsprite_addr
SET pedsprite_ptr = (p1+360)
CHANGE_GANG_CHAR_RESPECT (pedsprite_ptr, pedsprite_addr, 104) //read pedsprite address
SET speed_addr = (pedsprite_addr+57)
CHANGE_GANG_CHAR_RESPECT (speed_addr, speed, 114) //write player speed value
ENDIF[/mis]

Re: GTA2 memory addresses

Posted: 14 Jan 2017, 11:59
by Sektor
p1car + 88 = car pointer + 64 = car X speed
p1car + 88 = car pointer + 68 = car Y speed

Slide a car to the right (change carspeed=100 to a higher value to increase slide speed or set it to a negative to go left)

GTA2 only reads this memory address if a ped is in the car or if there's a collision, so I put a ped in there to make the sprite update.
[mis]
PLAYER_PED p1 = (137.0, 150.8, 255.0) 6 180
CAR_DATA p1car = (135.5, 154.0, 255.0) 1 180 T2000GT

COUNTER loop = 1
COUNTER car_addr
COUNTER car_ptr
COUNTER carspeedaddress
COUNTER carspeed

LEVELSTART

GIVE_DRIVER_AND_BRAKE (p1car)

WHILE_EXEC (loop = 1)

SET car_ptr=(p1car+88)
CHANGE_GANG_CHAR_RESPECT (car_ptr,car_addr,104)
SET carspeedaddress = (car_addr+64)
SET carspeed=100
CHANGE_GANG_CHAR_RESPECT (carspeedaddress, carspeed, 114)

ENDWHILE //main while

LEVELEND
[/mis]

Re: GTA2 memory addresses

Posted: 11 Feb 2017, 23:51
by Sektor
Play a vocal without displaying a message by writing 4 bytes to 5E202C. 1 to 62.

1 INSANE STUNT BONUS!
2 GRAND THEFT AUTO!
3 WIPEOUT!
4 EXPEDITIOUS EXECUTION!
5 GENOCIDE!
6 COP KILLA!
7 CAR JACKA!
8 ELVIS HAS LEFT THE BUILDING!
9 ACCURACY BONUS!
10 BACK-TO-FRONT-BONUS!
11 MEDICAL EMERGENCY!
12 KILL FRENZY!
17 BUSTED!
18 FRENZY FAILED!
19 FRENZY PASSED!
20 FRYING TONIGHT!
22 [1124] JOB COMPLETE!
23 [1125] JOB FAILED!
24 AND REMEMBER, RESPECT IS EVERYTHING!
25 SHOCKING!
26 MMM... SOMETHIN'S COOKIN!
27 [5015] TIME'S UP, PAL!
28 TOASTED!
29 WASTED!
30 bombarmed.wav (weird one)
31 laugh6.wav
32 LAUGH (changes each time you play it)
33 [5501] RACE OVER!
34 [5502] SECOND LAP!
35 [5503] FINAL LAP!
36 [5504] RACE ON!
37 [5505] HEY! 30 PEOPLE DOWN! MULTIPLIER X2
38 [5506] OOH! 60 PEOPLE DOWN! MULTIPLIER X3
39 [5507] NICE! 90 PEOPLE DOWN! MULTIPLIER X4
40 [5508] GREAT! 120 PEOPLE DOWN! MULTIPLIER X5
41 [5509] OUTSTANDING! 150 PEOPLE DOWN! MULTIPLIER X6
42 [5510] TIME OUT!
43 [5000] YOUR TIME IS EXTENDED!
44 [5015] TIME'S UP, PAL! (duplicate)
45 [5031] Oh, sorry about that... Did that hurt?
46 [5032] Nice work!
47 [5050] CHOCTASTIC!
48 [5051] RASPBERRY RIPPLE!
49 [5052] YOU SHOT YOUR LOAD!
50 [5053] OOH... DID THAT HURT?
51 [5054] DEATH TO ICE-CREAM VANS!
52 [5055] CRISPY CRITTER!
53 [5056] YOU'RE TOAST, BUDDY!
54 [5057] EAT LEADEN DEATH, PUNK!
55 [5058] THAT'S GOTTA HURT!
56 [5059] SORRY ABOUT THAT!
57 [5060] XIN LOI, MY MAN!
58 [5061] DAMN SUNDAY DRIVERS!
59 [5062] SUCK IT AND SEE!
60 [5063] TASTE MY WRATH, ICE-CREAM BOY!
61 HALLELUJAH, ANOTHER SOUL SAVED!
62 DAMNATION, NO DONATION, NO SALVATION!

So now we can finally play the unused vocals "FRYING TONIGHT!", "MMM... SOMETHIN'S COOKIN!" and "BOMB ARMED!"

[mis]PLAYER_PED p1 = (117.0,133.5,2.0) 10 270

COUNTER vocaladdr = 6168620
COUNTER vocalvalue = 1

LEVELSTART

SET vocalvalue = 26 // something's cooking!
CHANGE_GANG_CHAR_RESPECT (vocaladdr,vocalvalue, 114)

LEVELEND[/mis]

Still don't know how to play gameover.wav.

Re: GTA2 memory addresses

Posted: 06 Mar 2017, 15:33
by BenMillard
Sweet, didn't know about those two audio announcements.

Re: GTA2 memory addresses

Posted: 16 Jun 2017, 01:45
by Devastator
I've been having fun getting Invisibility to work on scripted Assassins, as well as varying health increments for scripted characters. I wanted to know, what is the address to give a Ped electrofingers? I'd love to have fun with that. & can Peds be given Fast Reload/Double Damage? That'd be intense.

Also, do you guys think it'd be possible to create custom occupations with proper hacking? Scripted FBI guys always prefer to shoot the player from half a block away, but committing a crime in front of them will give you a wanted level. It'd be cool to be able to create characters that behave similarly but don't give you a wanted level when you attack in front of them. Same thing with someone who acts like a Cop, firing at you when you're in a vehicle but punching you when you're on foot.
I noticed a nifty thing about non-scripted FBI guys the other day too- We usually think there's one with a Silenced Machine Gun & one with a Shotgun. I noticed that the Special Agents who get out of cars, the one's with the silenced Machine Gun will shoot you with a shotgun when they're in range. If it wasn't the ones in cars than it was the road block ones. It'd be cool if there could be an occupation who uses a shotgun on you at close range. Are custom occupations like that doable or do you have to edit the .exe directly?

EDIT: FBI guys & presumably other scripted LEO occupations won't give you a wanted level if you commit a crime in front of them if they have an objective, like killing you on foot. So I assume standard behavior only defaults when they're set to NO_OBJ. It'd still be cool for that behavior without a wanted level though. My script involves objective changes once the player dies, the assassins don't despawn, they level up & wander the city aimlessly.

Re: GTA2 memory addresses

Posted: 16 Jun 2017, 02:03
by elypter
Devastator wrote:It'd be cool if there could be an occupation who uses a shotgun on you at close range. Are custom occupations like that doable or do you have to edit the .exe directly?
i think you can just remove the smg when he is close enough and give him a shotgun instead. when hes far anough away give him a smg again. that should work even if he is on patrol which i found is much more stable when the character should respawn multiple times. if you want him to move closer and closer you can toggle smg and shotgun as long as he is too far away for shotgun so he will run, shoot, sun, shoot which makes him less predictable. and if you want him to be extremely dangerous toggle punch(no weapon) and shotgun as well

Re: GTA2 memory addresses

Posted: 16 Jun 2017, 03:46
by Devastator
That sounds like it'd actually be pretty cool to implement, but what commands would I use to do that? I'm looking at the Gta2 scripting tutorials on Ben's website & I'm not sure what commands to use.The possibility of an NPC cycling between 3 weapons? That'd be awesome.

Re: GTA2 memory addresses

Posted: 16 Jun 2017, 12:14
by elypter
GIVE_WEAPON
REMOVE_WEAPONS
maybe CHECK_CHAR_CURR_WEAPON

i dont know about a command that checks for the distance between 2 characters. i dont know if i missed it or if it doesnt exist but it can be done with pointer magic http://gtamp.com/forum/viewtopic.php?f=4&t=700 the first post has an example for reading coordinates of chars. then calculate sqrt((x1-x2)²+(y1-y2)²) for the distance.

if sqrt doesnt work then it can be done without too http://gtamp.com/forum/viewtopic.php?p=9585#p9585

Re: GTA2 memory addresses

Posted: 17 Jun 2017, 22:27
by Devastator
I know you guys have been able to create new commands in the scripting document. I just tested it out & the damage type ANY_ELECTRO_WEAPON doesn't work for the electro baton. (I'm not sure about Electro Fingers). Could you guys create a damage type for the electro baton? I have some ideas I could use for it, including usage of the laser trip wire. Maybe BY_TASER_BULLET & BY_TASER_ARC?

& Could a STUN_CHAR command be made? That puts a character in a punch stun state.
I could do something like
IF (CHECK_WEAPON_TYPE_HIT_CHAR (Thug1, BY_TASER_BULLET))
STUN_CHAR (Thug1)
ENDIF

& If the stream fromn the electro baton could be modified to act like the Electro gun by pinning stunned characters to ground, I'd set the next command to be
IF (CHECK_WEAPON_TYPE_HIT_CHAR (Thug1, BY_TASER_ARC)
SET_CHAR_MAX_RUN_SPEED (Thug1, 0.01)
ENDIF.

I could also use it as a way to remove enemy weapons on some maps, or with laser trips remove player weapons. Or as a way to add characters to the Player's group (maybe it could be worked to act similarly to STORE_LAST_CHAR_PUNCHED so that you could add dummy peds to your group.

Have you guys found the address for the electro_baton yet?



EDIT: Would there be a way to override invulnerability using the CHECK_WEAPON_TYPE_HIT_CHAR command?

i.e.
IF (CHECK_WEAPON_TYPE_HIT_CHAR (Term2, BY_CAR_BOMB))
KILL_CHAR (Term2)
ENDIF

I just tested this out & it doesn't work, it'd be cool if I could use this to kill scripted invincible characters.

EDIT: I found a work around involving turining character invincible with certain damage types, & turning invincibility off when he's attacking.

Re: GTA2 memory addresses

Posted: 03 Jul 2017, 06:55
by Devastator
What do I need to do to get the Zoom code working? I've tried it & it isn't working when my main loop starts. My map is mostly all on foot & the default camera height is a bit claustrophobic, so getting a base zoom for all players would be beneficial.

Re: GTA2 memory addresses

Posted: 05 Jul 2017, 01:49
by Sektor
I'll look at the zoom code later, no time now.

Infinite armour (only works on players, crashes on bots)
[mis]
LEVELSTART

COUNTER loop = 1
COUNTER player_ptr
COUNTER player_addr
COUNTER armour_ptr
COUNTER armour_addr = 10

WHILE_EXEC (loop = 1)

ALTER_WANTED_LEVEL_NO_DROP (p1,6)

SET player_ptr = (p1+348)
CHANGE_GANG_CHAR_RESPECT (player_ptr,player_addr,104)
SET armour_ptr = (player_addr+1786)
CHANGE_GANG_CHAR_RESPECT (armour_ptr,armour_addr,112)

ENDWHILE

LEVELEND
[/mis]

Re: GTA2 memory addresses

Posted: 15 Jul 2017, 12:13
by Sektor
10 days later, here is the code to zoom the camera out:

[mis]
//zoom camera out
PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
PLAYER_PED p2 = (118.0,133.5,1.0) 09 090 // Orange
PLAYER_PED p3 = (117.5,132.5,1.0) 07 180 // Yellow
PLAYER_PED p4 = (117.5,134.5,1.0) 11 000 // Green
PLAYER_PED p5 = (117.0,132.5,1.0) 13 225 // Blue
PLAYER_PED p6 = (118.0,134.5,1.0) 08 045 // Black

COUNTER loop = 1
COUNTER camera_z_addr
COUNTER camera_z_value = 300000

LEVELSTART

WHILE_EXEC (loop = 1)

SET camera_z_addr = (p1+436)
CHANGE_GANG_CHAR_RESPECT (camera_z_addr,camera_z_value,114)

ENDWHILE

LEVELEND
[/mis]

Re: GTA2 memory addresses

Posted: 17 Jul 2017, 13:49
by Devastator
Awesome, thank you. How far is that zoom relative to the baseline on foot camera?

Re: GTA2 memory addresses

Posted: 17 Jul 2017, 14:21
by Sektor
Default is 32,768. You can find out by reading that address instead of writing. Change 114 to 104 to make it read and then add it to score to see it easily.

300,000 is probably too high, change that to a lower number to reduce zoom.