|
 |
|
|
|
|
|
GTA Modification Forums
Changing Car Handling script?
 |
|
 |
| |
ZAZ  |
|
Kernlochbohrer

Group: Members
Joined: Jan 10, 2005



|
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
ZAZ  |
Posted: Wednesday, Oct 21 2009, 20:45
|
Kernlochbohrer

Group: Members
Joined: Jan 10, 2005



|
| QUOTE (Deji @ Oct 20 2009, 23:33) | Memory is pretty simple when you get used to it.
First get the car pointer (there's an opcode for that, search "car pointer").
I think then you do 0xB6F980 + your cars pointer.
Then + a number that can be found in this list: http://www.gtamodding.com/index.php?title=...esses_(SA)#Cars
Then you can use that variable to set the memory address with write_address. |
Thanks Deji, I never spend effort to find it out | CODE | Handling
0xC2B9DC - Handling Block Start. Each slot has 224 bytes of data.
* +0x0 = [dword] Index/Identifier * +0x4 = fMass * +0x8 = 1.0 / fMass * +0xC = fTurnMass * +0x10 = fDragMult * +0x14 = CentreOfMass.x * +0x18 = CentreOfMass.y * +0x1C = CentreOfMass.z * +0x20 = [byte] nPercentSubmerged * +0x24 = fMass * 8.0000001e-1 / nPercentSubmerged * +0x28 = fTractionMultiplier * +0x74 = [byte] TransmissionData.nDriveType * +0x75 = [byte] TransmissionData.nEngineType * +0x76 = [byte] TransmissionData.nNumberOfGears * +0x7C = TransmissionData.fEngineAcceleration (Multiplied by 3.9999999e-4) * +0x80 = TransmissionData.fEngineInertia * +0x84 = TransmissionData.fMaxVelocity (Multiplied by 5.5555599e-3) * +0x94 = fBrakeDeceleration (Multiplied by 3.9999999e-4) * +0x98 = fBrakeBias * +0x9C = [byte] bABS * +0xA0 = fSteeringLock * +0xA4 = fTractionLoss * +0xA8 = fTractionBias * +0xAC = fSuspensionForceLevel * +0xB0 = fSuspensionDampingLevel * +0xB4 = fSuspensionHighSpdComDamp * +0xB8 = Suspension upper limit * +0xBC= Suspension lower limit * +0xC0 = Suspension bias between front and rear * +0xC4 = Suspension anti-dive multiplier * +0xC8 = fCollisionDamageMultiplier (multiplier not yet found) * +0xCC = [hex] modelFlags * +0xD0 = [hex] handlingFlags * +0xD4 = fSeatOffsetDistance * +0xD8 = [dword] nMonetaryValue * +0xDC = [byte] Front lights * +0xDD = [byte] Rear lights * +0xDE = [byte] Vehicle anim group |
In addition I got answers from Kotton QUOTE (Kotton@) | QUOTE |
1@ = 0xC2B9DC 1@ += 3360 //224x15 1@ += 0xBC 0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0 0A8C: write_memory 1@ size 4 value -0.16 virtual_protect 0
as you can see, 0xC2B9DC is the beginning of the handling block- each slot is 224 bytes (1 slot per vehicle) ..so being that the cheetah is the 15th vehicle in the handling.cfg (LANDSTAL being #0) -we get 224x15 = 3360
then we refer to what exact address we want to modify, +0xBC= Suspension lower limit
so after reading that specific address, we write the new value
easy eh? lol
so again looking at the script, you can see that we've modified the following with each keypress..
+0xBC= Suspension lower limit +0xA4 = fTractionLoss +0x10 = fDragMult +0xB0 = fSuspensionDampingLevel +0x1C = CentreOfMass.z
______________________________________________
if I wanted to modify the drag I would access 0x10
1@ = 0xC2B9DC 1@ += 3360 //224x15 (cheetah) 1@ += 0x10 //fdrag multiplier 0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0 0A8C: write_memory 1@ size 4 value 2.5 virtual_protect 0 //2.5 would be the new value |
Ok, now the praxis I want to make cheetah much more faster but keeps stable It's possible if I change 3 parameter of cheetahs original handling.cfg line Topspeed to 850.0, Acceleration to 50.0 and Drag to 1.0 | CODE | HANDLING.CFG
change fDragMult to 1.0 and transmission to 850.0 50.0 (fMaxVelocity/fEngineAcceleration)
name mass turnmass drag centreofmass boy traction transmission
orig. CHEETAH 1200.0 3000.0 2.0 0.0 -0.2 -0.2 70 0.80 0.9 0.50 5 230.0 30.0
mod. CHEETAH 1200.0 3000.0 1.0 0.0 -0.2 -0.2 70 0.80 0.9 0.50 5 850.0 50.0 |
I tried it with the memory codes but any manipulation of accelaeration let the cheetah slide like a soap Drag seems to work but can not prevent the sliding speed was possible to increase but caused crashs by driving very fast, by any bump: freeze the script below: go in groovestreet into red marker to get cheetah and manipulate handling memory | CODE | {$CLEO .cs} :Handlg_1 03A4: name_thread 'Handlg'
:Handlg_2 0001: wait 0 ms 00D6: if 0 0256: player $PLAYER_CHAR defined 004D: jump_if_false @Handlg_2 00D6: if 0 00FF: actor $PLAYER_ACTOR 1 (in-sphere)near_point_on_foot 2491.5 -1667.5 13.35 radius 1.0 1.0 1.0 004D: jump_if_false @Handlg_2 0247: request_model #CHEETAH
:Handlg_3 0001: wait 0 ms 00D6: if 0 0248: model #CHEETAH available 004D: jump_if_false @Handlg_3 00A5: 0@ = create_car #CHEETAH at 2487.5 -1660.5 13.35 0175: set_car 0@ z_angle_to 90.0
1@ = 0xC2B9DC 1@ += 3360 //224x15 (cheetah) 1@ += 0x84 //TransmissionData.fMaxVelocity 0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0 0A8C: write_memory 1@ size 4 value 2.5 virtual_protect 0 //2.5 would be the new value
//3@ = 0xC2B9DC //3@ += 3360 //224x15 (cheetah) //3@ += 0x7C //TransmissionData.fEngineAcceleration //0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0 //0A8C: write_memory 3@ size 4 value 0.1 virtual_protect 0 //2.5 would be the new value
5@ = 0xC2B9DC 5@ += 3360 //224x15 5@ += 0x10//fDragMult multiplier 0A8D: 6@ = read_memory 5@ size 4 virtual_protect 0 0A8C: write_memory 5@ size 4 value 0.1 virtual_protect 0
0249: release_model #CHEETAH 0001: wait 1000 ms 0013: 2@ *= 100.0 // floating-point values 0013: 4@ *= 100.0 // floating-point values 0013: 6@ *= 100.0 // floating-point values 0092: 11@ = float_to_integer 2@ 0092: 12@ = float_to_integer 4@ 0092: 13@ = float_to_integer 6@
:Handlg_4 0001: wait 0 ms 00D6: if 0 0256: player $PLAYER_CHAR defined 004D: jump_if_false @Handlg_4 03F0: enable_text_draw 1 045A: text_draw_1number 50.0 42.0 'NUMBER' 11@ // value 045A: text_draw_1number 200.0 45.0 'NUMBER' 12@ // value 045A: text_draw_1number 350.0 45.0 'NUMBER' 13@ // value 00D6: if 0 80FF: NOT actor $PLAYER_ACTOR 0 ()near_point_on_foot 2491.5 -1667.5 13.35 radius 2.0 2.0 2.0 004D: jump_if_false @Handlg_4 01C3: remove_references_to_car 0@ // Like turning a car into any random car 03F0: enable_text_draw 0 0002: jump @Handlg_2 |
i tried first 850.0 and 50.0 but cheetah was sliding a lot itried 350.0 a d 35.0 and i tried hexcode and tried 35.0 and 5.0 cheetah was allways sliding look for the textmessages it shows the real value of the memadress At the first going into read marker and keep standing there it shows the original handling memvalues by the next going into red marker it shows the new values of the memadress it was neccesary to multiplicate the values with 100 to show floats (exemple: if the value would be 0.53 it will be displayed as 53) the original value of velocitymemadress of cheetah is allways 1.04 and displayed as 104 the original value of drag of cheetah is allways 2.0 and displayed as 200 the original value of acceleration can't remember, i believe ciro with 2.5 as write_memory of velocity can i drive 250.0 with 0.01 as write_memory of fEngineAcceleration can i drive also 250.0 and accelerate normal I believe, this is not acceleration: 0x7C = TransmissionData.fEngineAcceleration furthermore i'm wondering what (Multiplied by 5.5555599e-3) means * +0x7C = TransmissionData.fEngineAcceleration (Multiplied by 3.9999999e-4) * +0x80 = TransmissionData.fEngineInertia * +0x84 = TransmissionData.fMaxVelocity (Multiplied by 5.5555599e-3) This post has been edited by ZAZ on Thursday, Oct 22 2009, 15:33
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Wesser  |
|
The complexity simplifier, the efficiency optimizer

Group: Members
Joined: Aug 19, 2006



|
Finally, I found a way to solve that. Handling lines are read in groups which can be respectively divided into: cars -> bikes -> boats -> planes. Unfortunally, the lines aren't ordered like vehicles ID (handling.cfg - vehicles.ide). Since we can't know what's the real line position, I wrote an external file where I put all positions per ID, picked from vehicles.ide. Here is the code: | CODE | {$CLEO}
0000: NOP
4@ = 0
while true wait 0 if 00DF: actor $PLAYER_ACTOR driving then 03C0: 1@ = actor $PLAYER_ACTOR car 0441: 0@ = car 1@ model gosub @ReadFromFile 0@ -= 400 0@ *= 0xE0 0@ += 0xC2B9DC 0@ += 0x7C 0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 0A8C: write_memory 0@ size 4 value 0.1 virtual_protect 0 4@ = 1 repeat wait 0 until 80DF: not actor $PLAYER_ACTOR driving else if 4@ <> 0 then 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 4@ = 0 end end end
:ReadFromFile 0A99: chdir 0 if 0A9A: 1@ = openfile "./cleo/handlingId.dat" mode 0x6272 then for 2@ = 400 to 0@ 0A9D: readfile 1@ size 2 to 3@ end 0085: 0@ = 3@ 0A9B: closefile 1@ end return |
Before trying it, you need the file I was talking about downloadable from here. It's not 100% tested, so please report any bugs.  I hope this should be useful. This post has been edited by Wesser on Friday, Dec 11 2009, 20:19
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
ZAZ  |
|
Kernlochbohrer

Group: Members
Joined: Jan 10, 2005



|
| QUOTE (carljrbrass @ Mar 25 2011, 11:44) | | O, and i frgt...if i have to download another file or smtn like that it would be no problem at all. this mod isnt like, public. its just for me and a few buddies and whoeverelse wants it xD |
There are script examples in this topic, so you can do it yourself. I wrote a report of my tests, you should read it. If you don't understand it, her's the fazit: There are problems problem1 it was not possible for every car but Wesser found a way to fix it and showed the method in his last script which he posted at Jul 26 2010 problem2 the game becomes unstablty if you increase the acceleration problem3 it don't makes fun to write a hanglingmodscript because of problem2 This post has been edited by ZAZ on Friday, Mar 25 2011, 16:18
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
carljrbrass  |
Posted: Saturday, Mar 26 2011, 15:02
|
Player Hater

Group: Members
Joined: Mar 25, 2011

|
Thanx for the reply and advice, ive tried it using wesser's methood agn after reading the previous post, but still the same result, i can get it to read, but it only reads vehicle mass and top speed, i think, not shure, but think..it also is reading engine inertia...it seems like that a bit but im not shure. but if i raise the top speed just a tiny bit the game crashes when the car changes gears at a high speed, it does like a small bump like *\ and come back down - and then it goes half way up and the game freezez for a little while and then crashes. so right now im just experamenting with things but i hope i can make it work. if i increase the acceleration of any car by +6 it crashes. ive tested on the infernus hotringracer and nrg...yea...nrg crashed when i accelerated lol so it was a fail. right now im trying to see if its crashing be cause of something else or cause of the speed bieng +6...cause +6 isnt really much  . anyways thanx for the help really appriceate it. and btw ive got a little progress of the gear shift flame, i had the timer wrong xD
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|