Metal Gear Solid 5 Phantom Pain Headgear

0 views
Skip to first unread message

Kayleigh Telega

unread,
Aug 5, 2024, 9:26:52 AM8/5/24
to percgolfcatur
Alot of cosmetics were introduced to Metal Gear with MGO3 - wide variety of headgear along with swimsuits and other tactical stuff. Unfortunately KONAMI forgot to add them to singleplayer. It took them about a year to start porting MGO cosmetics back to TPP as FOB event rewards. Judging by amount of cosmetics, it will take them years to port everything (if they are going to port all of it). But models are already in the game - what stops us from modding it from MGO to TPP?

The easiest way would be direct model porting. It is achieved by editing already existing models, usually in hex editor or some 3d software. All model mods on nexusmods are made using those methods. It works, MGO cosmetics are in TPP, but there are issues.


By changing vars.playerFaceId and vars.playerType(was it playertype?) you can change your face at will (assuming you play as DD soldier). You can see full list of faces in prettified file Soldier2FaceAndBodyData.lua in Infinite Heaven mod. Via changing variables you select one of the predefined face variations - that includes hair, hair colour, skin colour, face paintings, eye color, gender, etc - studying the file will give you a lot of information about that. You can do it using IH - see


What prevents us from using that method? The problem is - faces are pre-baked. Let's take a look at bioengineer from mission 5 "Over the Fence". His glasses are a part of his face and are unseparatable.


More than that, we don't have full control on what will be replaced - we are still bound by pre-baked models. That means that for every head/body cosmetic we will have to make a separate model which will consist of regular model + mgo cosmetic. Not good since we need more freedom - like in mgo where you just put hats on yourself without any modifications to your face/outfit.


After failing a couple of times game suggests to equip a chicken/chick hat which is attached to the head and looks like a hat - just like we need. No, it doesn't work well enough.

Issues: You need to activate chick mode first - it requires reloading a checkpoint so it is not realtime; there are only 2 models to replace, which gives us little to none variety (and more frequent repacking); hat is attached to the head, what about body costumes (ie underboob outfit)? you are stuck in chick/chicken mode, enemies won't attack and chicken head disappears after 3 alerts. Also there is no code that can modify behaviour above, just 2 variables that turn chick/chicken mode on and off.


By providing right fv2 file snake drastically changes appearance - his bandage is removed, he gets burns and cuts body-wide (mesh and texture manipulations). All of this without any loadings, instanst. Sounds perfect for our cause.


Issues: How do we add hat cosmetics into our models? Not as part of main model, but as a separate model as seen on screenshot from xentax thread? This will require modifying every model - snake, hospital snake, dd soldier etc (see tpp/master/0/00/Tpp/start.lua, Player.RegisterPartsPackagePath). That will be a huge advantage since there will be many cosmetics in one file giving us freedom and reducing mod size; how do we make a proper fv2 file that will switch models properly? This is the biggest problem - fv2 files are tiny, have some bytes in them and yet they do so much; applying wrong fv2 file will crash the game.


Notes: changing player's fova via GameObject.SendCommand does absolutely nothing. However it works for npcs - ie Ocelot in Phantom Limbs. Ocelot loses his eyewear by changing his body id - try 370-371-372 to watch his glasses magically appear and disappear. Applying modified fv2 file to npc doesn't crash the game even if it's wrong (tested by replacing everything aside from header with zeroes). Does this mean that game has fallback mechanism for GameObject commands? Are there any checks before changing fova? Why is there no such check for player fv2s?


All objects in the game consist of parts. As you have seen above, game has different .parts for different types of player. .parts files bind together everything related to the object - .fmdl model, .sim/.ph physics, .frig rig files, .frdv bone files and everything else. Convert it to readable xml using FoxTool.


For example, skullface (chunk0/Assets/tpp/pack/mission2/common/mis_com_skullface.fpkd) consist of his model, 2 models of his hat, 3 ampules with parasites and a case. This sounds perfect. Nothing stops us from adding hats to player parts file, just copypaste the structure from skullface and change some paths, pack model/textures and viola. Or at least that's what I thought.


Unfortunately game needs to know which models to render - skullface doesn't run around with case and 2 hats all the time, even though they are referenced in .parts file. How does the game knows what to render at this exact moment? I suppose that is decided by fv2 files, which are a mystery, or it is defined somewhere in demo files.


There is some code in mgo, that realizes parts and attaches them one to another. See file 114716d115c13_fpkd/Assets/mgo/script/actor/mgoTeamsneakFlag.lua - mgoTeamsneakFlag.lua exists in multiplie fpks, there are unminified versions of that file with nice variable names. Function this.Construct is the function that is called twice while loading mgo level (cloak and dagger mode). Apparently it creates disk objects and attaches effects to it. Game also attaches blue disk effect above your head using .parts file using code from that lua file. if PartsIndex == nil then actor:DetachAndTearDownAllParts() local success = nil success, PartsIndex = MgoParts.Realize( PartsFile, 1, 1 ) if not success then PartsIndex = nil Fox.Error( "mgoFlag:Construct(): Failed to realize parts " .. PartsFile ) else actor:AttachParts( PartsIndex ) MgoParts.SetVisibility( PartsIndex, true ) endend


However I was unable to reproduce it no matter what. What is 'actor'? It has some nice methods, but I can't find where do you get it - probably this part is called by C part of the engine. There are no classes with these methods in my lua dump either. And even if we find out, what is that 'actor' thing is, there might be a chance that there is no such thing in TPP. Some classes are MGO exclusive (such as MGOactor and Gear), so even though that 'actor' can attach parts with a handy method, there might be no such class for main game.


I am pretty sure that similar code runs when you call Player.AttachGasMask function (Shining Lights mission): game realizes a model, then attaches it to your mouth bone/connect point. Unfortunately the realization is hidden in C.


It seems that effects/attachments have to be listed in .parts listing, judging by file chunk0\Assets\tpp\pack\player\parts\plparts_normal_fpkd\Assets\tpp\parts\chara\sna\sna0_main0_def_v00.parts A closer look: EffectDescription0009 EmblemFlare SKL_011_LUARM What do we see here? Some flare effect on Left Upper Arm - that's diamond on your shoulder that you get after mission 43. It means that effects and additional models mentioned in .parts file are loaded along with your main model; they are toggled by some code hidden from our sight. This effect in particular is activated by Player.SetUseBlackDiamondEmblem() function - no clear realization as in GZ, another wrapper function.


Note: Ocelot in Phantom Limbs has his eyewear attached solely by fv2 files and demo magic! Not a single entry about glasses in his .parts. But Miller has "Sunglasses" entry in his .parts; they are not attached to his face, becoming part of him only after snake puts them on during the cutscene(or not?). Even worse: Miller doesn't have any fv2 files related to him.

Parts entryfv2 files Miller"Sunglasses"None OcelotNone3 fv2 files Ocelot with broken fv2 without glasses - , but he gains them no matter what in a cutscene - It means that cutscenes have a way of attaching parts as well as fv2.


Conclusion: This is the way how things should be done - attaching objects one to another using code. The moment we understand what 'actor' is and how to 'realize' parts without MgoParts class, realtime change of cosmetics in singleplayer will become a reality: just pack some hat fmdls into your player pack, add some entries in .parts file then change cosmetics with a couple of code strings. Until then hex editor and humongous mods are the only answer.

3a8082e126
Reply all
Reply to author
Forward
0 new messages