Quantcast

Jump to content

» «
Photo

[Q|SA] Traffic AI Question

6 replies to this topic
SergeantSavidge
  • SergeantSavidge

  • Members
  • Joined: 29 Dec 2013
  • England

#1

Posted 19 January 2014 - 02:08 PM

Hello, I wanted to know if it's possible to make all land vehicles in San Andreas have the same traffic AI as the police department vehicles. For instance, in places like Mulholland, the vehicles' wheels "hover" off the ground sometimes because it's a hilly road on a slant, whereas if a police vehicle were to drive up the same hilly road, it would have all four wheels on the ground and it would behave the same way as if CJ was driving it himself. If anybody knows how to do this either via SCM editing or via CLEO, it'd be much appreciated. Thanks for reading :)

  • snoops26 likes this

Jeansowaty
  • Jeansowaty

    Notorious fan of underground electronic music and Molly Schultz

  • Members
  • Joined: 31 Mar 2013
  • Poland

#2

Posted 19 January 2014 - 02:27 PM

Didn't know that the AI behaves differently depending on the area. Well I noticed one change, the cars on highways were driving so f********g fast that one hispanic w***e just pushed me once with her Nebula, I had full health, and I died.

  • SergeantSavidge likes this

SergeantSavidge
  • SergeantSavidge

  • Members
  • Joined: 29 Dec 2013
  • England

#3

Posted 19 January 2014 - 02:38 PM

Didn't know that the AI behaves differently depending on the area. Well I noticed one change, the cars on highways were driving so f********g fast that one hispanic w***e just pushed me once with her Nebula, I had full health, and I died.

Yeah, that's another thing. I managed to find some script that edits the highway traffic nodes so that they slow down a fair bit, but what also bugs me is that they exit on the outside lane a lot. I've had too many car wrecks to recall because of this :panic:

  • snoops26 likes this

madleg
  • madleg

    Player Hater

  • Members
  • Joined: 01 Jan 2014
  • Russia

#4

Posted 19 January 2014 - 02:41 PM

here's my old script, what is actually unfinished (it have a lot of problems, and im too lazy to finish it)

{$CLEO}
0000:
0A96: 11@ = actor $PLAYER_ACTOR struct
while true
    wait 0
    0A8D: 0@ = read_memory 0xB74494 size 4 virtual_protect 0
    0@ += 0x4
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
    for 1@ = 0 to 27904 step 0x100
        0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
        000A: 0@ += 0x1
        005A: 2@ += 1@                                                         
        0A97: 3@ = car 2@ struct
        3@ += 1192
        0A8D: 4@ = read_memory 3@ size 1 virtual_protect 0
        if
            not 4@ == 3
            then
            3@ += 236
            0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0
            if
                4@ < 2
                then
                3@ -= 308
                0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0
                if and
                    4@ > 0
                    803B:   11@ == 4@  // (int)
                    then
                    if
                        8975:   car 2@ emergency_vehicle
                        then
                        3@ -= 169
                        0A8D: 7@ = read_memory 3@ size 1 virtual_protect 0
                        3@ += 3  
                        0407: store_coords_to 4@ 5@ 6@ from_car 2@ with_offset 0.0 0.0 0.0
                        car.DriveTo(2@, 4@, 5@, 6@)
                        0A8C: write_memory 3@ size 1 value 1 virtual_protect 0
                        3@ += 238
                        0A8C: write_memory 3@ size 1 value 3 virtual_protect 0 
                        3@ -= 239
                        0209: 4@ = random_int_in_ranges 0 10                                
                        if
                            4@ < 9
                            then
                            0A8C: write_memory 3@ size 1 value 0 virtual_protect 0
                            else
                            0A8C: write_memory 3@ size 1 value 5 virtual_protect 0
                        end 
                        3@ -= 1
                        0A8C: write_memory 3@ size 1 value 7@ virtual_protect 0 
                    end
                end
            end
        end 
    end
end
  • SergeantSavidge likes this

SergeantSavidge
  • SergeantSavidge

  • Members
  • Joined: 29 Dec 2013
  • England

#5

Posted 19 January 2014 - 06:14 PM

 

here's my old script, what is actually unfinished (it have a lot of problems, and im too lazy to finish it)

 

Thanks man, this is just what I was looking for! I don't know what you mean by "problems" but I have only one flaw to point out -- some vehicles try to overtake others at red lights and end up waiting for the red light on the other side of the road. Other than that, this script is brilliant! :)

  • snoops26 likes this

madleg
  • madleg

    Player Hater

  • Members
  • Joined: 01 Jan 2014
  • Russia

#6

Posted 29 January 2014 - 10:10 AM

some vehicles try to overtake others at red lights and end up waiting for the red light on the other side of the road.

i just wanted to randomize AI )) anyway here's a small "lazy update". just ctrl+c ctrl+v all traffic part of CCarCtrl in each struct, i hope this one will fix all issues without crashes. also, if you know some unused addresses in carstruct, u can replace bomb address, what im using as mark

{$CLEO}
0000:
0A96: 11@ = actor $PLAYER_ACTOR struct

while true
    wait 0
    0A8D: 0@ = read_memory 0xB74494 size 4 virtual_protect 0
    0@ += 0x4
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
    for 1@ = 0 to 27904 step 256
        0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
        000A: 0@ += 1
        if and
            0029: 2@ >= 0x00 
            001B: 128 > 2@
            then
            005A: 2@ += 1@                                             
            0A97: 3@ = car 2@ struct
            3@ += 1192
            0A8D: 4@ = read_memory 3@ size 1 virtual_protect 0
            if
                not 4@ == 3
                then
                3@ += 236
                0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0
                if
                    4@ < 2
                    then
                    3@ -= 308
                    0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0
                    if and
                        4@ > 0
                        803B:   11@ == 4@  // (int)
                        then
                        if
                            8975:   car 2@ emergency_vehicle
                            then

                            0A97: 25@ = car 2@ struct
                            0A8E: 30@ = 25@ + 0x390
                            0AC6: 29@ = label @_test offset
                            for 28@ = 0 to 37 step 1
                                0A8D: 27@ = read_memory 30@ size 4 virtual_protect 0
                                30@ += 4
                                0A8C: write_memory 29@ size 4 value 27@ virtual_protect 0
                                29@ += 4
                            end

                            car.DriveTo(2@, 0.0, 0.0, 0.0)
                            0A8E: 30@ = 25@ + 0x390
                            0AC6: 29@ = label @_test offset
                                
                            for 28@ = 0 to 37 step 1
                                0A8D: 27@ = read_memory 29@ size 4 virtual_protect 0
                                29@ += 4
                                0A8C: write_memory 30@ size 4 value 27@ virtual_protect 0
                                30@ += 4
                            end
                            0A8E: 30@ = 25@ + 1192
                            0A8C: write_memory 30@ size 1 value 3 virtual_protect 0 
                        end
                    end
                end
            end 
        end
    end
end

:_test
hex
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 
end

btw, saw the func CCarSwithphysicstonormal or something like this, maybe later i will see what it can do


SergeantSavidge
  • SergeantSavidge

  • Members
  • Joined: 29 Dec 2013
  • England

#7

Posted 29 January 2014 - 08:52 PM

i just wanted to randomize AI )) anyway here's a small "lazy update". just ctrl+c ctrl+v all traffic part of CCarCtrl in each struct, i hope this one will fix all issues without crashes. also, if you know some unused addresses in carstruct, u can replace bomb address, what im using as mark


 

btw, saw the func CCarSwithphysicstonormal or something like this, maybe later i will see what it can do

 

Wow, this is brilliant! Yep, it works fine without any crashing issues as well, you should release this on the Mod Showroom or something, I bet loads of people would want this. Thanks again, feel free to contribute more if you've found something worth mentioning :)

  • snoops26 likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users