Jump to content

Scaling Enchantment Bonuses with Stats


Recommended Posts

Is it possible, via scripts or some other means, to have enchantment bonuses scale with a given stat rather than just be a flat rate? For instance, I have a spell that binds a Sword and Shield that have some various enchantments on them. Would it be possible to have those enchantments scale with my Conjuration skill? 

Link to comment

It certainly should be possible.  The vanilla game contains items that do this.  You would need to write a new script for that feature and then tie that script to your equipment.  I can't help you on the scripting as I am scripting ignorant for the most part.  :blush:

Link to comment

It certainly should be possible.  The vanilla game contains items that do this.  You would need to write a new script for that feature and then tie that script to your equipment.  I can't help you on the scripting as I am scripting ignorant for the most part.  :blush:

Do you know any of those items off hand (I've played precious little of Oblivion proper. Pretty much all my time has been spent messing around with mods)? If they use scripts, that I might be able to reverse-engineer what I need from them like I did for the scripting to bind the shield with eh sword and have them both un-bind with I sheath the sword. 

Link to comment
Guest ThatOne

The script you need should look something like this:

 

 

Scn YourScriptNameHere

 

ref Holder

 

begin OnEquip

set Holder to getcontainer

Holder.modav2 <Attribute> (Calculation)

end

 

Begin onUnEquip

Holder.modav2 <Attribute> (Calculation) // NOTE: This should be a reverse of the increase in the OnEquip line

OPTIONAL: Holder.remove <ItemBaseID> 1 // NOTE: This will cause the weapon to be removed from the holder's inventory, like vanilla summoned weapons.

end

 

 

I left the calculation out because I'm not sure what you want to put there. You should look around the net if you aren't sure what to type, or you can ask here with more specific details.

Link to comment

The script you need should look something like this:

 

 

Scn YourScriptNameHere

 

ref Holder

 

begin OnEquip

set Holder to getcontainer

Holder.modav2 <Attribute> (Calculation)

end

 

Begin onUnEquip

Holder.modav2 <Attribute> (Calculation) // NOTE: This should be a reverse of the increase in the OnEquip line

OPTIONAL: Holder.remove <ItemBaseID> 1 // NOTE: This will cause the weapon to be removed from the holder's inventory, like vanilla summoned weapons.

end

 

 

I left the calculation out because I'm not sure what you want to put there. You should look around the net if you aren't sure what to type, or you can ask here with more specific details.

Thank you so much. I would like to ask for more specifics on the calculation. For example, I have a shield that has reflect physical and magic damage. What would the script look like potentially if I wanted it to have a reflect 10% damage at 30 Conjuration and increase 1% ever 2 levels? Is that doable? 

Link to comment
Guest ThatOne

 

Thank you so much. I would like to ask for more specifics on the calculation. For example, I have a shield that has reflect physical and magic damage. What would the script look like potentially if I wanted it to have a reflect 10% damage at 30 Conjuration and increase 1% ever 2 levels? Is that doable? 

 

Eh, reflect specifically? Let me look up the proper ID for that one...

Here you go: http://www.uesp.net/wiki/Tes4Mod:Actor_Value_Indices

 

"ReflectDamage" is what it's called. So, the calculation will look something like this:

 

if Holder.GetActorValue Conjuration < 30

return //NOTE: this stops the script. That means that if the character has less than 30 in conjuration, s\he will not get any enchantment.

Else

Holder.ModActorValue ReflectDamage ((((Holder.GetActorValue Conjuration) - 30) / 2) + 10) //NOTE: I'm not entirely sure this line will work. Been a long time since I scripted something. If it does not work, you'll need a secondary variable. Set it to Holder.GetActorValue Conjuration beforehand, then just reduce it by 30.

endif

 

Link to comment

 

 

Thank you so much. I would like to ask for more specifics on the calculation. For example, I have a shield that has reflect physical and magic damage. What would the script look like potentially if I wanted it to have a reflect 10% damage at 30 Conjuration and increase 1% ever 2 levels? Is that doable? 

 

Eh, reflect specifically? Let me look up the proper ID for that one...

Here you go: http://www.uesp.net/wiki/Tes4Mod:Actor_Value_Indices

 

"ReflectDamage" is what it's called. So, the calculation will look something like this:

 

if Holder.GetActorValue Conjuration < 30

return //NOTE: this stops the script. That means that if the character has less than 30 in conjuration, s\he will not get any enchantment.

Else

Holder.ModActorValue ReflectDamage ((((Holder.GetActorValue Conjuration) - 30) / 2) + 10) //NOTE: I'm not entirely sure this line will work. Been a long time since I scripted something. If it does not work, you'll need a secondary variable. Set it to Holder.GetActorValue Conjuration beforehand, then just reduce it by 30.

endif

 

 

I get a few errors when I try to make the scripts. Here's the final script I made (I changed it to scale with Mysticism like the original spell):

 

 

Scn 00MedusaEnchantingScaling

 
ref Holder
 
begin OnEquip
set Holder to getcontainer
Holder.modav2 Mysticism if Holder.GetActorValue Mysticism < 30
return
Else
Holder.ModActorValue ReflectDamage ((((Holder.GetActorValue Mysticism) - 30) / 2) + 10)
endif
end
 
Begin onUnEquip
Holder.modav2 Mysticism if Holder.GetActorValue Mysticism > 30
return
Else
Holder.ModActorValue ReflectDamage ((((Holder.GetActorValue Mysticism) + 30) * 2) - 10)
endif
 

end

 

 

And here are the errors: 

 

Line 6: Unknown variable or function 'modav2'

 

Line 6: Holder.modav2 Mysticism if Holder.GetActorValue Mysticism < 30

Could not parse this line

 

Line 5: Mismatched begin/end block starting on line 5

 

Line 5: Mismatched begin/end block starting on line 5

 

 

Anyone have any insight into what I am doing wrong? 

Link to comment

Make sure you are using OBSE to start the cs:

 example shortcut target- C:\Somesubdirectory\Bethesda Softworks\Oblivion\obse_loader.exe" -editor

 

Check the CSwiki page on the If statement. It starts a block and does not work in the middle of a statement.

 

Possible future error? watch for division by zero.

 

Mem

Link to comment
Guest ThatOne

You forgot the "If" statement.

Also, like mem4ob4 said, you need to use OBSE to use the modav2 command. If you don't want to use the OBSE CS, you can use ModActorValue instead.

 

As for division by zero... Not seeing it. Worst case, at thirty conjuration it's 0/2+10, and there should be no problems with that.

 

Also, make sure your reverse calculation is correct. Haven't checked it, just putting it here because otherwise you'll get permanent bonus\reduction reflect each time you equip and unequip your shield.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use