Jump to content

[LE] Skyrim disease system overhaul


nikolaf

Recommended Posts

Hey all,

 

I've (re)made quite a few diseases from previous games and wonder if it is possible to have an enemy type be able to give you a random disease, with the leveled spell category or similar? I've thought of making different attacks transmit different diseases, for each race, but that isn't quite what I had in mind.

 

Something so that i.e. a skeever can give you any of the following when attacking: Bone Break Fever, Brain Rot, Crimson Plague, Red Rage, Shakes etc.

Link to comment
Share on other sites

Almost anything is possible with scripting. For what you're describing, you can put a script on an alias in a quest that points at the player and use the OnHit event. Something like this:

 

Scriptname RaceHitDiseaseScript extends ReferenceAlias
Spell[] Property SkeeverDiseases Auto ; array filled with potential diseases given by skeever, set in the CK
Race Property SkeeverRace Auto 
Actor Property PlayerRef Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)   
    If akAggressor as Actor 
        If (akAggressor as Actor).GetRace() == SkeeverRace && abHitBlocked == false 
            If Utility.RandomInt(0, 100) < 15 ;15% chance to contract disease 
                Int Index = Utility.Randomint(0, (SkeeverDiseases.Length - 1))
                PlayerRef.AddSpell(SkeeverDiseases[Index]) 
            Endif 
        Endif 
    Endif 
EndEvent

I'm not sure if for diseases you need to use AddSpell or SkeeverDiseases[index].Cast(PlayerRef, PlayerRef). You'd have to test that out.

Link to comment
Share on other sites

Yeah, scripts are usually the way to go, it seems.

 

Thanks, it should work perfectly, I'm also guessing I need to set it to Cast.() instead of AddSpell because adding them via console doesn't seem to work.

 

Oh one more thing, If you don't mind. I've made some ingredients that should give you a disease when eaten. How would I go about making the script for this function?

Link to comment
Share on other sites

I think the Onhit() solution might be a little costly in terms of performance.

One possible other solution if you are ok with editing the vanilla diseases:

Locate the disease spell of choice (for example ataxia for skeever) and then remove all magic effects and add a list of filter/placeholer magiceffects

 

Make the magic effect's type FireAndForget and set the duration to like 10 seconds or something

Then add a script to each magic effect such as

Scriptname DiseaseApplyFilterScript extends ActiveMagicEffect

Spell Property DiseaseToApply Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	akTarget.AddSpell(DiseaseToApply)
EndEvent

Fill the property of DiseaseToApply

DiseaseToApply will link to one of the actual diseases.

 

Then you can use conditions on these placeholder effects to your hearts content inside the spell tab or inside the magic effect tab of the filtereffect.

Use GetRandomPercent, GetRace, etc.

 

This approach is way more performant as it does't need the costly Onhit() Event and also you don't need multiple scripts or check every possible condition like race through the script. Just let the default condition system handle it for you.

Link to comment
Share on other sites

I was actually thinking that as well, onhit on the player isnât very performance friendly. I donât think you need to edit the vanilla diseases though. Another option is to add a cloak spell to creatures with a small radius, with the condition IsAttacking or something similar. Then put the script on the cloaks assoc item 1 spell with on effectStart. You could also add the cloak to creatures dynamically with a script when combat first starts. Just thinking out loud
Link to comment
Share on other sites

All of those suggestions are valid and lead to the desired result. Its just a question of what you (or OP in this case) want.
Direct edits are always gonna be faster than any dynamic solution but come at the cost of possible incompatibility.

 

Onhit() on player is very expensive and is best avoided when possible.

 

For cloaking it depends how expensive they are. They can be moderately cheap with proper management but can also be very expensive if the conditions are not waterproof or there are too many actors affected.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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