Jump to content

Creating Magical Items for my Unique Loot Mod.


Recommended Posts

So for the past two days I have been trying to create a magical item, that grants a bonus to hit. But I think im starting to think, that the magic effects system wasn't really designed to give a magical weapon an enchantment that does this. Am I correct in this assumption? This has been frustrating me to no end.

Link to comment
Share on other sites

I took it as an old D&D reference, where whether you hit or not was subject to a die roll, and "to hit" bonuses increased your chance of even striking the target, before any damage was even factored.

 

Correct. But I'm starting to think, the only way to do this is with "Armor" . I've been working with every kind of permutation for the effect type without success.

But im wondering if I could create an effect that bypasses magnitude in armor rating instead which might help simulate that to a point.

Edited by MisterB1969
Link to comment
Share on other sites

Not sure as I'm just getting into skyrim scripting myself.

Could you make an enchantment with a script that makes weapon damage 0, but applies weapon damage dynamically based on a random() function?

for example some pseudocode

float WeaponDmg = 0
int HitChance=rand(1,100)

if player.IsInCombat
if ((HitChance>=80) && (HitChance<90))
WeaponDmg=7
elseif ((HitChance>=90) && (HitChance<95))
WeaponDmg=10
elseif ((HitChance>=95) && (HitChance<90))
WeaponDmg=15
endif

; By default the weapon will miss. These numbers give you a 20/100 chance of a hit, which should probably be more like 85/100, but you get the point.

;then dynamically set weapon damage.
Weapon PlayerWeapon = Game.GetPlayer().GetEquippedWeapon()
PlayerWeapon.SetBaseDamage(PlayerWeapon.GetBaseDamage() * 2)



maybe?

or maybe you can try messing with the SetWeapRangeMin/Max functions.

or you could use a similar random function and apply something like ethereal for a fraction of a second to simulate a miss.

Edited by irswat
Link to comment
Share on other sites

I see, so to have "bonus to hit" enchantment you would first need to make a "chance to miss" calculated on every hit. So, for example make it so that 80% of the hits are successful, the rest misses. And then you make the bonus to hit enchantment.

 

You are going to need perks to do it properly and safely, so unless you make a patcher or something like that it is not going to work for NPCs, just for the player. Since you can't add perks on the fly to npcs. That said it shouldnt be very complicated.

 

Relevant wiki pages:

http://www.creationkit.com/index.php?title=Perk_Entry_Point

http://www.creationkit.com/index.php?title=Condition_Functions

http://www.creationkit.com/index.php?title=Quest_Alias_Tab

http://www.creationkit.com/index.php?title=Magic_Effect

http://www.creationkit.com/index.php?title=Enchantment

http://www.creationkit.com/index.php?title=Category:Papyrus

http://www.creationkit.com/index.php?title=Variables_and_Properties

http://www.cipscis.com/skyrim/tutorials/beginners.aspx

 

Given it only works for the player this would be a way to do it.

 

1/ Creating the global (float) that stores your current chance to miss

- Make a global variable and give it a default value depending on the chance you want, it will be the chance to miss, not the chance to hit. So for example 20.

 

One limitation is that you cannot really add new actor values to store the "chance to hit" and fortify it with enchantments. There are a couple of workarounds to this involving adding tokens, using factions ranks, for this i think a global variable should work.

 

2/ Create the perk that applies the global chance to hit (to the player):

- Make a perk using "Calculate Weapon Damage" perk entry setting to 0, conditioned by "GetRandomPercent" with "<=", "use global" ticked and point it to the global above.

- Make a constant self magic effect linking to your perk trough the "Perk to apply" drop down menu.

- Make an ability spell (constant self as above) containing the previous magic effect, this is the perk holder to call it something.

 

3/ Giving the perk to the player:

- Make an empty start-game-enabled quest

- Within it make a player alias and give the alias the perk holder spell

 

This all makes it so that in every player attack it checks the global and compares to a random number, if random <= global it makes the damage 0.

 

4/Now create the enchantments that reduce the chance to fail

 

its important to note that weapon enchantments in skyrim are offensive, they are applied to the target. While armor/clothing enchantments are passive and applied to the player. This effect would fit in an armor enchantment. If you want to give it to a weapon there are scriptless easy workarounds i've used in my artifact mods to add passive effects to weapons. Anyway, for armor:

 

- Make a magic effect (constant self, script archetype), this will be the effect of the enchantment. Give it logical magic school association, base value, description, flags, etc (see other enchantments for reference)

 

It would be nice to use magnitude here but then it would need skse to access magnitude within the script in order to apply thr changes to the global. So a papyrus property would handle that. For different magnitudes instead of a bunch enchantments and 1 magic effect you'd just need a bunch of both, the magic effects having different values on the property.

 

- Add a script to the magic effect:

Scriptname lalalaNameHere extends activemagiceffect

Float Property Magnitude Auto
GlobalVariable Property CustomActorValue Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
CustomActorValue.Mod(-Magnitude)
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
CustomActorValue.Mod(Magnitude)
endEvent

When the effect kicks in it reduces the glboal by its magnitude. A mag of 10 would mean that the default 20% chance of missing becomes 10%. When the instance of the effect ends it reverts its changes.

 

- Fill the property with the magnitude you want. And fill the globalvariable property too

- Make an enchantment and add the magic effect, then add the enchantment to the armor/clothing of choice.

 

------------------------------------------------------------------------------------------------------------------------

 

About adding passive effects to weapon, this is my way of doing it, simple, zero scripts.

 

- You make Magic effect called "PassiveEffect" for example, and spell (ability type) called "PassiveAb" for the passive effect.

- Then a Magic effect called "WeaponEffect", this is the offensive one that goes into the weapon's enchantment, "WeaponEnch", it can actually have any sort of offensive effect in addition to the passive. It's description should reflect the effects of the passive too.

- On "WeaponEffect", on the bottom there is a Equip Ability drop down menu, choose there "PassiveAb".

- Done. whenever the item holding "WeaponEnch" is equipped it addes "PassiveAb" (which contains "PassiveEffect"). It's removed properly afterwards and everything.

 

In addition, "PassiveEffect" could have a linked perk through its Perk To Apply menu, therefore adding the perk when the weapon is equipped.

 

Other ways to accomplish this such as OnEquip/OnUnequip events are unreliable.

 

In this case you'd add the scripted magic effect to an ability that would be the "PassiveAb" and then setup the rest.

 

Insomnia effects....

Link to comment
Share on other sites

Well hold up. Is OP aware that there is no such thing as a chance-to-hit in Skyrim?

 

That is to say, were you planning to completely rewrite the combat system, or were you just looking for a way to increase weapon damage through enchantments?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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