Jump to content

Spells do certain damage percentage % damage


bj3226

Recommended Posts

[The search bar on here on the forums for some odd reason currently don't work for me (I get 404 error for any search)]

 

I'm trying to make a script for a spell, and the script would have the spell do a certain percentage of damage (10% of health, 40% of health etc) to any enemy target that is struck by the spell projectile. I've done many Google searches, and unfortunately most of the post I found had scripts that where doing the opposite [enemies where doing certain percentages of damage to the player] And even more tragic, the useful scripts that I did find, that did exactly what I need my script to do are outdated (posted 4 years ago, etc) and they don't work with a copy/paste or re-arranging by me the newbieð(this is my first gaming pc) With google search, here's the most useful post i found posted back in 2012:

 

Scriptname testspell extends activemagiceffect{Spell removes all mana from the player and deals a %age of health damage to target}Actor Property player Auto HiddenFloat CurMagFloat TarHealth;EVENTS------------------------------------------------------------Event onEffectStart (Actor akTarget, Actor akCaster)player = akCasterCurMag = Player.GetActorValue("Magicka")TarHealth = akTarget.GetBaseActorValue("Health")if (akTarget.isHostiletoActor(player)) akTarget.DamageActorValue("Health", (TarHealth*0.50)) ; this damages the target health by 50% of base value. Change this from 0.01 (1%) to 1 (100%) player.DamageActorValue("Magicka", -CurMag); This gets the players current magicka value, and then subtracts that value from the playerendif EndEvent

 

Could someone please help me with this? Links to past topics with proper scripts, or a causally placed script here would be highly appreciated. I & future readers would owe you 1,000 thanks.

Edited by bj3226
Link to comment
Share on other sites

Never mind, I've figured it out :laugh: !! Below I have created a script that does 10% damage to any enemy at any level.

 

You can change this value on the lines: ((MaxHealth / 100) * 10). Change example: ((MaxHealth / 100) * 50) the damage to any enemy has been changed from 10% too 50% of there HP.

 

For any future readers, here's the script below:

 

Actor Target
Event OnEffectStart(Actor akTarget, Actor akCaster)
Target = akTarget
If Target.GetActorValuePercentage("Health") < 99999999
RegisterForSingleUpdate(1.0)
EndIf
EndEvent
Event OnUpdate()
Float CurrentPercent = Target.GetActorValuePercentage("Health")
Float CurrentHealth = Target.GetActorValue("Health")
Float MaxHealth = ((1 / CurrentPercent) * CurrentHealth)
Float DamageHealthAmount = ((MaxHealth / 100) * 10)
Target.DamageActorValue("Health", DamageHealthAmount)
RegisterForSingleUpdate(1.0)
EndEvent
Edited by bj3226
Link to comment
Share on other sites

  • 1 year later...

 

Never mind, I've figured it out :laugh: !! Below I have created a script that does 10% damage to any enemy at any level.

 

You can change this value on the lines: ((MaxHealth / 100) * 10). Change example: ((MaxHealth / 100) * 50) the damage to any enemy has been changed from 10% too 50% of there HP.

 

For any future readers, here's the script below:

 

Actor Target
Event OnEffectStart(Actor akTarget, Actor akCaster)
Target = akTarget
If Target.GetActorValuePercentage("Health") < 99999999
RegisterForSingleUpdate(1.0)
EndIf
EndEvent
Event OnUpdate()
Float CurrentPercent = Target.GetActorValuePercentage("Health")
Float CurrentHealth = Target.GetActorValue("Health")
Float MaxHealth = ((1 / CurrentPercent) * CurrentHealth)
Float DamageHealthAmount = ((MaxHealth / 100) * 10)
Target.DamageActorValue("Health", DamageHealthAmount)
RegisterForSingleUpdate(1.0)
EndEvent

 

Please, post that script as a mod on nexus. And i have an ideia for you: why don't you work more in this mod and add some changes like do certain percentage of damage to certain type of enemy. For example, you wouldn't want do 10% percent damage to a dragon, right? Dragons is more powerfull. And you wouldn't want to do 10% damage to a wolf too. You know what i mean?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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