Jump to content

[LE] Is this script considered bad, ways to improve it?


GSGlobe

Recommended Posts

Hey, I'm guessing this script here is quite badly written and I'm looking for ways to improve it.

 

Would using a formlist perhaps with a randomint get the job done better? Now every spell has a chance to proc by the % I set in properties and won't cast again if I have a certain magic effect, I tried to put this magic effect on the spell itself being cast but that didn't really stop it from being cast and I'm unsure of why so I put it in this script instead.

 

The way I had it before was Spell A (Magic Effect A) "Script" once this spell fires, this spell in turn fires a cooldown spell with a duration and on Magic Effect A I would condition it as such "HasMagicEffect "Cooldown" == 0 however didn't work and I could repeatedly proc this spell.

 

Either way, would anyone be so kind to have a look here and tell me a way to improve it further? This script is attached to a MagicEffect set to "Contact" and this in turn linked to a enchantment. The enchantment would then have a chance to proc different spells upon hitting a enemy with it, quite fun to play around with ingame but I'm worried this script is half assed and I want to improve it, dump all spells in formlist with a randomint? How do I tackle the cooldowns so not a spell procs more than once "often" or does this script work okay?

 

I'm abit worried, help?

 

 

Scriptname EoS_Proc_Script extends activemagiceffect

;-- Properties --------------------------------------
spell property SpellToCast00 auto
spell property SpellToCast01 auto
spell property SpellToCast02 auto
spell property SpellToCast03 auto
spell property SpellToCast04 auto
spell property SpellToCast05 auto
spell property SpellToCast06 auto
spell property SpellToCast07 auto
magiceffect property cooldown00 auto
magiceffect property cooldown01 auto
magiceffect property cooldown02 auto
magiceffect property cooldown03 auto
magiceffect property cooldown04 auto
magiceffect property cooldown05 auto
magiceffect property cooldown06 auto
magiceffect property cooldown07 auto
spell property OnDyingSpell auto
spell property OnDeathSpell auto
spell property BombFirst auto
Int property Chance00 auto
Int property Chance01 auto
Int property Chance02 auto
Int property Chance03 auto
Int property Chance04 auto
Int property Chance05 auto
Int property Chance06 auto
Int property Chance07 auto
Bool property TargetSelf00 auto
Bool property TargetSelf01 auto
Bool property TargetSelf02 auto
Bool property TargetSelf03 auto
Bool property TargetSelf04 auto
Bool property TargetSelf05 auto
Bool property TargetSelf06 auto
Bool property TargetSelf07 auto
Perk Property PerkToAdd Auto
Message Property MyMessage Auto
Explosion property BombExplosion auto
Explosion property ReExplosion auto
;-- Event ---------------------------------------
Event OnEffectStart(Actor akTarget, Actor akCaster)
akTarget.placeatme(ReExplosion, 1, false, false)
BombFirst.cast(akCaster,akTarget)
MyMessage.Show()
If Game.GetPlayer().HasPerk(PerkToAdd) == false
Game.GetPlayer().AddPerk(PerkToAdd)
EndIf
Int R0 = Utility.RandomInt(0,99)
Int R1 = Utility.RandomInt(0,99)
Int R2 = Utility.RandomInt(0,99)
Int R3 = Utility.RandomInt(0,99)
Int R4 = Utility.RandomInt(0,99)
Int R5 = Utility.RandomInt(0,99)
Int R6 = Utility.RandomInt(0,99)
Int R7 = Utility.RandomInt(0,99)
If !akCaster.HasMagicEffect(cooldown00)
If R0 < Chance00
If TargetSelf00
SpellToCast00.Cast(akCaster, akCaster)
Else
SpellToCast00.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown01)
If R1 < Chance01
If TargetSelf01
SpellToCast01.Cast(akCaster, akCaster)
Else
SpellToCast01.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown02)
If R2 < Chance02
If TargetSelf02
SpellToCast02.Cast(akCaster, akCaster)
Else
SpellToCast02.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown03)
If R3 < Chance03
If TargetSelf03
SpellToCast03.Cast(akCaster, akCaster)
Else
SpellToCast03.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown04)
If R4 < Chance04
If TargetSelf04
SpellToCast04.Cast(akCaster, akCaster)
Else
SpellToCast04.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown05)
If R5 < Chance05
If TargetSelf05
SpellToCast05.Cast(akCaster, akCaster)
Else
SpellToCast05.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown06)
If R6 < Chance06
If TargetSelf06
SpellToCast06.Cast(akCaster, akCaster)
Else
SpellToCast06.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
If !akCaster.HasMagicEffect(cooldown07)
If R7 < Chance07
If TargetSelf07
SpellToCast07.Cast(akCaster, akCaster)
Else
SpellToCast07.Cast(akCaster, akTarget)
EndIf
EndIf
EndIf
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
akTarget.PlaceAtMe(BombExplosion)
if akTarget.IsDead() == 1 as Bool
OnDeathSpell.Cast(akCaster, none)
endIf
If Game.GetPlayer().HasPerk(PerkToAdd) == true
Game.GetPlayer().RemovePerk(PerkToAdd)
EndIf
EndEvent
Event OnDying(Actor akKiller)
Actor TargetActor = GetTargetActor()
OnDyingSpell.Cast(TargetActor, None)
EndEvent

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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