[MOD]Ambidexterity Module (Shield Module Branch)

Show off your mod creations or just a work in progress.
Post Reply
l3lessed
Posts: 1405
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by l3lessed »

That's it. Thanks. Sorry, I'll post a fixed version without the particle system attempts.
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.

Legendoflight44
Posts: 9
Joined: Tue Oct 20, 2020 3:55 pm

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by Legendoflight44 »

Your welcome oh by the way when equipping from a shield to a bow the bow breaks the shield and will stay there forever without switching to something else like hands or a shortsword or a longsword for off-hand

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

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by l3lessed »

RGR, the equip states need some more fine tuning, so thanks for that heads up.

As for particle systems, I can't figure out how to get a system imported into the base build. I can't import prefabs, because they have to be compiled with the project, and there is no mod pipeline support for it, like the model prefabs.

So, I think it will have to be done through script, but then I run into my old problem, of the script not seeming to have the materials and shaders showing up in base engine.

Oh well, should just take a break from the particles and finish debugging this.
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.

Legendoflight44
Posts: 9
Joined: Tue Oct 20, 2020 3:55 pm

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by Legendoflight44 »

Ya just keep it in a working state as much as possible then when you know your ready fix the particles

Legendoflight44
Posts: 9
Joined: Tue Oct 20, 2020 3:55 pm

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by Legendoflight44 »

Actually l3lessed bows completely break the left hand and not just for using shields then swtiching to bows btw

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by TheLacus »

Ok, here some additional notes on how to handle particle systems (or any other component that uses a shader)

Prefab
Add the prefab to the list of mod assets. Then you can load it with Mod.Getasset().

Code: Select all

var ParticleSystemGo = mod.GetAsset<GameObject>(name);
var particleSystem = particlesGo.GetComponent<ParticleSystem>();
Script
l3lessed wrote: Mon Oct 19, 2020 9:06 pm Got the log.

There is a null value that is not allowed some where in the material setup code. I think might be the texture.

Here's the error:
ArgumentNullException: Value cannot be null.
Parameter name: shader
at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0
at ParticleConstructorClass.ParticleConstructor.setupMaterials (System.String ShaderName, UnityEngine.Mesh ParticleMesh, System.Boolean MaterialEmissions, UnityEngine.Color EmissionColor, UnityEngine.Color MaterialColor, UnityEngine.Texture2D ParticleTexture) [0x00006] in <f233e47184ae47ceb91934436e615592>:0
at ParticleConstructorClass.ParticleSystemContainer.sparkParticles (System.Single ParticleSize, System.Single ParticleLife, System.Single ParticleGravity, System.Single MinSparks, System.Single MaxSparks) [0x00129] in <f233e47184ae47ceb91934436e615592>:0
at AmbidexterityModule.AmbidexterityManager.Start () [0x00018] in <f233e47184ae47ceb91934436e615592>:0
A shader used by the particle system is probably not available. You can force a shader to be compiled with the mod if you include a material using that shader in the list of assets for the mod.

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

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by l3lessed »

I'll try that.

I didn't realize the GetAsset worked for things not listed on the forum tutorial about asset importing.

Would prefer importing the prefab, as it is easier to fine tune the particle system using prefabs and the editor, then doing it line by line via scripting and importing materials.
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: 1405
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by l3lessed »

So, do we need to refer to it by name once dropped into the mod and build?

My prefab is named Spark_Particles.

Like, so

Code: Select all

            ParticleSystemGo = mod.GetAsset<GameObject>("Spark_Particles");
            sparkParticles = ParticleSystemGo.GetComponent<ParticleSystem>();
I'm getting null referencing, even though the prefab and emissions material are showing up in the mod builder. It appears to be reading and grabbing the right material for the prefab.

However, when I compile and run, and use the above reference, which is correctly named, I get a null error. My prefab is named Spark_Particles.
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
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by TheLacus »

l3lessed wrote: Tue Oct 20, 2020 9:05 pm So, do we need to refer to it by name once dropped into the mod and build?

My prefab is named Spark_Particles.

Like, so

Code: Select all

            ParticleSystemGo = mod.GetAsset<GameObject>("Spark_Particles");
            sparkParticles = ParticleSystemGo.GetComponent<ParticleSystem>();
I'm getting null referencing, even though the prefab and emissions material are showing up in the mod builder. It appears to be reading and grabbing the right material for the prefab.

However, when I compile and run, and use the above reference, which is correctly named, I get a null error. My prefab is named Spark_Particles.
None of these two lines should throw a null reference exception, but they can return null. Please check which one of them is returning null.

If Mod.GetAsset() returns null it means the prefab you added has a different name or is missing entirely. If GetComponent() returns null it means the prefab doesn't have that component; maybe the prefab is nested and the component is on a child.

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

Re: [MOD]Ambidexterity Module (Shield Module Branch)

Post by l3lessed »

Thanks for all the information. You're always amazing with it.

The error is directly on the getasset line, so it is not finding the prefab for some reason. I know I'm just being short sighting and overlooking something about the compile process.

Should the prefab be in any specific director before compiling the mod? I have tried it in the resource/prefab folder and in the folder where the mod script files are.

I also believe it is missing, because is shows none in the object window in the editor script object. And, it doesn't show anywhere in the scene or scene directory search.

But, it seems to be compiling it. Also the particle system, it shows as a component of the prefab.

And, it doesn't seem to be nested. The prefab has the gameobject in it with the particle system component attached to it. I created the prefab directly from a particle system object.
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.

Post Reply