No delay for weapons - is this scriptable?

Post Reply
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

No delay for weapons - is this scriptable?

Post by PacMani »

Right after the 2-byte ammo value, there's the 1-byte delay in frames.
Removing the code setting this one up gives these results.


Can this be scripted :?: I just played around with CheatEngine for that video (to demonstrate what it can do for a presentation).

[sm-wink]<--dafuq
User avatar
Sektor
Boss
Boss
Posts: 1393
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: No delay for weapons - is this scriptable?

Post by Sektor »

Nice. I've always wanted to do that. It might require vike to change one of the commands to support peak and poke. Hopefully this motivates him to do it sooner.

I asked him to change CHECK_RESPECT_GREATER ( playername , gangname , requiredlevel ) to change/read bytes if the requiredlevel is 1337 or 31337.
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

Cool thing! I have to get into scripting soon I think, doesn't look too hard, just too lazy to set up tools.

Btw, sometimes GTA2 crashes when shooting Rocket Launchers with 0 delay (appears to happen randomly, not according to the number of missiles flying or explosions seen), I changed the opcode to set a delay of 1 and it never crashed anymore.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: No delay for weapons - is this scriptable?

Post by Cuban-Pete »

OVERLORD READY! :)

Nice hacking!
"Mmmm, your eyes are so beautiful."
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

BTW, a value of 65535 (-1 or 0xFFFF) gives K.F. ammo, can't that be set in scripts? I always saw ammos being "freezed" to 99(0)
User avatar
Sektor
Boss
Boss
Posts: 1393
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: No delay for weapons - is this scriptable?

Post by Sektor »

If you give KF ammo the proper way then you can't switch weapon. I still haven't checked if this can be done just with script and the current exe.
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

Oh lol thats funny, it works flawlessy when just manipulating the ammo value with CheatEngine, you can switch between every weapon with K.F. ammo.
User avatar
Sektor
Boss
Boss
Posts: 1393
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: No delay for weapons - is this scriptable?

Post by Sektor »

I'm surprised more people haven't commented on this. It's one of my all time favourite GTA2 videos.
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

Oh well, I don't think it's too special. It was fun combining this with indestructible cars, you could throw as many rocket launchers or whatever on them and they didn't explode :)
User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: No delay for weapons - is this scriptable?

Post by T.M. »

Sektor wrote:I asked him to change CHECK_RESPECT_GREATER ( playername , gangname , requiredlevel ) to change/read bytes if the requiredlevel is 1337 or 31337.
Will that change the scripts behaviour which use that function already?
Sektor wrote:I'm surprised more people haven't commented on this. It's one of my all time favourite GTA2 videos.
Its ok, i dont comment much on these anyways... here i am, as requested. though.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: No delay for weapons - is this scriptable?

Post by BenMillard »

Liked and added to my GTA Modding Tests playlist.

YouTube URLs just got way, way longer?
User avatar
Sektor
Boss
Boss
Posts: 1393
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: No delay for weapons - is this scriptable?

Post by Sektor »

T.M. wrote:Will that change the scripts behaviour which use that function already?
Nothing uses that command but it won't matter if they do since it will act like normal if the respect value is 100 or under. Anything over 100 is not sensible, so Vike can add his own code there.
User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: No delay for weapons - is this scriptable?

Post by T.M. »

Sektor wrote:
T.M. wrote:Will that change the scripts behaviour which use that function already?
Nothing uses that command but it won't matter if they do since it will act like normal if the respect value is 100 or under. Anything over 100 is not sensible, so Vike can add his own code there.
Oh, but the function is still working in GTA2?

Why not use CHECK_RESPECT_EQUAL() instead? Somewhat more intuitive to me, than using "greater".
User avatar
Vike the Hube
Hitman
Hitman
Posts: 144
Joined: 28 Feb 2010, 22:34
GH nick: vike

Re: No delay for weapons - is this scriptable?

Post by Vike the Hube »

PacMani what exact address did you use for this?
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

The delay is the unsigned byte after the ammo which is a short int in every weapon info structure. There's no fixed address for that or some kind of pointer I can give you right now (I always searched for ammo and added the byte after it).
E.g.
... 04 01 31 00 00 00 ...
Here I got 26 rocket launchers (0x0104 = 260 / 10) and a delay of 49 frames (0x31) until I can shoot it again. The delay may also be a short int but I never had a delay bigger than 255 frames, but stuff afterwards was also always 0x00.

E.g. like here, the weapon info structures are outlined in red, the ammo in green and the delay in blue.
The weapon info array is filled up in the order you got the weapons, e.g. if you got the rocket launcher first, he will be the first one in the array, and if you got a pistol afterwards, it will be the second entry in the array. The byte in the third row in each weapon info structure right after the yellow line also seems to be an order index or something (always counting up, 0x85E4, 0x85F4, 0x8604, 0x8614), don't ask me!^^ There's also a 0x00 and 0x01 flag for weapons which is set for weapons which are fired by tapping Ctrl and not holding it (like the Tank Rocket Launchers), freezing it to 0 or removing the code setting it has no effect though.
Image
User avatar
Sektor
Boss
Boss
Posts: 1393
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: No delay for weapons - is this scriptable?

Post by Sektor »

p + 368 seems to contain the address of the player's 1st weapon ammo but I need a PEEK command to copy that address into a counter or some way to read a value rather than a pointer.

I think the code to remove the delay for the 1st weapon would look something like this once Vike adds PEEK and POKE.

COUNTER ammopointer
COUNTER ammoaddress
COUNTER reload

SET ammopointer = (p + 368)
CHECK_RESPECT_EQUAL (ammopointer, ammoaddress, 1337) // peek (for this example 4 bytes would need to be read into a counter, perhaps 104 for 4 bytes would make more sense than 1337).
SET reload = (ammoaddress + 2)
CHECK_RESPECT_EQUAL (reload, 0, 31337) // poke
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

Wow, you guys could really need a "preprocessor" e.g. translator program for converting new "high level GTA code" to those low level workaround commands :D
User avatar
T.M.
Immortal
Posts: 957
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: No delay for weapons - is this scriptable?

Post by T.M. »

PacMani wrote:Wow, you guys could really need a "preprocessor" e.g. translator program for converting new "high level GTA code" to those low level workaround commands :D
You read my thoughts.

I think that could be done by the custom compiler (which is work in progress, ETA 2019), which would have special functions with intuitive naming, which would generate that code.

Basically it could just display specific patterns of code as those function names, but in reality, the .mis code would still look hacky (if you dont use the custom compiler/scriptpad).

Some of the hacks could never be compressed as simple function names, for example if you use it in a loop.

I think you guys should start listing these hacks in some list of new functions, where anyone could just take them in their scripts. For each function, you would write own function name, in the style of old function names.

For the new custom compiler, Sektor's function definition could look something like this:
[mis]
// function name and parameters:
REMOVE_DELAY_FOR_CURRENT_WEAPON [
PLAYER_PED player1 // one parameter for each line for clarity.
]
// function body:
COUNTER p1ammopointer
COUNTER p1ammoaddress
COUNTER p1reload
SET p1ammopointer = (player1 + 368)
CHECK_RESPECT_EQUAL (p1ammopointer, p1ammoaddress, 1337) // peek
SET p1reload = (p1ammoaddress + 2)
CHECK_RESPECT_EQUAL (p1reload, 0, 31337) // poke

// if the function returns something, we would just type in the end:
// RETURN something
[/mis]
Usage:

Code: Select all

REMOVE_DELAY_FOR_CURRENT_WEAPON (P1)
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: No delay for weapons - is this scriptable?

Post by Cuban-Pete »

Just wanted to drop by and say that this CheatEngine program is rather nice. Thanks for sharing.
"Mmmm, your eyes are so beautiful."
User avatar
PacMani
Car Jacker
Car Jacker
Posts: 39
Joined: 29 Mar 2013, 17:13
GH nick: PacMani

Re: No delay for weapons - is this scriptable?

Post by PacMani »

oh no problem, its making me happy since a decade almost;D
Post Reply