gtav-ent/GTAV-EnhancedNativeTrainer

Update 29 - possible release?

Opened this issue · 37 comments

Just thought I'd give a status update as I feel ENT should be ready for a re-release as I've spent quite a bit of time fixing up all the known issues it had (like missing car mods for Benny's cars).

I've finally managed to get Benny's car mods working, including Liveries and some features like Trim Colour (thanks to froggz19 on GTAForums for the code for the interior/Trim colour and helping me out with the misc issues like horns not appearing). This portion is fully working (tested it on multiple cars). The trim colour option does appear for cars which don't support it, but that'll probably be an if statement to check if it's a valid car. Pretty small. Doubt anyone would notice it to be honest.

I had to replace the _GET_LABEL_TEXT method of getting horn names with an if statement list, as that was the only way I found to get the new horns to appear (Liberty City loop etc) as I couldn't find the labels for them anywhere. It's clunky, but it works.

I added FlakTheMighty's Tyresmoke menu. Don't know why but TiCoder's one didn't change the tyresmoke for me. It just stayed black.

The new cars have been added (Banshee 900R, SultanRS and a few Ballers etc), and vehicle images added for Benny's cars and those with missing images (although in the case of the Baller, I had to reuse some of the images as I couldn't find the Armoured variant images anywhere).

Also added the more mundane (in comparison to the above), "No Ragdoll" option to player options.

I've created a pull request to try and merge my changes, so hopefully it'll be released as update 32 (or whatever number you'd want to choose for it; I always thought it was named according to the TU) as I think that's everything which needed to be added/fixed up.

I have no problem with my tiresmoke menu, don't forget to turn on the toggle. The toggle allows in a weird way, the possibility to get a colored tire smoke and the default white at the same time.

I looked at the code (commented it out) and forgot to use the toggle code (oops).

The Toggle worked initially (for 1 tyre having different colours to the rest) but it then stopped working after I turned the toggle off, changed colour and turned it back on again so both tyres now had the same colour. Turning the toggle off doesn't reset the smoke either (stays on the last selected colour).

Doesn't seem to fix itself unless I restart GTA. I'm not sure if it's just me, or I've got remnants of code somewhere messing it up either.

I have to agree this is a bit random. When I turn off the toggle, I still have color for a few seconds and after that, it turn back to white automatically... The first time I wrote the code, I was turning the color to the default one when the toggle was set to off. I think to put that back so it won't be weird like it is right now. If I do that, I will remove the white color from the list since it's the same as the default and every choice will be on the same menu page.

Things I need to do (will update this post as I go):

  • Test preview images for all the new vehicles
  • Fix wrong preview images (normal Voodoo, normal Faction, normal Moonbeam)
  • Restore liveries (done) but also understand the intention of the failed changes
  • Test the new vehicle mod stuff
  • Understand the tyre smoke stuff above - has the toggle gone now?
  • Fix tyre smoke colours
  • Test horns
  • Test new weapons, check we have everything
  • Update the vehicle spreadsheet - all the lowriders need adding, possibly more
  • Check whether problems with bodyguards are resolved - I knew what was wrong after U28 but not sure if I ever actually fixed it
  • Sort out 'spawn vehicles fully tuned...' which is too long for the menu
  • Test any other changes that people have made - what?
  • Find and add missing vehicles (see later post)
  • Fix the hearse in sedans which is confused with another set somehow
  • Sort out the unformatted '74' in vehicle mods
  • Remove the dash/trim colour submenu symbols in the menu
  • Save tyre smoke, dash & trim colour to the database; check the rest
  • Sort out the wrong dashboard colours (e.g. 'orange' is not)

I tried getting the liveries to work on Benny's cars via the method ENT had originally (GET_LIVERY_COUNT etc) but that didn't work. I was told by Froggz that they're now vehicle mods, so edited it and it seemed to have worked but only displayed the liveries as "item 1, item 2...." but they applied properly, but around this time I managed to get them working properly under Vehicle Modifications, so undid my changes from the original livery code and I think something must've gone wrong.

The tyresmoke option I committed wasn't TiCoder's one but FlakTheMighty's instead since it seemed to work better at the time (I put the issues I had with it above). I'm not fussed which one is used in the final release to be honest. I couldn't figure out why TiCoder's one was going strange for me (sometimes the colour would toggle, other times it would be on 1 wheel then break etc).

Vehicle mods do save to the database properly (as far as I could tell) but liveries don't for some reason.Tyre smoke saves properly but it also seems none of the other Benny's related mods save either (seats, dash etc). Is there a piece of code somewhere I've missed which limits how much is saved on a vehicle?

The other changes someone else made- the interior colour and dashboard colour code was from Froggz from his update 24 fork. I just implemented it and fixed it up in some areas so credit does go to him for the original code. I noticed recently, some of the colours are named wrong (there's a couple of "Purple" colours which creates Orange instead - I only realised this after the pull request).

OK - liveries as they were in ENT28 apply to certain vehicles like the panel van, the Buckingham Swift helicopter and so on. I've restored that to working.

I'll have a look into the other concept of liveries as a Benny's mod, and see if that can be added in as well.

And yes, there's a value in storage\database.cpp that meant the first 25 mods got stored. This needs increasing to whatever. It's on my list.

Anything that isn't a generic mod-with-a-slot-number will need more work.

Missing vehicles (complete when in code, spreadsheet and has preview image):

  • Declasse Tampa
  • Supervolito & Supervolito2 helicopters (elt_dlc_apartments)
  • Armored Cognoscenti SWB & LWB (cog55(2) in lgm_dlc_apartments? also cognoscenti(2))
  • Turreted limo (limo2 in candc_apartments)
  • Verlier(er) (missing from spreadsheet and wrong in game)
  • Schafters (mis-labelled, missing previews)
  • Ballers (missing previews)

Not sure if it's a local problem with my cloned source, but schafter5.png seems to be missing from the veh-previews folder. It's referenced in Resource.rc but I can't find it in the Veh-previews folder or on the repo.

So it is. Not sure what happened there. I'll add it on the next commit.

Now need to go around the loop again and add the Lowrider 2 stuff.

I've added the Lowrider 2 stuff (weapons + new cars (even the unreleased ones like SabreGT2 (along side their new, resized, preview images)) but it seems R* have a script running now which just despawns the new vehicles in front of you when trying to use them in singleplayer.

As the scripthook isn't out, I can't fully test this (need to find out if the compact rifle has skins for a start), but should I just leave them in there or comment them out? I've updated the spreadsheet regardless though.

I was also getting a linker error when trying to compile the last release (pre-updated vehicles etc - corresponding to "process_interior_colour_menu()"). I've replaced it with "process_dash_colour_menu();" under vehmodmenu and it seems to compile, but I'm not sure if it's a mistake on the repo ("process_interior_colour_menu()" is no longer under "vehmod_interiorcols") or a mistake on my part (accidentally deleting something I shouldn't have).

Leave them in, but merge them please as I'll want to pick this up once the new hook is out.

I saw about the despawn, which I'm not 100% convinced about, but worst case is that the whole set of lowrider features get commented out for a while.

You can suppress or mod out various R* scripts, although not all, so it wouldn't surprise me if someone managed to do that with this if it really is a problem.

Someone bypassed the block with a mod, could always recommend it be installed.

Arewenotmen found that GAMEPLAY::TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME("shop_controller"); stops the script from kicking you out of the car, but also stops shops from working. Would doing something like how the army base script is stopped work (either a toggle, or auto detection of the vehicle and turns it on/off accordingly)?

Update: Setting a global with ID 2558120 to 1 stops the low riders disappearing (courtesy of sasuke78200 on GTAForums) and allows shops to continue working. I'm not entirely sure how this would translate into an option/code however.

Just noticed that the Compact Rifle customization menu crashes Scripthook with error ID 34. Haven't tested with the other new weapons yet.

Strangely, after the latest scripthook - I can no longer fully unmount loaded ASIs as when I try and copy over new ones, Windows tells me they're in use when they shouldn't be (this is using the scripthookV.dev option). The scripthook then crashes when I quit the game. I'll look into the Compact Rifle customisation though. I might have spelt something wrong.

Could someone look at my Gravity Gun code (for weapons.cpp) and tell me where I'm going wrong? I had this code in a previous menu ages back but it didn't work there either, so I just commented it out. Seemed a fun option when I used it in other menus so I decided to resurrect it but no matter what I do - it just doesn't want to work.

I've added a means to get the co-ords from the camera, vector to float conversion and requesting control of an entity (that code came from Mafin's Menya Baes however as they were built in functions to the base, which my original menu with this (attempted) option used) and the gravity gun code itself, using the stun gun but it doesn't toggle on or 'pick up' anything like it should. It might be something really small, but I'm not sure what's going wrong.

https://gist.github.com/zemanez/36dd2e63afd52c66c4e6

Regarding your first problem, it's because there is something wrong with ENT that prevents it from being unregistered successfully. I've documented this issue a while ago here: #149

What exactly is the problem you're having with your gravity gun?

It's hard to tell. It should pick up the vehicle/ped you're looking at when you hold right click with the stungun. Left click should fire the 'captured' item.

When I try it in game, it doesn't seem to do anything (but the "...called" status text appears until I turn the option off) so I'm not sure if it's a looping issue, or how it's getting the props/ped (or if the request for control doesn't work - which it needs for every entity you try and pick up).

I had this issue when I used another menu base which loops things differently which might be down to the code itself but I'm not sure what's wrong.

PLAYER::GET_PLAYER_TARGET_ENTITY(PLAYER::PLAYER_ID(), &grav_entity)

I don't think this does what you think it does, as I believe this is limited to melee-style lock on. I think what you're looking to use is PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT().

If you're debugging, check what happens to grav_entity when you're free-aiming. I wouldn't be surprised if it remains null.

Thanks for the help! Changed the native to use GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(), but now it just makes the entity I look at disappear for some odd reason (seems to teleport into the sky, or teleport away completely in most cases) instead of being held up in front of me.

Can't really print out what &grav_entity is as it's complaining about trying to cast an Entity into a char (doesn't seem to work if I change it to a char from Entity either).

Do we still want to maintain the FiveM online-check code, or can we strip it out? I think they're pretty much shutdown.

No, it can be removed. I noticed it but couldn't be bothered to chop it out.

As an aside I'm probably busy for a week or so now. I almost got everything tested but then a few more bits and pieces came along. If you guys can have a go with all the new stuff and see if there's anything to be done, then hopefully we can put U29 out quite quickly once I get time.

Zem, did you go through your code with a debugger to make sure your variables are what they should be? It may be the case that your GetCoordsFromCam is doing something funky and teleporting your target off to never-never land. Do you understand the math that's being performed?

Does CAM::GET_GAMEPLAY_CAM_ROT return in degree or radians? You may have to convert since C++'s trig functions return in radians.

I tried to print out what each variable was holding, but I ended up getting incompatible types (DWORD to char* for example) and I wasn't sure how to get around it, so I ended up trying to debug what I could (coords etc). They didn't seem abnormal or null (at least for me - I could be wrong).

I'm not going to lie here but I'm not fully clued up about the maths behind it (I was never good at maths) but I understand it vaguely (not the best stance to have when this is using a lot of maths to pick up props etc).

I'm not sure about GET_GAMEPLAY_CAM_ROT. I couldn't find anywhere which told me what it returns. I might be wrong in saying this, but in Menya Base's GTA2 Cam mode, it uses GET_GAMEPLAY_CAM_ROT(2), and it works correctly. Replacing it with _GET_GAMEPLAY_CAM_ROT (with an updated natives.h file) - makes it work (removing the '_' breaks it). I might see if the native being used is wrong (like the one which targets the entity).

Someone mentioned setting the props you pick up as mission entities, which might be worth a try if the above doesn't work.

Not that it's the best documented code, but have a look at the prop spawner code in propplacement.cpp. This does all sorts with a camera, albeit not a first person one.

Also it returns a vector so to print the values, you would have to access each field.

This isn't based on a vector, but does put values on the screen:

std::ostringstream ss;
        ss << "Pitch: " << CAM::GET_GAMEPLAY_CAM_RELATIVE_PITCH() << ", Heading:" << CAM::GET_GAMEPLAY_CAM_RELATIVE_HEADING();
        set_status_text_centre_screen(ss.str());

I commented out ENTITY::SET_ENTITY_COORDS_NO_OFFSET(grav_entity, Coord[0], Coord[1], Coord[2], 0, 0, 0); - and the prop doesn't teleport away (it just sits there, spinning in the direction you face and flies away when you fire it) so I believe it's something to do with that.

Used the above code to figure out what's happening with Coord, but for some really, really weird reason - it keeps setting the coords as negatives and incrementing (or decrementing - depends on how you read it) the longer you hold right click.

I'm not sure why it's incrementing either, but that would explain why the props are disappearing (I held it for ~30 seconds with and without looking at entities/props, and it set the X coord to over 6000 for example).

I've created a branch for the U29 release called update-29-rc. That's what I'll be testing and putting out.

It's unlikely that the aimbot stuff will be included (i.e. it'll be commented out), as it's not ready yet & I don't want to delay things.

There's other stuff I still want to do at some point, so I will lend a bit of support to producing an Update 30.

The Combat pistol doesn't like adding the Yusuf Amir skin to itself, the option does nothing.
Will scout for more issues

EDIT: Here is the list of weapons with this issue:
Combat Pistol
SNS Pistol
Assault SMG
MG
Combat MG
Special Carbine
Bullpup Rifle
Compact Rifle Crashes the Trainer
Pump Shotgun

@gtav-ent this is the pre-release though.

Patriot Tyre Smoke not working

@Andre-Maartens
Looking at the main branch, it should. Unless Rockstar changed something about it with the new update.

@Andre-Maartens

Maybe...
STREAMING::REQUEST_NAMED_PTFX_ASSET("scr_indep_wheelsmoke");

There is also a tunable for online, VEHICLEKIT_INDEPENDENCEDAY_PATRIOT_TIRE_SMOKE

Apparently the trainer dislikes me switching through the different smoke types, so after going through the list it refuses to switch back to white smoke on selection... any thoughts? The only weapon skin problem is that the pump shotgun doesn't like switching to the luxury finish, other than that everything is working great

@Andre-Maartens
When I was writing that section I noticed that, I think the game isn't expecting the switching that often, because if you just let it sit for a bit and spin your tires, it'll change to white.

And @froggz19
I tested the tire smoke section again last night, the patriot smoke worked as intended for me.