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. The Cayo Perico Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. 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

      1. St. Andrews Cathedral
    2. GTA VI

    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
    1. Announcements

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

[MoonLoader] AutoID


HzanRsxa2959

Recommended Posts

HzanRsxa2959
Just now, fastman92 said:

Remember to leave the task of finding the free weapon ID up to the FLA:

Is it compatible with saves?

Link to post
Share on other sites
Just now, HzanRsxa2959 said:

Is it compatible with saves?

No. It only finds a free ID while loading a file, that's all.

Is AutoID somehow compatible with saves?

Link to post
Share on other sites
HzanRsxa2959
2 minutes ago, fastman92 said:

Is AutoID somehow compatible with saves?

Yeah, that's actually one big feature of AutoID: compatibility with saves.

Seriously, CLEO+ is a blessing. Using it, before the game saves (on the SAVE_CONFIRMATION event), I remove the weapon from the player, and then give it back after, and whenever the player loads that game. It's working well so far.

Link to post
Share on other sites
HzanRsxa2959

Adapted Mods:

  • Cheat-Menu LUA 2.2 Portable: Fixed it not detecting the latest version of AutoID.
Link to post
Share on other sites
HzanRsxa2959

Adapted Mods:

  • Cheat-Menu LUA 2.2 Portable: Fixed it detecting AutoID even when AutoID was not installed.

Sorry for such frequent updates. The issue has finally been resolved.

Link to post
Share on other sites

For information. 

 

"Count of killable model IDs" é alterada para metade do limite de ID do modelo (modificável por "FILE_TYPE_DFF", mas requer que o FLA seja instalado fora do Mod Loader)."

 

This limit takes the following amount of memory:

(Count of killable IDs * 2 * 2) bytes

 

by default: 800 * 2 * 2 = 3600 bytes. 

 

This limit takes a very little memory. 

Edited by fastman92
Link to post
Share on other sites
HzanRsxa2959

Let's see:

Quote

Default Game without AutoID: 3.6kB (800).

Default Game: 40kB (10000).

SAxVCxLC: 60kB (15000).

GTA Underground (theoretically; I'm not sure AutoID works there): 120kB (30000).

@fastman92 I don't understand. Is it too much? Should I decrease it? Maybe one-fourth instead of half? Or maybe leave it up to the mod-makers to change it when necessary (they can put the setting in their mods, after all)?

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

Let's see:

@fastman92 I don't understand. Is it too much? Should I decrease it? Maybe one-fourth instead of half? Or maybe leave it up to the mod-makers to change it when necessary (they can put the setting in their mods, after all)?

No. I have posted it just for information. Whether 4 bytes of memory per killable ID is too much or not, this is for you to decide and possibly do some implementation changes knowing this. 

Edited by fastman92
  • Like 1
Link to post
Share on other sites
  • 2 weeks later...
HzanRsxa2959
Posted (edited)

Update 2.1.5:

1. Added support for FLA Vehicle Audio Settings (requires initialization and will copy file gtasa_VehicleAudioSettings.cfg to AutoID directory while modifying the original file; use the section "FLS:"). I initially didn't implement it because I thought that Mod Loader already handled it, but it turns out that this is not the case, and is still a consideration: https://github.com/thelink2012/modloader/issues/53.
2. Replaced many operations and functions (related mainly to loops, tables and strings), resulting in a performance boost. (Not much with a thousand files or less, but it was noticeable with 10000 or more).
3. Now, if run out of regular free model IDs (objects, weapons etc.), then AutoID will use killable free model IDs (peds, vehicles) for regular models instead if there are any left. (As such, it actually makes sense to set the killable model ID limit to half the model ID limit, as no free ID will be wasted.)
4. Marked IDs 15000-15024 as occupied for better compatibility with command GET_MODEL_DOESNT_EXIST_IN_RANGE from CLEO+.
5. It was available from 2.1 but I forgot to tell: Now, for the first time in the history of GTA SA mods, it is possible to get the name (dff name) of a model from its ID (model ID)! In addition to: ID (model ID) to TXD (txd name), Name (dff name) to TXD (txd name), and many more; even sections dedicated to types!
    For example, suppose you want to get the dff name of model 346:

{$CLEO .cs}
{$USE INI}

0AC8: [email protected] = allocate_memory_size 255
if 0AF4: [email protected] = read_string_from_ini_file "AutoID\\AllModels.ini" section "IDsToNames" key "346"
then
	while true
		0AD1: show_formatted_text_highpriority "%s" time 0 [email protected]

		wait 0
	end
else
	0AC9: free_allocated_memory [email protected]

	0A93: terminate_this_custom_script
end

    It will display "colt45" by default.
    For weapon icons, prefer getting the TXD name (IDsToTXDsType4).

    After installing AutoID and launching the game once, go to game directory\AutoID.
    See that big, phat, multi-MB file named "AllModels.ini"? Open it and see its contents. Know how to handle ini files, and you can use it easily.
    As for the typed sections, they correspond to the enum "ModelInfoType" at here: https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CBaseModelInfo.h.
    E.g., if you want to access the list of only weapon models, use the section(s) ending with "Type4".
    The sections starting with "IndexesTo" are for iterating through SCM:

{$CLEO .cs}
{$USE CLEO+}
{$USE INI}

const
	list = [email protected]
	max = [email protected]
	s = [email protected]
	i = [email protected]
	id = [email protected]
	name = [email protected]
end

0E72: create_list 0 store_to list

0AF0: max = read_int_from_ini_file "AutoID\\AllModels.ini" section "IndexesToIDsType7" key "max"
if max > 0
then
	0AC8: s = allocate_memory_size 255

	for i = 1 to max
		0AD3: s = string_format "%d" i
		if 0AF0: id = read_int_from_ini_file "AutoID\\AllModels.ini" section "IndexesToIDsType7" key s
		then
			0AD3: s = string_format "%d" id
			if 0AF4: s = read_string_from_ini_file "AutoID\\AllModels.ini" section "IndexesToIDsType7" key s
			then
				0AC8: name = allocate_memory_size 255

				0D4D: copy_string s to name
				0E74: list_add list value name
			end
		end
	end

while true
	wait 0
end

0A93: terminate_this_custom_script

    This code iterates through the list of all the peds models currently defined in the game, and stores them in a CLEO+ list.
    It will probably kill performance, though; prefer to use a faster language instead. LuaJIT is fast enough in my experience- especially the "inicfg" libary built into MoonLoader.
        If using a fast language, e.g. Lua, then read the ini file inside the main() function (after game loads), preferably after a delay like wait(100). As in AutoSpawn:

local models -- make this variable local TO this script, but global IN this script, for it to be accessible in all functions

function main()
	wait(100)
	models = inicfg.load({}, table.concat({getGameDirectory(), "\\AutoID\\AllModels.ini})
end

    By getting the dff/txd name, you can have functions such as: show weapon icons, in-game entity spawner (like AutoSpawn), and even an in-game map editor (be sure to adapt it to AutoID)!
    Note: Since I was scanning the game's data files already, I thought that I should create a list of the model and txd names of the scanned lines. Creating this list has had a minimal impact on performance.
6. Added a readme with various links.

 

Only the "AutoID.lua" file has been changed: replace it for a quick installation.

Edited by HzanRsxa2959
Link to post
Share on other sites
HzanRsxa2959
Posted (edited)

Update 2.1.6:

  • At least two users had reported that AutoID was not working, and giving the error "not enough memory", later to be identified to be caused when used with any version of fastman92 Limit Adjuster other than 5.6 from MixMods. This issue has been resolved by reading the required values from the fastman92 Limit Adjuster INI file upon game launch. Previously, these values were read from memory addresses within the plugin, which gave errors between different plugin versions. Thanks to @XG417 for the help.

Note: Only the "AutoID.lua" file has been changed; replace it for a quick update.

 

Adapted Mods:
Cheat-Menu LUA 2.2 Portable:

  • The "Auto Aim" feature from the "Weapon" tab has been disabled as it caused issues with different control types.
  • Previously, the script was loaded on game launch, slowing down the initialization process. Now, the original script is launched using a "launcher" script, one second after the game loads.
  • The file structure has changed, so it is recommended to delete older versions of this mod before installing this one.

 

I'm still waiting for the HDD to start working on the ASI version, so in the meantime, I'll keep working on this. Here are some ideas for the next version:

  • Support for FLA Radar Blip Sprite Filenames, but I can't figure out a way to load icons.
  • Support for FLA paths (gonna need to carefully read the documentation for this one).
Edited by HzanRsxa2959
Link to post
Share on other sites

Reading memory from ASI plugin by constant address can never be a good idea. The FLA gets updated.

For few things the FLA has got exported functions, for example weapon name I think.

You can see Exports.h from the FLA

 

It's also possible to read the value from game EXE memory.

 

FLA4 extended path format is the newest and the simplest format. You only need to support this one. It's very similar to standard path format, with things changed.

Edited by fastman92
  • Like 1
Link to post
Share on other sites
HzanRsxa2959
Posted (edited)

Update 2.1.7:

  • Fixed the custom save system not working correctly with modified save file format, e.g., from fastman92 Limit Adjuster. Now it will work with every save file format. Previous AutoID custom saves may not work, though.

Small but important update.

 

Changed files:

  • AutoID.lua.
  • (Same directory as AutoID.lua)\AutoID\AutoID.s.

Replace them for a quick install.

Edited by HzanRsxa2959
Link to post
Share on other sites
  • 2 weeks later...
HzanRsxa2959
Posted (edited)

Update 2.1.8:

Here it is: The last update. I tried to add support for FLA blips and paths, but it was going nowhere. Maybe in the ASI version. Do report any bugs, though, and I'll probably release another version with them fixed.

1. Some major and minor code improvements.

2. Fixed Melee Combos not being replaced with their assigned IDs when reading AUID files.

3. Added a new feature: Silent Mode:

Quote

Now, when reading AUID files, if the AUID file name enclosed in <> has a * at the end and the AUID file does not exist, then no error message will be shown and a default ID (-1 if not defined) will be assigned instead. The format is this: <AUID file name*default ID, -1 if not set>, i.e., <coltanaconda*1239> will  be assigned ID 1239 if coltanaconda.auid is not found or not assigned any ID.

This is especially useful with the AutoID section "FIL: filename".

4. Improved the dialog boxes: They are now more informative.

 

Only the AutoID.lua file has changed. Replace it for a quick update.

Edited by HzanRsxa2959
Link to post
Share on other sites
  • 1 month later...

Great mod, I have only one question tho. When I adopt a car for AutoID, how am I supposed to adapt the cargrp.dat file so the car spawns in the world? Instead of editing cargrp.dat, I mean.

  • Like 1
Link to post
Share on other sites
HzanRsxa2959
Posted (edited)
6 hours ago, Insomnium said:

Great mod

Thanks.

 

6 hours ago, Insomnium said:

I have only one question tho. When I adopt a car for AutoID, how am I supposed to adapt the cargrp.dat file so the car spawns in the world? Instead of editing cargrp.dat, I mean.

Spoiler

Note: This method recommends Mod Loader.

 

1. Copy the cargrp.dat from the game's data folder to the car's mod folder.

If you don't have Mod Loader, then you need to edit the cargrp.dat from the game's data folder directly, so open that.

 

2. Open the cargrp.dat with any text editor.

 

3. Here is the format of each cargrp.dat line:

Quote

modelname1, modelname2, modelname3 #comment

modelnames cannot contain commas or spaces.

If there are more than one modelnames in a line, they must contain between them a comma, a space, or a combination of both.

The order of modelnames does not matter.

Each line can have a maximum of 23 modelnames by default, but AutoID increases the limit to 63 if fastman92 Limit Adjuster is installed.

Comments start with a "#", are optional, and can be placed anywhere but will include all the data that comes afterwards until the next line.

The comment at the end of the line describes the zone in which the vehicle will spawn.

 

4. For example, here is one cargrp.dat line:

Quote

buffalo, stretch, taxi, cabbie, coach, flash, sultan, club     # POPCYCLE_GROUP_CLUBBERS

And here is the same line after I added a car with model benzin and the end of it:

Quote

buffalo, stretch, taxi, cabbie, coach, flash, sultan, club, benzin     # POPCYCLE_GROUP_CLUBBERS

 

5. Mod Loader will automatically merge this modified cargrp.dat with the original cargrp.dat at runtime and load the merged file instead of the original.

Only if you have Mod Loader, of course.

 

6. To find the newly-added car, search the in-game location where the other cars in the list spawn.

 

EDIT:
Everyone: After taking a break, I have been working on a new version (2.1.9) for about a week. I should be done in about two days.

Edited by HzanRsxa2959
  • Like 2
Link to post
Share on other sites

Thank you, this helped a lot. Looking forward for the new version of the mod.

  • Like 1
Link to post
Share on other sites
11 hours ago, HzanRsxa2959 said:

After taking a break, I have been working on a new version (2.1.9) for about a week. I should be done in about two days.

 

That's super neat! What can we expect in the new version?

  • Like 1
Link to post
Share on other sites
HzanRsxa2959
Posted (edited)

Changes in 2.1.9:

  1. Now AutoID will ignore IDE files inside Mod Loader which have a missing level (gta.dat) line (peds.ide, vehicles.ide, default.ide and veh_mods.ide are always read). Previously, ALL the files inside Mod Loader were read, which resulted in some free IDs being wasted. (I don't have much faith in this feature, so if it proves to be more trouble than it is worth, I will remove it.) Both the read and ignored IDE files are listed under "Read IDE files:" in file game directory\AutoID\logs\Assigned.log.
  2. Fixed the formatting of fastman92 Limit Adjuster's gtasa_vehicleAudioSettings.cfg which fixed issues with older versions of FLA complaining about non-existent models being registered.
  3. Vastly improved the Message Boxes.
  4. Fixed Silent Mode using -1 even if a default ID was provided.
  5. Now all AUID files which do not have any ID assigned will be written under "Unassigned IDs:" in file game directory\AutoID\logs\Assigned.log.
  6. Empty lines are now skipped while reading AUID files.
  7. Now installing at least one vehicle adapted to AutoID increases the "VehicleStructs" value in fastman92limitAdjuster_GTASA.ini by 2500. This is to prevent any crashes caused by changing the "Cargrp cars per group" value to 63 if Open Limit Adjuster is not installed.

It's late here, so I will post it tomorrow morning.

Edited by HzanRsxa2959
  • Like 2
Link to post
Share on other sites
HzanRsxa2959
Posted (edited)

I was going to post this early yesterday, but something suddenly came up. Sorry for being so late.

But the silver lining is that this also gave me a chance to fix 2 serious issues with saving weapons.

Anyways, here:

 

Update 2.1.9:

The post above is included.

  1. AutoID will no longer save adapted weapons that have run out of ammo (state 3). This fixes the player being given back the adapted weapon with 1 ammo on game save/load even if said adapted weapon had run out of ammo beforehand.
  2. Improved the method that added the ammo to adapted weapons after giving them to the player on game save/load. This increases compatibility with mods that prevent the weapons from reloading when switching between them (E.g., Scroll Reload Fix in MixSets).

Changed files:

  • AutoID.lua.
  • (Same directory as AutoID.lua)\AutoID\AutoID.s.

Replace them for a quick update.

 

Adapted Mods:

Spoiler

 

1. SAMP Objects:

  • Combined all of the 200+ TXD files into a single TXD file named samphzan.txd to prevent the game from hitting the limit of the amount of different TXD files.
  • Added a combined IFP file named SAMPHZAN.ifp for the animated objects.

 

2. Los Santos City Hall:

  • Modified the map a little, adding collision to the roof and tables with flower pots.

 

3. Cheat-Menu LUA 2.2 Portable:

  • Now reloading the script will no longer update the Mod Loader log.
  • The Object Spawner now displays the AutoID objects in alphabetical order.
  • Now you can hold X to hide the cursor and regain control of the mouse.

 

4. Added: Food Eating Fix

 

 

Links added to main post.

Edited by HzanRsxa2959
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.