Quantcast

Jump to content

» «
Photo

The Modders Lounge

297 replies to this topic
SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#241

Posted 04 March 2014 - 07:15 PM

Hi guys, I have something that you'll probably be able to answer. Okay, so I have this traffic CLEO4 script and what it does is make the vehicle AI similar to the police vehicles' AI (meaning that they don't stop from going 200km/h instantly) and it works great, but I would like to add something to it but I'm not entirely sure on how to approach it. I want to make the drivers not get impatient when waiting at a red light, so it adds realism. Can anybody point me in the right direction? It would be very much appreciated. Also, thanks for reading.

 

This is the current script btw:

Spoiler

  • Concavax likes this

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#242

Posted 05 March 2014 - 07:26 PM

Hi guys, I have something that you'll probably be able to answer. Okay, so I have this traffic CLEO4 script and what it does is make the vehicle AI similar to the police vehicles' AI (meaning that they don't stop from going 200km/h instantly) and it works great, but I would like to add something to it but I'm not entirely sure on how to approach it. I want to make the drivers not get impatient when waiting at a red light, so it adds realism. Can anybody point me in the right direction? It would be very much appreciated. Also, thanks for reading.


From my experience, peds do not get impatient waiting at lights. They seem to get impatient waiting behind other vehicles though, which may or may not be waiting at lights. You could either target the entire impatient behaviour or do something a little more complex by checking if the vehicle is at lights or is waiting behind vehicle which is waiting at lights, and so on...

This opcode could help you not require at least one hack (I don't really "dig" CLEO-hosted memory hacks as much as I used to):
0987: get_car_blocking_car $1867 store_to $VALET_CAR
  • SergeantSavidge likes this

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#243

Posted 06 March 2014 - 08:34 PM

...This opcode could help you not require at least one hack (I don't really "dig" CLEO-hosted memory hacks as much as I used to):

0987: get_car_blocking_car $1867 store_to $VALET_CAR

Thanks a bunch, Deji, this'll work well I think. :)


_DK
  • _DK

    gta3 cleo

  • Feroci Racing
  • Joined: 12 Apr 2009
  • None

#244

Posted 08 March 2014 - 02:25 AM

Shader API now can work with depth buffer texture.
{$CLEO}
{$I stdc}
{$I shaderApi}

var
    0@: shader
end

if
    0@ = shader.Load("CLEO\shader.fx")
then
    while true
        wait 0
        0A8D: 1@ = read_memory 0xC1703C size 4 virtual_protect 0
        1@ += 0x80
        0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0
        0@.SetFloat("nearZ", 2@)
        1@ += 4
        0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0
        0@.SetFloat("farZ", 2@)
        0@.Draw("ShowScreen", SCREEN_BASE_X, SCREEN_BASE_Y, SCREEN_HALF_X, SCREEN_SIZE_Y)
        0@.Draw("ShowDepth", SCREEN_HALF_X, SCREEN_BASE_Y, SCREEN_SIZE_X, SCREEN_SIZE_Y)
    end
else
    0ACD: show_text_highpriority "Error compiling shader.fx" time 5000
    0A93: end_custom_thread
end
Added extra parameters SCREEN_HALF_X, SCREEN_HALF_Y
Shader simply displays screen color and linearized depth of pixel.
texture screen : SCREEN_TEX;
texture depth : DEPTH_TEX;

float farZ;
float nearZ;

sampler2D screenSampler = sampler_state
{
    Texture = <screen>;
};

sampler2D depthSampler = sampler_state
{
    Texture = <depth>;
};

float4 PS_screen(float2 tex: TEXCOORD0): COLOR
{
    return float4(tex2D(screenSampler, tex).rgb, 1);   
}

float4 PS_depth(float2 tex: TEXCOORD0): COLOR
{
    float z = (2.0 * nearZ) / (farZ + nearZ - tex2D(depthSampler, tex).r * (farZ - nearZ)); 
    return float4(z, z, z, 1);    
}

technique ShowScreen
{
    pass P0
    {
        PixelShader  = compile ps_2_0 PS_screen();
    }
}

technique ShowDepth
{
    pass P0
    {
        PixelShader  = compile ps_2_0 PS_depth();
    }
}
k8k0.th.png
  • Silent, LINK/2012, TJGM and 1 other like this

_DK
  • _DK

    gta3 cleo

  • Feroci Racing
  • Joined: 12 Apr 2009
  • None

#245

Posted 10 March 2014 - 01:10 AM Edited by _DK, 10 March 2014 - 01:29 AM.

Do you remember that thing?
When you remove weapon from ped, game gives him another one? Oh shi...

p2g1.th.png
Some addresses for weapon types btw (possibly were found before):
0x5E8C5F [byte] Weapon id for weapon which game gives for a new gang member in player group (default=22)
0x5E8C68 [byte] Same as above, must be patched too (default=22)
  • Concavax likes this

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#246

Posted 17 March 2014 - 05:35 PM

Do you remember that thing?
When you remove weapon from ped, game gives him another one? Oh shi...

 
no, never noticed, will have look in the future
 
---------------------------------------------------------------------------
 
I got a wiered bug last weekend
all painjobs of all cars had ped textures instead the paintjob
anyone ever had the same?
i found out that it was caused by limit adjuster when i activated the [Static Limit] Vehicle Models=212
i did that because the tut for addcars said, we should use and increase this option
meanwhile i know, i don't need limit adjuster and don't need streammemfix or anything else to get addcars working

5yszqgeS.jpg idR8og61.jpg JWHzbWUA.jpg
5Hm9axJE.jpg lHtAwMJH.jpg iQwZC37A.jpg
  • dxivilea likes this

nWo51289
  • nWo51289

    Outcast

  • Feroci Racing
  • Joined: 26 Apr 2008
  • None

#247

Posted 18 March 2014 - 04:57 PM Edited by nWo51289, 18 March 2014 - 04:57 PM.

Urgh, that was one of the reasons why I hated adding vehicles, is it just a bug with SALA or adding vehicles in general?

___________________________________________________

I've suffered with this problem ever since I started modding SA. Yes streaming memory is the culprit but....was wondering if there is something like a txdpool in SA, or is it these below that has something to do with txds? (Below could very well be wrong, I am a Cleo noob!)

0A8C: write memory 0x05DA08E size 4 value 32000 virtual_protect 0 //ENV_MAP_MATERIAL_POOL Data Pool Size default=4096
0A8C: write memory 0x05DA0CA size 4 value 16000 virtual_protect 0 //ENV_MAP_ATOMIC_POOL Data Pool Size default=1024
0A8C: write memory 0x05DA106 size 4 value 32000 virtual_protect 0 //SPEC_MAP_MATERIAL_POOL Data Pool Size default=4096

bbf030315190884.jpg 975bfa315190892.jpg 1b2273315190923.jpg


_DK
  • _DK

    gta3 cleo

  • Feroci Racing
  • Joined: 12 Apr 2009
  • None

#248

Posted 18 March 2014 - 08:11 PM

Patching these addresses in CLEO won't give you any result. The game will create pools before scripts will be launched.

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#249

Posted 24 March 2014 - 09:20 AM

Hi there  :beerhat:. What's going on with III and VC? There're not much coding talk about these games for the past 3 months. Is that mean they're dead? 
Btw what's this:
01D8: unknown_actor 0@ unknown_fire_at_target 4@
I couldn't find any info and when I tried it a few months ago, a strange things happened - non of them interesting.

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci Racing
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#250

Posted 24 March 2014 - 12:07 PM

It's called SET_CHAR_OBJ_DESTROY_OBJECT. I guess it tells the character to shoot it?

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#251

Posted 24 March 2014 - 12:13 PM

Thanks  :^:.


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci Racing
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#252

Posted 21 April 2014 - 09:55 PM

CLEAR!


*Silent gives the topic an electric shock.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#253

Posted 22 April 2014 - 12:20 AM

Maybe I should write one of my really long posts? That always cheers everyone up!
  • Frank.s, ThirteenAG, Silent and 2 others like this

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#254

Posted 22 April 2014 - 01:25 PM

Maybe I should write one of my really long posts? That always cheers everyone up!

Yes! I want to see your CustomPlateFormat being developed further! ;D


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#255

Posted 22 April 2014 - 03:41 PM

Maybe I should write one of my really long posts? That always cheers everyone up!

Yes! I want to see your CustomPlateFormat being developed further! ;D


I am currently focused on a current project and have no information regarding future projects.

[/R* defense]

juarez
  • juarez

    Memory Hacking

  • Members
  • Joined: 11 Jun 2011

#256

Posted 23 April 2014 - 02:38 PM

Hello, Anybody have a good example to use function CAESound::Initialise(0x4EFE50) in gta sa ?


SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#257

Posted 23 April 2014 - 03:36 PM Edited by SergeantSavidge, 23 April 2014 - 03:36 PM.

-

Hey Deji (or if anyone else can help me, please feel free :colgate:), I need your help with something CLEO-related. That traffic CLEO script I posted earlier, the opcode you gave me makes me crash where I pasted it in my script. Is there a specific place to paste the opcode?

P.S. I'm kinda a CLEO n00b as you're probably aware already, lol

0987: get_car_blocking_car $1867 store_to $VALET_CAR

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci Racing
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#258

Posted 23 April 2014 - 03:41 PM

You'd have to show an entire code. One line out of context says nothing.

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#259

Posted 23 April 2014 - 03:50 PM

You'd have to show an entire code. One line out of context says nothing.

OK :)

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 
0A96: 11@ = actor $PLAYER_ACTOR struct

:NONAME_18
wait 0 
0A8D: 0@ = read_memory 12010644 size 4 virtual_protect 0 
0@ += 4 
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 
1@ = 0 

:NONAME_62
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0 
0@ += 1 
if and
  2@ >= 0 
  128 > 2@ 
else_jump @NONAME_485 
005A: 2@ += 1@ // (int) 
0A97: 3@ = car 2@ struct 
3@ += 1192 
0A8D: 4@ = read_memory 3@ size 1 virtual_protect 0 
if 
   not 4@ == 3 
else_jump @NONAME_485 
3@ += 236 
0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0 
if 
   not 4@ >= 2 
else_jump @NONAME_485 
3@ -= 308 
0A8D: 4@ = read_memory 3@ size 4 virtual_protect 0 
if and
  4@ > 0 
803B:   not  11@ == 4@ // (int) 
else_jump @NONAME_485 
if 
8975:   not car 2@ emergency_vehicle 
else_jump @NONAME_485 
0A97: 25@ = car 2@ struct 
0A8E: 30@ = 25@ + 912 // int 
0AC6: 29@ = label @NONAME_515 offset 
28@ = 0 

:NONAME_297
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 
28@ += 1 
  28@ > 37 
else_jump @NONAME_297 
Car.DriveTo(2@, 0.0, 0.0, 0.0)
0A8E: 30@ = 25@ + 912 // int 
0AC6: 29@ = label @NONAME_515 offset 
28@ = 0 

:NONAME_404
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 
28@ += 1 
  28@ > 37 
else_jump @NONAME_404 
0A8E: 30@ = 25@ + 1192 // int 
0A8C: write_memory 30@ size 1 value 3 virtual_protect 0 

:NONAME_485
1@ += 256 
  1@ > 27904 
else_jump @NONAME_62 
jump @NONAME_18 

:NONAME_515
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

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci Racing
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#260

Posted 23 April 2014 - 04:40 PM

Why are you recompiling your own scripts? Unless it's not yours.

What do you need to do with it anyway?

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#261

Posted 23 April 2014 - 05:34 PM

Why are you recompiling your own scripts? Unless it's not yours.

What do you need to do with it anyway?

I'm trying to somehow fit in that Opcode that Deji gave me. This script was madleg's btw, he posted it in a topic I made. I just need to know how to add the Opcode in without it crashing :)


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci Racing
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#262

Posted 23 April 2014 - 05:41 PM

I'm still not sure what's your goal. Quite possible you don't need to do it that way.

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#263

Posted 23 April 2014 - 05:55 PM

I'm still not sure what's your goal. Quite possible you don't need to do it that way.

Is there another way I could do this then? You know CLEO better than I do ;)


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#264

Posted 23 April 2014 - 06:03 PM

-

Hey Deji (or if anyone else can help me, please feel free :colgate:), I need your help with something CLEO-related. That traffic CLEO script I posted earlier, the opcode you gave me makes me crash where I pasted it in my script. Is there a specific place to paste the opcode?
P.S. I'm kinda a CLEO n00b as you're probably aware already, lol
0987: get_car_blocking_car $1867 store_to $VALET_CAR


Read the opcode database entry: http://gtag.gtagamin...se/opcode/0987/

If carA is driving to a set destination, this opcode will return carB, if it is preventing carA from getting to it's destination.


That means, if you command a vehicle to drive to a spot with:
00A7: car_goto_coordinates 99@ coors 252@ 253@ 254@
(or similar)

then, passing 99@ to 0987 will return the handle of any vehicle that is currently obstructing 99@ from getting to its destination. If there is none, it returns -1 as is the standard sign of an invalid handle in GTA scripting.
  • SergeantSavidge likes this

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#265

Posted 23 April 2014 - 06:10 PM

00A7: car_goto_coordinates 99@ coors 252@ 253@ 254@

This all sounds very good, Deji, but I don't really know much about CLEO, so sorry if what I'm about to say is really obvious, lol.

That "00A7" thing you mentioned, I don't have that in the script I'm editing. I have this one, which sorta sounds similar:

Car.DriveTo(2@, 0.0, 0.0, 0.0)
0A8E: 30@ = 25@ + 912 // int 
0AC6: 29@ = label @NONAME_507 offset 
28@ = 0

Do I need to make a new script seperately for the Opcode (like DK did with NewOpcodes)? Again, sorry for asking these questions, I'm a n00b at CLEO stuff  :dontgetit: 


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#266

Posted 23 April 2014 - 06:14 PM

This all sounds very good, Deji, but I don't really know much about CLEO, so sorry if what I'm about to say is really obvious, lol.
That "00A7" thing you mentioned, I don't have that in the script I'm editing. I have this one, which sorta sounds similar:

Car.DriveTo(2@, 0.0, 0.0, 0.0)
0A8E: 30@ = 25@ + 912 // int 
0AC6: 29@ = label @NONAME_507 offset 
28@ = 0
Do I need to make a new script seperately for the Opcode (like DK did with NewOpcodes)? Again, sorry for asking these questions, I'm a n00b at CLEO stuff  :dontgetit:


They're actually the same. I don't recommend using the "Class.Method" syntax though, because it's incomplete and wrong in many places.

What is the use in the memory hacks? If you don't understand CLEO, then basing your script off something so complex isn't going to be easy for you. And if the vehicle is controlled using memory hacks, then you're only going to have to use more memory hacks to actually get what you want out of it.

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#267

Posted 23 April 2014 - 06:26 PM

They're actually the same. I don't recommend using the "Class.Method" syntax though, because it's incomplete and wrong in many places.


What is the use in the memory hacks? If you don't understand CLEO, then basing your script off something so complex isn't going to be easy for you. And if the vehicle is controlled using memory hacks, then you're only going to have to use more memory hacks to actually get what you want out of it.

Actually, I got the script off a guy called "madleg". I could never make a script like that on my own, lol. So, does the Opcode go in that "Car.DriveTo" bit?


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#268

Posted 23 April 2014 - 06:54 PM

They're actually the same. I don't recommend using the "Class.Method" syntax though, because it's incomplete and wrong in many places.

What is the use in the memory hacks? If you don't understand CLEO, then basing your script off something so complex isn't going to be easy for you. And if the vehicle is controlled using memory hacks, then you're only going to have to use more memory hacks to actually get what you want out of it.

Actually, I got the script off a guy called "madleg". I could never make a script like that on my own, lol. So, does the Opcode go in that "Car.DriveTo" bit?


In it? No. You loop it while the vehicle is driving (after that "Car.DriveTo" - but not literally - it needs to be in its own sub-loop) and check it hasn't returned -1, then do whatever you want to happen when the vehicle is being blocked.

But what does the script do? It's very hard to determine whether it will work at all in your situation.

SergeantSavidge
  • SergeantSavidge

    That is good. Do job right.

  • Members
  • Joined: 29 Dec 2013
  • England

#269

Posted 23 April 2014 - 07:10 PM

In it? No. You loop it while the vehicle is driving (after that "Car.DriveTo" - but not literally - it needs to be in its own sub-loop) and check it hasn't returned -1, then do whatever you want to happen when the vehicle is being blocked.


But what does the script do? It's very hard to determine whether it will work at all in your situation.

OK, thanks for your help, Deji. You're a CLEO genius. The script makes the vehicle AI like the police vehicles' one (i.e. not going 200mph everywhere and stopping instantly). And the bit that you're telling me how to do now is the bit when the car stops at a red light, but I don't want drivers in a queue to get impatient when waiting. :)


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#270

Posted 23 April 2014 - 07:21 PM

OK, thanks for your help, Deji. You're a CLEO genius. The script makes the vehicle AI like the police vehicles' one (i.e. not going 200mph everywhere and stopping instantly). And the bit that you're telling me how to do now is the bit when the car stops at a red light, but I don't want drivers in a queue to get impatient when waiting. :)


Then, in fact, you'd need to change their driver AI specifically not to get impatient. This happens with cops anyway (they're the least patient drivers in SA, thinking they're above the law) - but you could try this:
http://gtag.gtagamin...se/opcode/00AE/

However, as I said, this is working with memory hacks and that "Car.DriveTo" doesn't make sense on its own. It may be writing memory to change the driving style anyway, in which case 00AE won't take effect or may undo the effects by the rest of the mod. Also, the ID's of driving styles aren't well documented at all, so good luck :p
  • SergeantSavidge likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users