MisterB1969 Posted August 26, 2016 Share Posted August 26, 2016 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 More sharing options...
lofgren Posted August 26, 2016 Share Posted August 26, 2016 Bonus to hit makes no sense in the context of Skyrim's combat system. Link to comment Share on other sites More sharing options...
thumbincubation Posted August 26, 2016 Share Posted August 26, 2016 *To my knowledge* no, not to hit. Most melee enchantments are for some form of damage boost, as is archery. Destruction magic enchantments are all about reduced casting cost, but one can make a damage enchantment by using the alchemy effect, instead of a magic effect. Link to comment Share on other sites More sharing options...
FrankFamily Posted August 26, 2016 Share Posted August 26, 2016 What is exactly "bonus to hit"? Link to comment Share on other sites More sharing options...
thumbincubation Posted August 26, 2016 Share Posted August 26, 2016 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. Link to comment Share on other sites More sharing options...
MisterB1969 Posted August 27, 2016 Author Share Posted August 27, 2016 (edited) 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 August 27, 2016 by MisterB1969 Link to comment Share on other sites More sharing options...
Elias555 Posted August 27, 2016 Share Posted August 27, 2016 Might work in earlier titles but every swing withing range that connects is a hit in Skyrim since it's part adventure genre. Not sure what a bonus would do. Maybe increased range. Link to comment Share on other sites More sharing options...
irswat Posted August 27, 2016 Share Posted August 27, 2016 (edited) 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 pseudocodefloat WeaponDmg = 0int HitChance=rand(1,100)if player.IsInCombatif ((HitChance>=80) && (HitChance<90))WeaponDmg=7elseif ((HitChance>=90) && (HitChance<95))WeaponDmg=10elseif ((HitChance>=95) && (HitChance<90))WeaponDmg=15endif; 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 August 27, 2016 by irswat Link to comment Share on other sites More sharing options...
FrankFamily Posted August 27, 2016 Share Posted August 27, 2016 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_Pointhttp://www.creationkit.com/index.php?title=Condition_Functionshttp://www.creationkit.com/index.php?title=Quest_Alias_Tabhttp://www.creationkit.com/index.php?title=Magic_Effecthttp://www.creationkit.com/index.php?title=Enchantmenthttp://www.creationkit.com/index.php?title=Category:Papyrushttp://www.creationkit.com/index.php?title=Variables_and_Propertieshttp://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) endEventWhen 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 More sharing options...
lofgren Posted August 27, 2016 Share Posted August 27, 2016 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 More sharing options...
Recommended Posts