[Mod] Physical Combat And Armor Overhaul

A curated forum for compatible and maintained mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

Alright I got your PM, will have to read through this a few times to see if I can figure out this simple thing that my brain is making seem complex, lol.

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

Re: [Mod] Physical Combat And Armor Overhaul

Post by l3lessed »

Once you drop my script into your untiy build so it is part of the project, just add this namespace to the top of your script, like so.

Code: Select all

using FPSShieldModule;
Now, your script is connected to my script and all its namespace class objects and properties.

Now you can easily access all my public objects and properties, like so:

Code: Select all

FPSShieldModule.FPSShield.isBlocking = ;
The code block has them all setup, you just need to ensure proper object referencing now. You can see my object references in the block:

Code: Select all

            //--->SHIELD MODULE ADDITION<---\\
            //checks to see if player is blocking yet and if the target is the player. If so, assign damage to attackerDamage, enemy object to enemyEntity, and
            //0 out the damage, so player doesn't take any.
            if (FPSShield.isBlocking == true && target == GameManager.Instance.PlayerEntity && (FPSShield.shieldStates == 1 || FPSShield.shieldStates == 2) && damage != 0)
            {
                //grabs attackers sense object.
                EnemySenses attackerSenses = attacker.EntityBehaviour.GetComponent<EnemySenses>();

                //uses attackers sense to figure out their direction to target using their position data.
                Vector3 toTarget = attackerSenses.PredictedTargetPos - attackerSenses.transform.position;
                toTarget.y = 0;

                //grabs players main camera object and sets up player direction using the camera object.
                Vector3 targetDirection2D;
                Camera mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
                targetDirection2D = -new Vector3(mainCamera.transform.forward.x, 0, mainCamera.transform.forward.z);

                //if the attack angle is shield block angle degrees or more (player does not have them on screen) don't register the block.
                if (!(Vector3.Angle(toTarget, targetDirection2D) > FPSShield.blockAngle))
                {
                    FPSShield.isHit = true;
                    FPSShield.attackerDamage = damage;
                    damage = 0;
                    FPSShield.enemyEntity = attacker;
                }
            }

            return damage;
At this point, duplicate your formula routine, rename the routine so its unique, drop in my small code block right before the damage return at the end of the formula, ensure proper object referencing, then call that as the override when my mod is detected or the user selects a setting in your mod settings to enable it.

At that point, when your mod loads after mine, it should override my formula with yours and attach my FPSShield script and its objects/properties to your script/mod using the namespace you setup.
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
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

I think this is a show instead of tell sort of thing, because i'm not really getting what part needs to be added under which method. My mod only has that one script doing everything, so maybe you can edit the bits you are referencing and shoot that script back to me on drop-box or make a PR on my mod's Github page? The "using" part seems to have worked as well, but when I try to reference some of your objects it seems to think they don't exist in my environment.

Also, unless i'm packaging your FPSShieldModule script with the namespace reference inside my mods final "package" of files, I don't think this would work otherwise right? Since as soon as the reference file for the namespace is gone that "using" line will throw a compile error.

https://github.com/magicono43/DFU-Mod_P ... r-Overhaul

User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

I'll try something else actually. Instead of doing the "using" part which would require your mod files to be present at building. I'll do the "mod detection" method Ralzar did for my mod and RPR:items and just directly reference your mod's objects where necessary ONLY IF your mod has been detected along with mine in the same mod list.

User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

Alright, so I see how this would work, but the only way I could see this working in this current form is if I also include your "FPSShield.cs" script inside my mod's bundle of files when I build it. Which seems like a sort of messy way to have to do this, unless I am missing something here? Because otherwise as soon as I remove your script from the bundle it will have compile issues in the code using references from your script and the namespace.

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

Re: [Mod] Physical Combat And Armor Overhaul

Post by l3lessed »

You shouldn't need to be using my script file. That is the point of calling my name space. Once my mod loads into the engine, it will load my namespace first. Then your mod will load, and then load my name space, then call my script and its properties.

You should be able to compile without my script. Load my mod first, load your mod second, and then it should work. You just need to ensure it enables the proper formula override/the new one you made just for the patch.

Could you send me your compiled version with the script files, and I will check to see if I'm correct.

As of now, I realized, you have no way of checking if the compiled version works without using my base script file. You need the newest version of my compiled mod, which I never gave you.

If it doesn't work, I'll see if I can sort it out for you and shoot it back to you.
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
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

l3lessed wrote: Fri Jul 03, 2020 10:04 pm You shouldn't need to be using my script file. That is the point of calling my name space. Once my mod loads into the engine, it will load my namespace first. Then your mod will load, and then load my name space, then call my script and its properties.

You should be able to compile without my script. Load my mod first, load your mod second, and then it should work. You just need to ensure it enables the proper formula override/the new one you made just for the patch.

Could you send me your compiled version with the script files, and I will check to see if I'm correct.

As of now, I realized, you have no way of checking if the compiled version works without using my base script file. You need the newest version of my compiled mod, which I never gave you.

If it doesn't work, I'll see if I can sort it out for you and shoot it back to you.
Yeah I don't know, as I've tried at least it does not seem that my mod's script can compile with the code necessary to be added without having your script inside the build as well. At least if I take your script out of the Unity environment, it will throw compile errors of "does not exist" for anything referring back to your namespace. But yeah, if I DO build with your script in the environment, but not inside the mod bundle, I still would not be able to check if it's actually working with your mod as you said without your full mod as well.

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

Re: [Mod] Physical Combat And Armor Overhaul

Post by l3lessed »

K let me copy and paste your code and see if I can get it going.
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: 1403
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Physical Combat And Armor Overhaul

Post by l3lessed »

Okay, done. Recreated your script file, built my a new unique CalculateAttackDamage object using above code blocks, put in a mod setting for player to enable this formula after the others so it overrides them, and done.

I created a second formula named "CalculateAttackDamageShieldPatch", so, if you change yours, you have a base to compare it with. Just ensure to copy the changes over when you update your formula.

I sent you the completed script file. You can either copy and paste the code or just change the file name I gave it.

*Edit*

Here is the link so other modders can hopefully better understand the process for patching into my mod.

https://www.dropbox.com/s/56galqnv84g7j ... ch.cs?dl=0
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
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: [Mod] Physical Combat And Armor Overhaul

Post by Magicono43 »

l3lessed wrote: Sat Jul 04, 2020 2:17 am Okay, done. Recreated your script file, built my a new unique CalculateAttackDamage object using above code blocks, put in a mod setting for player to enable this formula after the others so it overrides them, and done.

I created a second formula named "CalculateAttackDamageShieldPatch", so, if you change yours, you have a base to compare it with. Just ensure to copy the changes over when you update your formula.

I sent you the completed script file. You can either copy and paste the code or just change the file name I gave it.

*Edit*

Here is the link so other modders can hopefully better understand the process for patching into my mod.

https://www.dropbox.com/s/56galqnv84g7j ... ch.cs?dl=0
Thanks for making this example version, I now see what you meant by making a new name and method. However, I think the issue I was talking about still stands, where if I try to build this into a .dfmod file WITHOUT your mod's base script included, or in the environment being built in, that it won't function, at least from what i'm seeing here. Where I have your TestingPatch.cs file in my environment, and not having your namespace file inside of this environment, it brings up these errors on any objects referencing your mod's namespace.
Untitled.png
Untitled.png (484.54 KiB) Viewed 2316 times
So if i'm seeing this right, if I ever wanted to update/rebuild my mod again with this patch my environment would always need a copy of your namespace as well, which seems messy if that's the case. Maybe you can try and build this "testingpatch.cs" into a .dfmod and show where I am mistaken, because i'm still not seeing how this is supposed to work in terms of the building part, unless I always include your namespace file as well.

Post Reply