Jump to content

[LE] Need help with a script that Get Incoming Damage !


HydroBirous

Recommended Posts

Hello I,m just start modding. I made a mod named ManaShield which direct damage into Magicka instead of Health but I didnât feel satisfied because I get the damage by subtract the Health after and before PlayerGeHit. That script needs OnUpdate event which quite heavy. I have searched on many sites but look like there is no avaiable script like that. I have use a script from UchihaClan mod ( which quite large but not heavy ) to calculate incoming physical damage but it seemed not accurry as I expected. So, if you guys have some scripts that calculate incoming damage, please share it ! I will be appreciate !!!
Link to comment
Share on other sites

  • 9 months later...

I'm interested in this as well... Necro loving this thread lol...

I can't help with a more efficient script but I'd do it in a shifty way by having a constant regen health set to 1000(so fast that the health won't go down to damage) and set the health to 1000 to ensure that any damage taken will be the equivalent to 1 pixel. What are you planning to make?

Link to comment
Share on other sites

 

 

 

 

I'm interested in this as well... Necro loving this thread lol...

I can't help with a more efficient script but I'd do it in a shifty way by having a constant regen health set to 1000(so fast that the health won't go down to damage) and set the health to 1000 to ensure that any damage taken will be the equivalent to 1 pixel. What are you planning to make?

 

 

 

 

I'm just starting to learn to script tbh. The incoming damage script is something I'm trying to get my hands on so I can make custom spells. I'd like to create my own wards that absorb X amount of damage before being destroyed. Blood magic is a style I haven't tried but I could see myself doing a berserker blood mage some day. Playing a heavy armor build with very little MP, lots of HP, destroying my enemies by casting blood magic and battering them with war hammers. Not usually my style, but sounds fun af.

 

I touched creation kit for my first time last week because I was really unhappy with how some spells from mods worked within my game. Some spells were too OP so I toned them down. Others had great concepts but were very unpolished, weak, or imbalanced in some way.

 

Now, I suck at this, but I'm spending soooo much time with CK syntax/coding.

 

I need to figure out the most efficient methods to do things, but first of all just how to do things at all lol.

 

Here's one script I was proud of when I wrote. It's a cool down script with a variable cooldown time depending on the skill level of the skill you want to mod the cool down!

 

 

Scriptname ZZYYCooldownScriptGeneric extends activemagiceffect
 
GlobalVariable Property ZZYYglobalValue Auto
;this variable will determine if you can cast the spell again or not...
;Add this global variable to your magic effect conditions and set it to one by default.
 
Actor Property PlayerRef Auto
float ReductionBoost
float TotalCoolDown
float CDmod
float ReductionBoostPercent
float skillLevel
float fifty
float magicka
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
 
magicka = PlayerRef.GetActorValue("Magicka")
 
skillLevel = PlayerRef.GetActorValue("Restoration")
ReductionBoostPercent = 0
; if you want to make an equation with percentages ReductionBoostPercent could be written
;into an equation instead of using the TotalCoolDown -= CDmod method
 
TotalCoolDown = 260 ; this would be the cooldown of your spell if skill level is under 10.
 
CDmod = ;define a cooldown amount to be subtracted every 10 levels from TotalCoolDown
 
If skillLevel >= 10
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 20
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 30
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 40
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 50
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 60
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 70
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 80
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 90
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
If skillLevel >= 100
ReductionBoostPercent += 10
TotalCoolDown -= CDmod
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
 
Debug.notification("Spell cooldown " + TotalCoolDown + " seconds")
ZZYYglobalValue.SetValue(0)
Utility.Wait(TotalCoolDown)
ZZYYglobalValue.Setvalue(1)
Debug.Notification("Spell Ready")
 
EndEvent

 

 

 

There's probably a more effecient way to do it, and I was working on putting other ways to do it, but this was so easy. I did it in increments of 10 so that there's only 10ish stages/variables for the TotalCoolDown. I could have done it 100 times to get all values from lvl 0-100 of a skill, but I'm not sure if putting that many (100+) If EndIf events in my script would be bad.

 

I still have little knowledge of script effects on game except for how effed up my game gets when there's too many scripts.

 

I want to set either an item toggle, a potion, or a spell that can be used once a day, to reset all my YYGlobals to 1, just in case one of my count down ends one day before the script ends before setting the globals back to 1. If the global gets stuck at 0 the spell will not be castable at all, like ever lol.

 

The way I'd prefer to do this is by starting an event on game loadup to reset all the global values to 1 of all spells. I was reading that this is possible but I haven't got there yet.

 

I just hope all the work I'm putting into this old ass game will pay off on the next TES game when ever tf it finally comes out.

 

/end rant

 

this is fun

Link to comment
Share on other sites

Since you want the boost percent to go up by 10 pts for every skilllevel that is divisible by 10, you can try something like this:

Function setReductionBoostPercentage()
    ; For those using the uncapper and have skill maxes set higher than 100.
    if (skilllevel > 100.0)
        reductionBoostPercent = 100.0
        return
    endif
 
    ; otherwise set the boost according to the skill level with in a range that is divisible by 10.
    reduceBoostPercent = (Math.Floor(skillLevel / 10.0) * 10.0)
EndFunction

This should replace all those if checks, and will instead update the percentage whenever the skill raises and is divisible by 10, when the event is called. So..

 

Default 15 skill = 10 pts

Default 25 skill = 20 pts.

etc..

 

This is assuming the expected maximum percentage is 100, thereby meaning a skilllevel of 100 = reductionBoostPct of 100%.

 

This is not "field" tested, only tested for correct value returns.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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