Jump to content

[LE] Changing a Weapon Enchantment shader Through Script


AslanKebab

Recommended Posts

Hello Everyone

 

In the past, I made a weapon that can switch between two different Magic effects depending on which hand has the weapon equipped.

Now, this is works through having a quest script hold a variable which is updated by the weapon script depending on which hand has the weapon equipped and the Enchantment has a condition which turns on one of two magic effects depending on which condition is met i.e the number assigned to the variable in the quest script.

 

Now, this is all well and good it works from a functional standpoint.

 

But the Enchantment shader that is visible on the weapon is the one that is tied to the first magic effect in the condition index list and does not change depending which hand is holding the weapon like applied weapons does.

 

Any idea where I should be looking?

 

 

Link to comment
Share on other sites

SKSE has a SetEnchantment function that you could use OnEquip depending on the which hand it is assigned to. Just split your enchanment into two. Without SKSE it's harder.

 

There's EffectShader.Play but you probably can't get a reference of the weapon being equipped- if such a one even exists.

 

You could look into creating two different weapons with each their enchantment - and then change which weapon is in the inventory and gets equipped OnEquip - but this would not be perfect either.

Link to comment
Share on other sites

Thanks for the Response,

 

Sadly I cannot make use of SKSE.

 

EffectShader.Play only seems to work on Actors as far I can see, While the shader is set from MagicEffect in the editor,

For example, WeaponShaderEffect.Play(DaggerMagiceffect) doesn't compile.

 

Having two weapons will probably fix the shader issue but need lots of workarounds to get it functional and won´t be clean....and the greatest issue would be trying to match amount charges left in the weapon for each incarnation of the weapon still without SKSE.....

 

I have tried both these solutions in the past and they ran me up the wall.

Edited by AslanKebab
Link to comment
Share on other sites

I am using one Enchantment consisting of two MagicEffects.

 

The Weapon contains the main script which updates a Quest variable.

 

Each Effect item in the Enchantment has a Condition that looks at the Quest variable to determine if the effect items should be active or not.

 

The Magic effects themselves do not have scripts attached to them.

 

I hope this clear and not confusing.

 

Could you please clarify where and how I would make use of GetEquippedItemType which is Actor script function?

Edited by AslanKebab
Link to comment
Share on other sites

In the enchantment. Open each of the effects and add the condition to each. Play around with it and see if the condition changes anything.

How can he use that function when it only checks the type of weapon equipped in each hand, not what the actual weapon form is? If Aslan's weapon is in left hand and another weapon of the same type is in the other hand, then both magic effects will apply when only the left-hand-effect should. Or am I missing something?

Link to comment
Share on other sites

Maybe Elias thought it would poke the magiceffect to update which the assigned Effectshader?

 

I tried it,

 

It mostly just breaks the Enchantment.

 

Having it before the GetQuestVMvariable breaks the left-hand MagicEffect while right-hand effect still works.

Having it after the GetQuestVMvariable breaks the MagicEffects for both hands.

 

Dosen´t help updating the shader, when the hands are switched.

Edited by AslanKebab
Link to comment
Share on other sites

 

In the enchantment. Open each of the effects and add the condition to each. Play around with it and see if the condition changes anything.

How can he use that function when it only checks the type of weapon equipped in each hand, not what the actual weapon form is? If Aslan's weapon is in left hand and another weapon of the same type is in the other hand, then both magic effects will apply when only the left-hand-effect should. Or am I missing something?

 

My thinking is to add a layer to the checks starting with that one. If it worked we could continue adding conditions.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...