Pls help me debug this script for Dynamic Paperdoll Backgrounds

Discuss modding questions and implementation details.
User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by King of Worms »

Hi, thanks a lot for your time!

Ive replaced the code with the new one from you (where I guess the "//" is commenting out some of the code) and unfortunatelly, the result is exactly the same as before. - NO dynamic background behind the werewolf image with cut out background. And that is in the dungeon or when I go outside.

This is how that new part of a code looks now:
//Apply builtin racial effect names
//vanillaName = TryGetVampirismTextureName();
//vanillaName = TryGetLycanthropyTextureName();

//Get vanilla image string
//if(vanillaName == null)

vanillaName = (string)RunMethod("GetPaperDollBackground", paperDoll, GameManager.Instance.PlayerEntity);
Not sure if the previous fix, where we solved that issue where I saw ONLY the dynamic background in the dungeon might be interfering with this? Am I supposed to have that fix in the code still enabled? Because I have it there.

Also, if it helps, I can send you the beast-form backgrounds, the dynamic background and the script + save file, so you can see for yourself?

I really appreciate your help here, would be bomb if we managed to make it work. But if it gets too tedious for you, Im ok with the fix you already provided - so the beast form is actually visible now :)

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by l3lessed »

Looking at it once again, those changes won't work.

He has created a routine that grabs the paperdoll and background texture and bakes them together into a single texture output to use for the inventory.If you aren't transformed, it first grabs the paperdoll and loads it into a texture object, then it does a check using all the custom tags and pumps out the custom background texture, and then adds that to the previous texture object baking them together. Finally it pushes that new texture into the UI System.

The code needs to both pull the transformation and background for properly baking them together. This is the issue right here.

Code: Select all

                //Apply builtin racial effect names. THIS OVERRIDES THE DEFAULT PAPERDOLL SYSTEM AND DYNAMIC BACKGROUND SETUP BELOW
                vanillaName = TryGetVampirismTextureName();
                vanillaName = TryGetLycanthropyTextureName();

                //Get vanilla image string. THIS SETS UP TRADITIONAL BACKGROUND WITH PAPERDOLL FOR USE BELOW IN DYNAMIC BACKGROUND SETUP.
                // THIS NEEDS TO RUN WITH THE TRANSFORMATION TEXTURE BEING THE paperDoll PROPERTY HERE. NOT 100% SURE HOW TO DO THIS
                //WITHOUT LOADING IT INTO VISUAL STUDIO FOR CODING.
                if(vanillaName == null)
                    vanillaName = (string)RunMethod("GetPaperDollBackground", paperDoll, GameManager.Instance.PlayerEntity);
Specifically in this line here, we need to some how force the paperDoll property to be the transformation texture, so it can still run push the transformation as the paperdoll layer and then setup the proper background names and properties for your custom backgrounds . However, traditional transformation doesn't work the same as the paperDoll because you don't equip or change any load outs stuff when transformed.

Right now, it completely ignores dealing with the paperDoll by just overriding the whole system with the default transformation texture. This is because how the paperDoll works. The paperDoll is continually updating based on equipment and so on. When transformed, there is no need for this, so I don't know how this would work with the paperDoll system.

It would help to have all of the mod contents in a zip, so I can see how they are working. Send it my way. It's doable, we just need to put in some form of a trigger to force the paperDoll property to be the transformation texture and ignore the traditional paperDoll system that constructs the player paperDoll with equipment.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by l3lessed »

So this is exactly what is happening.

When you transform, the paperDoll renderer will completely hide the paperDoll, as there is no need to update or even waste the cycles on rendering and updating the paperDoll (In the code it even says it is cycle intensive, so it should only update when needed).

THis can be seen here in the PaperDoll.cs Object:

Code: Select all

   
           /// Only call when required as constructing paper doll image is expensive.
           ...
            
            // Racial override can suppress body and items
            bool suppressBody = false;
            RacialOverrideEffect racialOverride = GameManager.Instance.PlayerEffectManager.GetRacialOverrideEffect();
            if (racialOverride != null)
                suppressBody = racialOverride.SuppressPaperDollBodyAndItems;
After this, your custom background manager loads up the transformation backgrounds with the pre-rendered paperDolls baked in. As a result, there is no built in way to easily do this. As said, we need to do the following.
  • Find a way to either setup a new paperDoll UI object using your custom cut out transformation textures and then push them as the paperDoll. This I know is doable from my work on Outfit Manager
  • Or, find a way to override the current paperDoll routine or texture property, and ram in your changed transformation textures. I'm currently not seeing any publicly accessible properties or objects to allow this though.
The code flow would be this.
Your transform -> paperDoll renderer hides your paperDoll -> checks for custom background -> finds it and updates it -> *checks that your transformed and pushes in transformation paperDoll* -> refreshed UI should render as wanted.

The hard part is changing the paperDoll. I'm not seeing any clear public accessible routines or properties to just directly override or force in a custom paperDoll texture, so I can just push it through without extra coding. If there is no direct way to access and override the paperDoll, we can, like I said, duplicate the paperDoll property setup and then enable and disable it to show and hide our transformation paperDolls. I had to do some of this with my outfit manager UI in ways.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by King of Worms »

PREFIX: - THIS WAS SOLVED, EXPLANATION IN NEXT POST

After some testing before sending the files your way, it appears the script does not work, when its not packed with the HUD files in the DFMOD.

That might mean, that those two instances in which Ive previously gave you a feedback on the script changes results might have been a mistake. :oops: :oops: :oops:

Please give me some time to troubleshoot and test it, I need to test the previously proposed changes in different way (building a DFMOD with the changed script and see what happens)

Sorry for this halt and confusion Ive caused, I did not expect the script will not work when injected as a loose file. :roll:
Last edited by King of Worms on Fri Mar 05, 2021 12:33 pm, edited 2 times in total.

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by King of Worms »

Ok so after a lot of desperation, where the updated script even rendered my Unity tools to disappear from Unity completely Ive found out WHY..

And yes, its a typo in the code you posted on prev page. If this is removed back to default, everything works, even injecting script as a loose file
if (GameManager.Instance.PlayerEnterEonxit.IsPlayerInside && GameManager.Instance.PlayerEffectManager.GetRacialOverrideEffect() == null)
modVanillaName = "interior.IMG";
So what I will do now is, I will send you the loose files for HUD, and the original script WITHOUT any of the 2 changes we made. That will prevent any issue like this to interfere with progress. And I believe its all the files we need to work on this.

HERE IS THE HUD PART WITH THE SCRIPT:
https://mega.nz/file/j7ZmHZKB#f7PyrDR7x ... S8hOlgN8tI

The beast-form images are called BOAR00I0.IMG & WOLF00I0.IMG

Wolf IMG was roughly cut out the background. BOAR img is untouched.

The script file name is: TODBackgrounds.cs (its the only script there)

Save file in the wolf form was posted on a 1st page.

Its all packed in the IMG folder. Place this folder in the "...Streaming assets/textures" so the result is "...Streaming assets/textures/IMG"

That will load all the necessary files in the game, including the script.

IF you need any other files, information or anything, please let me know ;)

Thanks a LOT for your time I3lessed. Fingers crossed 8-)

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by l3lessed »

Ouch, so sorry about the typo in the code.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by l3lessed »

Looking at it real fast, I can see the biggest issue right away. The way the files are pulled is using an appended string, where he takes the default background variation name, appends a custom weather prefix on the end, and then uses that new combined string to grab the new custom backgrounds. Because the transformation background is a single set background, there is no comparative string to create and grab for loading your backgrounds.

So again, the best approach would be to keep the dynamic background system, completely remove the vanilla transformation override code, and then setup a custom paperdoll object to load whatever transformation textures you want to overlay as the last step of creating and refreshing the gui.

Give me some time. That approach isn't a quick line of code or two. I have to setup the custom paperDoll properties and objects, insure they are scaling properly, and then load the transformation textures without distorting them.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by King of Worms »

No worries about the typo :)
keep the dynamic background system, completely remove the vanilla transformation override code, and then setup a custom paperdoll object to load whatever transformation textures you want to overlay
That sounds like something which could really work.

No need to rush, Im not in any kind of hurry. Also, if it turns out to be too big time-sink for you - just say so and I will completely understand if you decide to scratch it. I respect your time, and other projects you work at at the moment.

If this ends just with the bug fix we did in a 1st step, its still a great result for me.

Thanks a lot! ;)

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by King of Worms »

Hi mate, so apparently Im a bit retarded as I guess Ive lost the latest version which worked.

This gets my head hurting, as Ive tried to make this work on my own and failed.

So what I need is only the basic FIX, not the fancy stuff with the dynamic background for the werebeasts - screw that. I only need this thing to work properly and Im done with it :lol:

I think the fix was this part?

if (GameManager.Instance.PlayerEnterEonxit.IsPlayerInside && GameManager.Instance.PlayerEffectManager.GetRacialOverrideEffect() == null)
modVanillaName = "interior.IMG";

and it had the red typo? So the correct spelling is this?

PlayerEnterOnExit ?

When I did that, it does not work. Im quite confused with it.
Unity gets this red error:
Assets\Game\Addons\My Mod\HUD & MENU\TODBackgrounds.cs(129,42): error CS1061: 'GameManager' does not contain a definition for 'PlayerEnterOnExit' and no accessible extension method 'PlayerEnterOnExit' accepting a first argument of type 'GameManager' could be found (are you missing a using directive or an assembly reference?)


Please, one last help :D
Thanks a lot.

User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Re: Pls help me debug this script for Dynamic Paperdoll Backgrounds

Post by DunnyOfPenwick »

Should be 'GameManager.Instance.PlayerEnterExit.IsPlayerInside'

Post Reply