Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

aryaryan

custom gang models are not working

Recommended Posts

aryaryan
9 hours ago, OrionSR said:

but you've added stuff that wasn't specified and made changes to the zones and models. Don't overthink it.

so... what you're saying is I'll be able to change the ped/gang models without adding these lines? or a simpler way?

I'm confused

Share this post


Link to post
Share on other sites
OrionSR
1 hour ago, aryaryan said:

I'm confused

Me too. I'm getting very strange results in my reworked script. So strange that I don't trust my results, so I'll be running a lot of tests today to see if I can figure out what going on. At this point I wouldn't be surprised if your script didn't work right even if you got the logic flow and addressing ironed out - very strange.

Share this post


Link to post
Share on other sites
aryaryan
23 minutes ago, OrionSR said:

Me too. I'm getting very strange results in my reworked script. So strange that I don't trust my results, so I'll be running a lot of tests today to see if I can figure out what going on. At this point I wouldn't be surprised if your script didn't work right even if you got the logic flow and addressing ironed out - very strange.

we should both take a break at this point 🤣

Share this post


Link to post
Share on other sites
OrionSR
1 hour ago, aryaryan said:

we should both take a break at this point 🤣

Not a chance; I'm not stopping. It's just now getting interesting from my perspective. I just needed a chance to sleep and clear my mind of preconceptions so I can make a fresh attack on the mystery. Check in a little later and I might have a test script ready to highlight the weirdness. 

 

Weapon management has been improved; I found a way to save and restore the current weapon configuration of the specified gang.

 

Your strategy of loading the models seems to be helping. It isn't necessary for the modified gang ped models to spawn but it speeds up the process; several models start spawning right away rather than waiting for a while for one model to start spawning, and after a while maybe another.

 

 

Share this post


Link to post
Share on other sites
aryaryan

I made it crash (way) less and the models work but I'm not touching the custom cars for now,

also i don't know if the way i "fixed" is the proper way but it's getting better at least

Share this post


Link to post
Share on other sites
OrionSR
Posted (edited)
4 hours ago, aryaryan said:

I made it crash (way) less

Whoops, I thought you were taking a break or I would have posted an update. 

I have traced one source of crashing to increasing the number of peds in the group. The problem occurs when CJ leaves the modified zones and the default models are reset. To be specific, when 5 models were applied to the group of 3 Ballas then the first two models become corrupt during the reset. Sometimes the models returned to the modified setting, other times the "empty" value of 2000 is applied, and another time the value was simply zero. I am confident that my write values are correct; it seems like something else is modifying these values after my write operations.

Adding and resetting an additional gang vehicle seems to be working, but I'm still getting unexplained crashes. A little later today I'm going to build a memory spy script to display the model values as I play so I can track the changes as they occur.

 

Notes: I have default models and group configurations. I won't be testing added models. Your results may vary if you don't have default groups. All gangs have 3 ped models, except the Mafia which has 4.  All groups have 3 cars except Ballas have 2 and the unused gangs have 1. Default groups from pedgrp.dat and cargrp.dat are included in the spoilers below. I'm not yet sure if there is something special about having 3 ped models or if 4 would work properly for Mafia. During my tests with Ballas only the last 3 ped models spawned in groups.

 

I'll add the groups later; the forum is a bit laggy at the moment.

Spoiler
BALLAS1, BALLAS2, BALLAS3					# Gang 1 (BALLAS - Rival Black Gang - AKA FLATS)

FAM1, FAM2, FAM3							# Gang 2 (THE FAMILIES - PLAYER GANG - AKA GROVE)

LSV1, LSV2, LSV3							# Gang 3 ( Los Santos Vagos - AKA Northside Mexicans)

SFR1, SFR2, SFR3							# Gang 4  (San Fiero Rifa - proper models: SFR1, SFR2, SFR3)

DNB1, DNB2, DNB3							# Gang 5 (Da Nang Boys  - AKA Vietnamese)

VMAFF1, VMAFF2, VMAFF3, VMAFF4				# Gang 6 (ITALIAN MAFIA)

TRIADA, TRIADB, TRIBOSS						# Gang 7 (TRIADS)
 
VLA1, VLA2, VLA3   							# Gang 8  (Varrio Los Aztecas - AKA SOUTH SIDE MEXICAN)

VLA1, VLA2, VLA3						    # Gang 9  (UNUSED)

VLA1, VLA2, VLA3						    # Gang 10  (UNUSED)

 

Spoiler
majestic, tahoma 		 											 # Gang 1 (BALLAS - BLACK)
greenwoo, savanna, voodoo											 # Gang 2 (FAMILIES - PLAYER - BLACK)
oceanic, tornado, hermes  						 	 		 		 # Gang 3 (LSV - MEX)
sabre, stallion, blade						   					 	 # Gang 4 (SFR - MEX) 
buccanee, manana, tampa 					 	     				 # Gang 5 (DNB - VIETS)
sentinel, admiral, feltzer 					 						 # Gang 6 (ITALIAN MAFIA)
sultan, stratum, elegy												 # Gang 7 (TRIAD)
hermes, broadway, glendale 											 # Gang 8 (VLA - MEX)
sentinel                                                             # Gang 9 (UNUSED)
sentinel                                                             # Gang 10 (UNUSED)

 

 

Edited by OrionSR
  • Like 1

Share this post


Link to post
Share on other sites
OrionSR
Posted (edited)

I'm having issues with my computer so I'll post what I've got and update comments using another PC.


GroupSpy - A cleo script that displays the first 6 ped model IDs and 3 car IDs of the specified gang.

Spoiler

 

{$CLEO .cs}  // GTA SA SCR
//GroupSpy.txt

03A4: name_thread 'grpspy' 
0001: wait 5000

0006: [email protected] = 0    // gang_ID = Ballas
0006: [email protected] = 100  // wait_time

// CALCULATE ADDRESSES
0085: [email protected] = [email protected]        // pedgrp_address = Gang ID
0012: [email protected] *= 42       // * size of pedgrp record
000A: [email protected] += 0xC0F358 // + start of ped groups 
000A: [email protected] += 1764     // + offset to gang ped groups

0085: [email protected] = [email protected]        // cargrp_address = Gang ID
0012: [email protected] *= 46       // * size of cargrp record
000A: [email protected] += 0xC0ED38 // + start of car groups 
000A: [email protected] += 828      // + offset to gang car groups


:grpspy_top
0001: wait [email protected]
0085: [email protected] = [email protected]  // temp_address = pedgrp_address
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 

0085: [email protected] = [email protected]  // temp_address = cargrp_address
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 


0ADB: get_name_of_vehicle_model [email protected] store_to [email protected] 
0ADB: get_name_of_vehicle_model [email protected] store_to [email protected] 
0ADB: get_name_of_vehicle_model [email protected] store_to [email protected] 


0AD1: print_formatted_now "Peds: %4d %4d %4d %4d %4d %4d~n~Cars: %4d=%s %4d=%s %4d=%s" time [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
0002: jump @grpspy_top

 

 

 

 

GlenFud - Changes the Ballas models of Glen Park to food service workers and vehicles.

Spoiler
{$CLEO .cs}  // GTA SA SCR
// GlenFud.txt
// Changes models and weapons of the specified gang when the player is in the specified zones.
// Resets the models and weapons when the player no longer in a specified zone. 

03A4: name_thread 'GLENFUD' 
0001: wait 5000 ms   // change to 0 if the script doesn't crash

// Modify as needed [0..9]
0006: [email protected] = 0  // gang_ID = Ballas

// Modify as needed
0006: [email protected] = 32 // gang_weapon_1 // Tec9
0006: [email protected] = 29 // gang_weapon_2 // MP5
0006: [email protected] = 4  // gang_weapon_3 // Knife

// Modify as needed
0006: [email protected] = #WMOICE   // model_1
0006: [email protected] = #WMYPIZZ  // model_2
0006: [email protected] = #BMOCHIL  // model_3
0006: [email protected] = #WMYBELL  // model_4
0006: [email protected] = #WFYBURG  // model_5
0006: [email protected] = 2000 // model_6
0006: [email protected] = #MRWHOOP  // model_7
0006: [email protected] = #PIZZABOY // model_8
0006: [email protected] = #HOTDOG   // model_9

// VARIABLE TABLE (for reference)
0006: [email protected] = 0  // pedgrp_address 0xC0F358
0006: [email protected] = 0  // cargrp_address 0xC0ED38
0006: [email protected] = 0  // gangInfo_address 0xC091F0
0006: [email protected] = 0  // zone_is_modified 
0006: [email protected] = 0  // temp_address
0006: [email protected] = 0
0006: [email protected] = 0  // saved_weapon_1       
0006: [email protected] = 0  // saved_weapon_2 
0006: [email protected] = 0  // saved_weapon_3 

0006: [email protected] = 2000 // saved_model_1
0006: [email protected] = 2000 // saved_model_2
0006: [email protected] = 2000 // saved_model_3
0006: [email protected] = 2000 // saved_model_4
0006: [email protected] = 2000 // saved_model_5
0006: [email protected] = 2000 // saved_model_6
0006: [email protected] = 2000 // saved_model_7
0006: [email protected] = 2000 // saved_model_8
0006: [email protected] = 2000 // saved_model_9
 
// CALCULATE ADDRESSES (don't modify)
0085: [email protected] = [email protected]        // pedgrp_address = Gang ID
0012: [email protected] *= 42       // * size of pedgrp record
000A: [email protected] += 0xC0F358 // + start of ped groups 
000A: [email protected] += 1764     // + offset to gang ped groups

0085: [email protected] = [email protected]        // cargrp_address = Gang ID
0012: [email protected] *= 46       // * size of cargrp record
000A: [email protected] += 0xC0ED38 // + start of car groups 
000A: [email protected] += 828      // + offset to gang car groups

0085: [email protected] = [email protected]        // gangInfo_address = Gang ID
0012: [email protected] *= 16       // * size of gangInfo record
000A: [email protected] += 0xC091F0 // + start of gangInfo 
000A: [email protected] += 4        // + offset to gang weapons

// Save Initial Models
0085: [email protected] = [email protected]  // temp_address = pedgrp_address
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 

0085: [email protected] = [email protected]  // temp_address = cargrp_address
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 
000A: [email protected] += 2 
0A8D: read_memory [email protected] size 2 vp 0 store_to [email protected] 


:GLENFUD_Top
0001: wait 100 ms 
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @GLENFUD_Top

// Modify zones as needed (max 8 or 9)
00D6: if or
0583:   player $PLAYER_CHAR in_zone 'GLN1' 
0583:   player $PLAYER_CHAR in_zone 'GLN1b' 
0583:   player $PLAYER_CHAR in_zone 'GLN2a' 
004D: jump_if_false @GLENFUD_Reset_Check

00D6: if 
0039:   [email protected] == 0  // zone is not modified
004D: jump_if_false @GLENFUD_Top

// Speed up model loading
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
//0247: load_model [email protected]
//0247: load_model [email protected]
//0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
038B: load_requested_models

// Set Ped Groups
0085: [email protected] = [email protected]  // temp_address = pedgrp_address
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000E: [email protected] += 2
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000E: [email protected] += 2
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000A: [email protected] += 2 
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 

// Set Car Groups
0085: [email protected] = [email protected]  // temp_address = cargrp_address
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 

// Set Gang Weapons
0085: [email protected] = [email protected]  // temp_address = gangInfo_address
0A8D: read_memory [email protected] size 4 vp 0 store_to [email protected] 
000A: [email protected] += 4 
0A8D: read_memory [email protected] size 4 vp 0 store_to [email protected] 
000A: [email protected] += 4 
0A8D: read_memory [email protected] size 4 vp 0 store_to [email protected] 
0237: set_gang [email protected] weapons_to [email protected] [email protected] [email protected]
  
0006: [email protected] = 1   //flag zone_is_modified
0002: jump @GLENFUD_Top 

:GLENFUD_Reset_Check
00D6: if 
0039:   [email protected] == 1 // zone_is_modified
004D: jump_if_false @GLENFUD_Top

// Reset models and weapons
0085: [email protected] = [email protected]  // temp_address = pedgrp_address
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000E: [email protected] += 2
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000E: [email protected] += 2
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
//000E: [email protected] += 2
//0A8C: write_memory [email protected] size 2 val [email protected] vp 0 

0085: [email protected] = [email protected]  // temp_address = cargrp_address
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
000A: [email protected] += 2 
0A8C: write_memory [email protected] size 2 val [email protected] vp 0 
{
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
0247: load_model [email protected]
038B: load_requested_models
}
0249: mark_model_as_no_longer_needed [email protected]
0249: mark_model_as_no_longer_needed [email protected]
0249: mark_model_as_no_longer_needed [email protected]
//0249: mark_model_as_no_longer_needed [email protected]
//0249: mark_model_as_no_longer_needed [email protected]
//0249: mark_model_as_no_longer_needed [email protected]
0249: mark_model_as_no_longer_needed [email protected]
0249: mark_model_as_no_longer_needed [email protected]
0249: mark_model_as_no_longer_needed [email protected]

0237: set_gang [email protected] weapons_to [email protected] [email protected] [email protected]

0006: [email protected] = 0 
0002: jump @GLENFUD_Top 

 

Work in Progress...

Edited by OrionSR
  • Like 1

Share this post


Link to post
Share on other sites
aryaryan

also is there a list of gang offsets?

Share this post


Link to post
Share on other sites
OrionSR
Posted (edited)
6 hours ago, aryaryan said:

is there a list of gang offsets?

No. This is by design. You were having a lot of trouble working with memory addresses so these scripts were designed to calculate addresses and gang offsets based on the gang ID (variable [email protected] in both scripts). Modify the gang ID, leave all the hard coded calculations alone, and let the computer do all the math for you. (Actually, I don't have problems with the math but I write my scripts this way anyway because it's more efficient in the long run and makes the script easier to adapt to other purposes.) If I find some time this afternoon I'll update the GroupSpy script to allow changing the gang ID with key presses so you won't have to recompile to make it work for another gang. 

 

The GlenFud script ended up being much longer than I intended as I bulletproofed to isolate the issues with corrupt ped models. A primary goal was to simplify the script by limiting how many labels were used. The script you started with had a lot of unnecessary jumps to labels that weren't really needed; probably an artifact of a high level construct used in the original script. GlenFud only has 2 destination labels; execution can only jump to the Top of the main loop, jump to the Reset Check, or continue in line if the IF condition is true.

Tips on Editing GlenFud for other Gangs and Zones:

Almost everything you need to modify is right at the top of the script (before the VARIABLE TABLE). Change the script name, gang ID, weapon IDs, and ped and car models as needed. Scroll down to the Top of the main loop to edit the zone names that apply. You may want to adjust how many models are written, loaded or reset; notice the use of comments to limit the ped models to only 3 - a setting that seems to be working properly; I had issues with 5 peds.

The variable table is included as reference and could be removed, but the comments describe the purpose of the variables which should make the script easier to understand. I might update the script to use constants, which should improve the readability of the script, but I didn't want to do anything too weird at this stage.

 

Don't mess with the calculations until you know for sure how they work. Notice that I copied this section without modification to the GroupSpy script.

 

Edited by OrionSR

Share this post


Link to post
Share on other sites
aryaryan

I just want to know what is the gang offset of other gangs, I wasn't talking about your script

Share this post


Link to post
Share on other sites
OrionSR
2 hours ago, aryaryan said:

I just want to know what is the gang offset of other gangs, I wasn't talking about your script

No, I don't have a list of gang offsets because I always let the game calculate these values. 

Share this post


Link to post
Share on other sites
aryaryan

i don't think it does it for me

Share this post


Link to post
Share on other sites
OrionSR
On 3/27/2020 at 12:27 AM, aryaryan said:

i don't think it does it for me

Yeah, I noticed. That's why I offered multiple examples of how to calculate offsets based on the gang ID. You are welcome to incorporate those parts of the scripts I posted into your script or switch over and start adapting the entire script to your purpose. Let me know if you need more local variables back. I can update the stuff designed to be edited by using constants, which should make the script easier to read and understand and free up a lot of local variables for other uses.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
aryaryan

can you show me a example of the const part

Share this post


Link to post
Share on other sites
OrionSR
Posted (edited)

I finally figured out the problem with my script, and it traces back to your original script. This error has propagated to all subsequent scripts.

On 3/16/2020 at 3:49 AM, aryaryan said:

000E: 0@ += 2

000E: is used for subtraction. 000A: should be used to add an integer to a local variable. When the opcodes are shown, Sanny will ignore the descriptor text (in this case, +=) and only pays attention to the parameters. If the opcode was omitted Sanny would have figured out the right opcode based on the context of a local variable, "+=" and the integer value.

With these errors fixed my script is finally working with more than 3 peds, although it looks like the game will always select only 3 peds to spawn in groups.

In addition to fixing the mixed up opcode, this version of the script has been updated to use constants to hold values that don't change (constants) and to name local variables to make the script easier to read. Constants are a function of Sanny Builder. Sanny will replace the constant's name with the value listed during compilation. Compiling and decompiling the script might help clarify what actually gets compiled.

Note: Sanny Builder has recently been updated with a constants.txt feature, a list of standard constants you can use instead of defining them for each script. Unfortunately, the standard list is quite limited, so I've been developing a list of San Andreas Constants in a Google Sheet [WIP].

Finally, since your first script included opcodes that required the original argument order that had to be compiled with the GTA SA SCR edit mode, I updated more of the script to use SCR style opcodes. To be more specific, I'm using fastman92's Script Command Definitions for SA x86. The opcode text might look a little different but they work the same way.

GlenFud - Food service workers replace Ballas in Glen Parks.
 

Spoiler

 

{$CLEO .cs}  
// GlenFud.txt
// Edit Mode: fastman92 SA x86, or GTA SA SCR (Rockstar arguement order for the read memory command)

// Changes models and weapons of the specified gang when the player is in the specified zones.
// Resets the models and weapons when the player is no longer in a specified zone. 

CONST
// lower_case used to name local variables
// Proper_Case Used For Values

gang_id = 0@
pedgrp_address = 1@
cargrp_address = 2@
gangInfo_address = 3@
zone_is_modified = 4@ 
temp_address = 5@

saved_weapon_1 = 7@
saved_weapon_2 = 8@
saved_weapon_3 = 9@

saved_ped_1 = 11@
saved_ped_2 = 12@
saved_ped_3 = 13@
saved_ped_4 = 14@
saved_ped_5 = 15@
saved_ped_6 = 16@
saved_ped_7 = 17@
saved_ped_8 = 18@
saved_ped_9 = 19@

saved_car_1 = 21@
saved_car_2 = 22@
saved_car_3 = 23@
saved_car_4 = 24@
saved_car_5 = 25@
saved_car_6 = 26@
saved_car_7 = 27@
saved_car_8 = 28@
saved_car_9 = 29@

Ped_Group_Size = 42 // 21 words
Ped_Group_Start = 0xC0F358
Offset_To_Gang_Peds = 1764
Car_Group_Size = 46 // 23 words
Car_Group_Start = 0xC0ED38
Offset_To_Gang_Cars = 828
GangInfo_Size = 16 // 4 dwords
GangInfo_Start = 0xC091F0
Offset_To_Gang_Weapons = 4

Default_Wait_Time = 100

// More constants at https://docs.google.com/spreadsheets/d/1XWXwKy6PVCHFKGvEdaLiy6-lSWghTVhGVoZk4R2Xzxw/edit#gid=1735901413
Weapon_Unarmed=0
Weapon_Knifecur=4
Weapon_Bat=5
Weapon_Katana=8
Weapon_Colt45=22
Weapon_Silenced=23
Weapon_Desert_Eagle=24
Weapon_Chromegun=25
Weapon_Sawnoff=26
Weapon_Shotgspa=27
Weapon_Micro_Uzi=28
Weapon_Mp5Lng=29
Weapon_Ak47=30
Weapon_M4=31
Weapon_Tec9=32

Gang_Ballas=0
Gang_Grove=1
Gang_Vagos=2
Gang_Rifa=3
Gang_DaNang=4
Gang_Mafia=5
Gang_Triad=6
Gang_Aztecas=7
Gang_Gang9=8
Gang_Gang10=9

// Modify as needed
Ped1 = #WMYBELL
Ped2 = #WFYBURG
Ped3 = #OMONOOD
Ped4 = #WMOICE
Ped5 = #WMYPIZZ
Ped6 = #BMOCHIL
Car1 = #MRWHOOP
Car2 = #PIZZABOY
Car3 = #HOTDOG

// Modify as needed
Weapon_1 = Weapon_Mp5Lng
Weapon_2 = Weapon_Tec9
Weapon_3 = Weapon_Knifecur

// Modify as needed
Zone_1 = 'GLN1'
Zone_2 = 'GLN1b'
Zone_3 = 'GLN2a'
END

// --------- Main ---------
03A4: script_name 'GLENFUD' 
0001: wait 3000 ms

// Modify as needed
0006: gang_id = Gang_Ballas
 
// CALCULATE ADDRESSES
0085: pedgrp_address = gang_id
0012: pedgrp_address *= Ped_Group_Size
000A: pedgrp_address += Ped_Group_Start 
000A: pedgrp_address += Offset_To_Gang_Peds

0085: cargrp_address = gang_id
0012: cargrp_address *= Car_Group_Size
000A: cargrp_address += Car_Group_Start
000A: cargrp_address += Offset_To_Gang_Cars

0085: gangInfo_address = gang_id
0012: gangInfo_address *= GangInfo_Size
000A: gangInfo_address += GangInfo_Start 
000A: gangInfo_address += Offset_To_Gang_Weapons

// Save Initial Models
0085: temp_address = pedgrp_address
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_1 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_2 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_3 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_4 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_5 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_ped_6 

0085: temp_address = cargrp_address
0A8D: read_memory temp_address size 2 vp 0 store_to saved_car_1 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_car_2 
000A: temp_address += 2 
0A8D: read_memory temp_address size 2 vp 0 store_to saved_car_3 


:GLENFUD_Top
0001: wait Default_Wait_Time ms
00D6: if 
0256:   is_player_playing $PLAYER_CHAR 
004D: goto_if_false @GLENFUD_Top

// Modify as needed (max 8)
00D6: if or
0583:   is_player_in_info_zone $PLAYER_CHAR zone Zone_1 
0583:   is_player_in_info_zone $PLAYER_CHAR zone Zone_2 
0583:   is_player_in_info_zone $PLAYER_CHAR zone Zone_3 
004D: goto_if_false @GLENFUD_Reset_Check

00D6: if 
0039:   zone_is_modified == False 
004D: goto_if_false @GLENFUD_Top

// Set Ped Groups
0085: temp_address = pedgrp_address
0A8C: write_memory temp_address size 2 val Ped1 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val Ped2 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val Ped3 vp 0 
000A: temp_address += 2
0A8C: write_memory temp_address size 2 val Ped4 vp 0 
000A: temp_address += 2
0A8C: write_memory temp_address size 2 val Ped5 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val Ped6 vp 0 

// Set Car Groups
0085: temp_address = cargrp_address
0A8C: write_memory temp_address size 2 val Car1 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val Car2 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val Car3 vp 0 

// Set Gang Weapons
0085: temp_address = gangInfo_address 
0A8D: read_memory temp_address size 4 vp 0 store_to saved_weapon_1   
000A: temp_address += 4 
0A8D: read_memory temp_address size 4 vp 0 store_to saved_weapon_2 
000A: temp_address += 4 
0A8D: read_memory temp_address size 4 vp 0 store_to saved_weapon_3 
0237: set_gang_weapons gang_id to Weapon_1 Weapon_2 Weapon_3

// Speed up model loading
0247: request_model Ped1
0247: request_model Ped2
0247: request_model Ped3
0247: request_model Ped4
0247: request_model Ped5
0247: request_model Ped6
0247: request_model Car1
0247: request_model Car2
0247: request_model Car3
038B: load_all_models_now

0006: zone_is_modified = True
0002: goto @GLENFUD_Top 

:GLENFUD_Reset_Check
00D6: if 
0039:   zone_is_modified == True
004D: goto_if_false @GLENFUD_Top

// Reset models and weapons
0085: temp_address = pedgrp_address
0A8C: write_memory temp_address size 2 val saved_ped_1 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val saved_ped_2 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val saved_ped_3 vp 0 
000A: temp_address += 2
0A8C: write_memory temp_address size 2 val saved_ped_4 vp 0 
000A: temp_address += 2
0A8C: write_memory temp_address size 2 val saved_ped_5 vp 0 
000A: temp_address += 2
0A8C: write_memory temp_address size 2 val saved_ped_6 vp 0 

0085: temp_address = cargrp_address
0A8C: write_memory temp_address size 2 val saved_car_1 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val saved_car_2 vp 0 
000A: temp_address += 2 
0A8C: write_memory temp_address size 2 val saved_car_3 vp 0 

0249: mark_model_as_no_longer_needed Ped1
0249: mark_model_as_no_longer_needed Ped2
0249: mark_model_as_no_longer_needed Ped3
0249: mark_model_as_no_longer_needed Ped4
0249: mark_model_as_no_longer_needed Ped5
0249: mark_model_as_no_longer_needed Ped6
0249: mark_model_as_no_longer_needed Car1
0249: mark_model_as_no_longer_needed Car2
0249: mark_model_as_no_longer_needed Car3

0247: request_model saved_car_1
0247: request_model saved_car_2
038B: load_all_models_now

0237: set_gang_weapons gang_id to saved_weapon_1 saved_weapon_2 saved_weapon_3

0006: zone_is_modified = False 
0002: goto @GLENFUD_Top 

 

 

 

 

Edited by OrionSR
  • Like 1

Share this post


Link to post
Share on other sites
aryaryan

i found a strange bug in my mod where when i launch the rocket launcher it crashes my game

Share this post


Link to post
Share on other sites
aryaryan

@OrionSR so... do you know anything about recovering files on windows? just asking because my peds.txt got corrupted and now it's just showing a bunch of NULL

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.