Back to Main Page


This page is about my Players Extended mod, a mod that throws open the world of addon peds, making them accessible and more interactive than ever.

WARNING! This is my therapy mod, this is intended to keep me away from the edge... Content on this page could get feisty on bad days, which are every day. If you want jolly stories about mod development, this probably isn't the page for you.

This hasn't been a free-flowing project like my others, this really is a battle of wills to keep going and I lose that battle a lot. Some days just a couple of lines of code get written, other days see more happening... but it's hard to keep this going, really hard.

I don't expect people to understand just how critical this mod is, I don't expect them to care how critical it is... but this is a make or break mod for me.

Page 1

Page 2

Page 3

Page 4

Page 5

 

Players Extended - Addon peds at your fingertips (Page 3)


Update: Irrational rage and DDS converters.

The most annoying thing about DDS files, is the lack of thumbnails unless you install some third-party crap into your system. It beggars belief that in a development OS, there is zero support for the most common development image format. I had extracted 132 ytd files for the glasses and had all these mystery dds files, so I decided to do something about it... simple task, rage inducing solution. DDS is a pain in the backside format and I had no idea how to decode one. I had to find a library and that was easier said than done.

Eventually I ended up with one that couldn't decode the alpha channel on DXT5 properly, which I bodged to just store solid alpha for every pixel. Drives me fricking crazy when people put things online that don't work, then don't give a shit about it enough to fix it. If it doesn't work properly, fix it, or remove it. But anyway, these images were just reference images, alpha was irrelevant. So now I have another tiny app that I can just drag a selection of files onto, it will extract the dds files from what you dropped onto it and then depending on whether you select JPG or PNG, it will convert them into that format... just what I needed.

The irrational anger came from eSpares giving my personal information to Royal Mail. It absolutely pisses me off when companies think it's just okay to pass this info on. If I wanted other companies to have that info, I would give it to them myself. Other people might think getting an SMS message and an email about the delivery is great, I just see past that and it dials my rage level to 11. Sets the day up perfectly as I have a doctor's appointment later, welcome to the f*****g wekend!

16 pairs of glasses, I think that's more than enough now... oops, I forgot a pair.

  

Update: Spent a bit of time last night with a camera interpolation test mod, baffled by how it has been implemented in SHVDN because when you do:

thisCamera.InterpTo(thatCamera etc...

You have to check

if (thatCamera.IsInterpolating())

...which is just crazy, thisCamera is the one that is interpolating... which is clear because you never set thatCamera as active. But at least it works, so the final switch stage transitions exactly to the GameplayCamera view, which is better than the sudden jerk to a slightly different viewpoint I had. I just need to get the acceleration and deceleration working on the panning at some point but that's a job for much later on in proceedings.

Tonight I added sprite drawing to the MenuV banner system, so that I can display custom sprites for the inventory buying part of this mod. The menu adjusts the sprite to fit the menu width and adjusts itself based on the height of the sprite. There is no limit to the height of custom sprites, but the shopUI ones are dictated by their width. The image shows all three modes it now supports and you can see how the menu shifts itself based on the banner used. You can of course have no banner and that will simply draw the menu part at the position you specified.

I must remind myself to not get tempted to answer questions on GTAForums any more. It's annoying that I seem to be the only person answering questions but I think I am answering things in a way that isn't appreciated by the asker. They seem to want the solutions without the thinking part... which is pretty much indicative of the GTAV modding scene... give me what I want, give... give... give... it's like modding for zombies.

Update: There's nothing worse than anticipating how the game might be working and then to have that anticipation blown away by the reality. I thought the food stands and gift stands on the pier would all be populated at different times of the day, controlled by scenarios. Turns out that out of all the gift stands, the Mug Shots stands are the only ones that have someone in them. The food stands have no scenario markers at all, so I have no idea how they are controlled. But that means there are another set of usable assets that are just a complete waste of fricking space. I could add scenario peds in them but everything I make in Codewalker crashes the game.

The really f****g annoying thing about CW, is that everyone says "It's the best thing ever", "Don't use anything else, it's like ambrosia... the tool of the gods". But what's the point in saying that, if no f****r will take the time to tell people how the goddamn things fricking works? Codewalker will display things in a way the game won't... that's a f*****g useless function if there ever was one. That's like me making a mod that does things the game won't do... pointless.

I am actually convinced that nobody makes anything with Codewalker, they just use it to find things, then use Map Editor or that godawful Menyoo to build maps, then use ME2YM to convert them. The worst part is that everything CW outputs is fricking compressed, so to edit it, you have to import it into OpenIV, then export it again... it wastes time and that's not how a utility/tool is supposed to work. It's a classic example of the amateur toolkit. Although looking at the GitHub page, it looks more dead than the NativeUI repo and that's saying something.

So today it has just been... waste some time, waste some time, waste some more time... these are the dangerous days for me... these are the days that will potentially flip the switch. And I know... if I wasn't such a complete d*ck/tw*t/c**t/p***k [delete as appropriate] I could ask for help. Well here's the thing, being a headcase makes bad things happen and bad things happened.

Yayy! Just to end the night on a low, I thought I'd be smart and add an optional parameter to one of the MenuV constructors... let's now rebuild every mod that uses MenuV, because this seems to be the most popular constructor and everything using it is now broken... Woohoo, what a genius I am!![/sarcasm]

Update: More productive start to the day today. Menu system is now working, buying is now possible, money gets adjusted accordingly and help-text is enabled under useful conditions.

 

You can see the new banners in MenuV, this just gives me another outlet when my coding brain dries up. I don't like the Chihuahua banner, it's pretty crappy but at least it shows it's working. This isn't multiple menus, it's just a single menu that adapts itself to the location... banner, number of items etc... I decided to go for checkboxes, so that you could buy multiple items quicker. Because there is an inventory system, items aren't immediate use, they can be stored, but not for too long as each perishable item has a lifespan. Food will go bad, hot drinks will go cold, cold drinks will go warm, that kind of thing. These states are currently shown in the debug panels that are displayed on the right-hand-side.

Food stands are only functional with a vendor present, which means I am going to have to add my own vendor spawning system for those locations that don't normally have them. That's easy enough to do but it all adds extra processing on top of what the mod is already doing. I am considering running it as a secondary Script inheriting class, that simply handles vendor spawning/despawning. That way it should run in a separate thread and as it doesn't need to communicate with the main mod, there will be no threading issues... in theory.

But the addition of the menu now opens up the potential for what the mod can offer, once the inventory is working, it's going to feel a lot more fun to use the addon peds... especially when they also have access to DIS, WGS and Car Services... which reminds me, I might try and get Car Services communicating with this mod via decorators, so that those functions can be paid for, if you're a compatible ped.

Update: Well today is racing along... inventory is now working, item adding, updating and expiry (and removal) all working nicely. You can see in this next image that Emily likes a meal from Beefy Bill, then still hungry, she resists the Chihuahua vendor's hot sausage (doesn't happen very often) and goes for some mini pretzels and some water.

Each is just assigned a random value at the moment to check that different expiry events all kick off when they should and in the last quarter of the image, you can see the last 2 items expiring, leaving the inventory stats at Food: 0 and Drink: 0. Zero crashes, 100% success.

I also have the VendorManager script ready to go, creating a new class that inherited from Script leaves it ticking away nicely on its own, so that's perfect as well. I can only presume that tonight is going to be a total disaster... this is far too much like a free-ride and I never get one of them without consequences... we shall see.

Update: I knew it was too good to be true... I tried to set the VendorManager collecting props for checking and what do you know... the gift stands on the pier aren't detected by prop collection or object checking. *sigh* Time to add a quadrant-search system into the mod.

Update: Quadrant search is now working, so that's now highlighting all the relevant locations and I have code that is predicting where the vendors will spawn. I am concerned about the Cherry Popper Ice Cream stand though, there isn't a lot of room inside.

Main task today is to get a visual representation of the inventory on screen but I just can't get a feel for how it is going to look. Up to now there are 4 inventory categories, Food, Drink, Glasses and Accessories (umbrellas, binoculars etc...). So I need a functional way to flip between those 4 categories and display a dynamic list of contents, without being too intrusive on the play-area. Plus I also need to display info about each item and for the food and drink, lifespan/heat levels. Do I use sprites of the models, do I use stylised sprite-icons... I just can't decide. Is it a grid of items, is it a stack of items, is it a ring of items... so many choices.

Update: Decided to extract the burger images from the burger stand texture. Having done that, I decided to start creating similar sprites for other items. Simple 3-light setup in Max and I can import a prop and render a quick image. I have these so far, which I think look okay and might work quite nicely in an inventory system. The two beige-coloured bars will be where the life and heat bars will go.

This is the actual size, which is a 64x64 sprite and a 64x22 area for the bars. Not too big, not too small and you can make out exactly what they are easily enough. Ignore the fact that there are 2 eCola cans, there is only an open eCola can, so I rendered the Sprunk can with the eCola texture, to get a full set of closed cans. The bagel needs redoing because I can only find a low-res, partly-eaten model, so I might have to make a bagel model and render that.

Major Update: Added the Players Extended decorators to the mod and that now means that other mods can either give money to the player or take it. So everything in Car Services now costs money, no more free fuel, no more free repairs and no more ogling the girls at the premium car wash for free.

There are 3 decorators in total:

PEPlayer (bool)- Which is set when you are using one of the extended players
PECashReady (bool)- Gets set when another mod is making changes to the player's money
PECash (float) - Holds the money change value

So when a new ped gets set in Car Services, it checks to see if it's an extended player and sets a flag to avoid repeated checks. When you use any of the services, like refuelling, it calculates the fuel cost and then says:

if (IsExtendedPlayer) ChargeExtendedPlayer(totalFuelCost);

That functions sets the PECashReady decorator to say there's a cash change waiting and the PECash decorator with the cash change value.

Players Extended checks to see if the PECashReady bool is set and if so, it handles the cash transaction.

This probably sounds nothing more than a minor update and as far as functionality goes, it was, it was a few lines of code. The cool thing about this though, is it opens up the potential for job mods, car selling, delivery driving etc... a whole world of money earning awaits. But think of all those chauffeur mods, or car mechanic mods... how much better would it be if they came with a cost, no matter which ped you were using? In that respect, what it adds is major.

This is what should have happened to addon peds ages ago... and it didn't. Anyone who uses addon peds should be able to see the massive benefits this is to roleplay, because it blurs the line between what the main characters can do and what addon peds can do. This is what happens when a community pulls the blinkers on so tight, that they can't see a bigger picture. Nobody communicates, shares ideas, merges concepts... it's all me, me, me... and honestly, it must suck big time to still be trapped inside it.

Update: Learned a tiny bit of information about cross-threaded communications using Lock objects. The reason for this is that the VendorManager class I created to deal with the vendors at certain locations, now also handles finding vending machines, like the Sprunk, eCola etc... machines, which takes the load of the main mod processing.

So that searches for a prop, if it finds one, it sets a property in the main mod class. When the main mod class spots a prop in the property (that is usually null), it can set up an angled area check on the nearest prop and display a message on how to use the machine. Pressing the required control (D-Pad Right) starts the animation sequence of the player getting the can from the machine.

All of that works perfectly up to now but there are two main hurdles that I have to deal with.

1) Animating the can dropping. CHECK - Is done automatically by the game physics.
2) Throwing the can away. CHECK - Is done by the line I show just below.

And 3) synchronising all that with the animations.

1 I can probably do by time-syncing, 2 I am not sure about, because I suspect that might involve applying a force to an entity, which I know less than zero about. Hopefully there's some info available, if not I am screwed again as I have no way of asking for any.

Hmmm, the ob_vend1 script seems to have the full vending machine sequence, including this line:

ENTITY::APPLY_FORCE_TO_ENTITY(iLocal_55, 1, vLocal_56, 0f, 0f, 0f, 0, 1, 1, 0, 0, 1);

iLocal_55 seems to be the can entity and vLocal_56 is set to this { 6f, 10f, 2f }, which I am hoping is the velocity vector for the applied force.

Along with all the timing and attachment info it includes, that should allow me to pretty much create the sequence exactly as it works for the main characters... very useful if so.

Update: And we now have working vending machines, both types, Sprunk and eCola, each with the proper can and both with the can throwing working. I consider that a major success because the normal game always spawns the Sprunk can, no matter which machine you use. So Addon Peds 2 - 1 Game Peds. :D

 

Interesting things I learned today.

1) The PH bones seem to be used to attach things to. The can is attached to PH_R_Hand in the scripts and I have always been attaching things to SKEL_R_HAND.

2) Function.Call(Hash._0x2208438012482A1A, PlayerPed, 0, 0); Apparently, that makes the animations faster. It's called after a PLAY_ANIM task. I am wondering if that is to get better/faster transitions between multi-stage animations. The vending animation is 3 parts and it also seems to use really high speed values for in and out of animations, i.e. 1000f, whereas the normal speeds are 4f or 8f.

Aha!! That function seems to set the blend speed between animations. I have just used it with my umbrella activity and where there used to be some movement as I transitioned from walking to stopped to walking, it now switches instantly... excellent.

3) CREATE_OBJECT_NO_OFFSET, I think that creates objects at a position and then immediately lets them be subject to game physics, which is how the cans are spawned.

So new things working, new things learned.

Update: And for every day of good things, comes another of bad ones. I finally got the panning working properly in the camera switching last night and then started thinking about the PLAYER_SWITCH natives. But once again, there is zero info out there, which makes me wonder if one of two things is happening...

1) Nobody is doing anything with those natives because they're just spawning addon peds with a trainer.
2) Nobody is doing anything with those natives, because they don't work with addon peds.

The problem is, to try and recreate the script functions, you have to understand how the script is working. For the most part, that's okay... but then you have the natives that just have hash values and it's hard to work out what they're doing, or how relevant they are. Then you have the multiplayer factor and how much of the script you're looking at, makes decisions based on you being online or not.

So you have to take sections of the script and trace variables back through endless functions that say nothing but func_228() for instance. The variables might be called iParam0, or bParam8 but iParam0 might exist hundreds of times as a local variable in various functions. You might find a function that gets passed up to 14 parameters but each of those parameters might have been created as a result of another function. It's time-consuming, frustrating and there is ultimately no guarantee that you can use anything you find, because it might just turn out to only apply to onine, or the main characters.

The vending script I was working on yesterday is a 67,000+ line file, other files are many times the size of that file... I just don't know if the cost is too high, if the price I will pay mentally is too high... I just don't know.

Continued here