GSGlobe Posted December 4, 2017 Share Posted December 4, 2017 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 autospell property SpellToCast01 autospell property SpellToCast02 autospell property SpellToCast03 autospell property SpellToCast04 autospell property SpellToCast05 autospell property SpellToCast06 autospell property SpellToCast07 automagiceffect property cooldown00 automagiceffect property cooldown01 automagiceffect property cooldown02 automagiceffect property cooldown03 automagiceffect property cooldown04 automagiceffect property cooldown05 automagiceffect property cooldown06 automagiceffect property cooldown07 autospell property OnDyingSpell autospell property OnDeathSpell autospell property BombFirst autoInt property Chance00 autoInt property Chance01 autoInt property Chance02 autoInt property Chance03 autoInt property Chance04 autoInt property Chance05 autoInt property Chance06 autoInt property Chance07 autoBool property TargetSelf00 autoBool property TargetSelf01 autoBool property TargetSelf02 autoBool property TargetSelf03 autoBool property TargetSelf04 autoBool property TargetSelf05 autoBool property TargetSelf06 autoBool property TargetSelf07 auto Perk Property PerkToAdd AutoMessage Property MyMessage AutoExplosion property BombExplosion autoExplosion 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) == falseGame.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) EndIfEndIfEndIf If !akCaster.HasMagicEffect(cooldown01) If R1 < Chance01 If TargetSelf01 SpellToCast01.Cast(akCaster, akCaster) Else SpellToCast01.Cast(akCaster, akTarget) EndIfEndIfEndIf If !akCaster.HasMagicEffect(cooldown02) If R2 < Chance02 If TargetSelf02 SpellToCast02.Cast(akCaster, akCaster) Else SpellToCast02.Cast(akCaster, akTarget) EndIfEndIfEndIf If !akCaster.HasMagicEffect(cooldown03) If R3 < Chance03 If TargetSelf03 SpellToCast03.Cast(akCaster, akCaster) Else SpellToCast03.Cast(akCaster, akTarget) EndIfEndIfEndIf If !akCaster.HasMagicEffect(cooldown04) If R4 < Chance04 If TargetSelf04 SpellToCast04.Cast(akCaster, akCaster) Else SpellToCast04.Cast(akCaster, akTarget) EndIf EndIfEndIf If !akCaster.HasMagicEffect(cooldown05) If R5 < Chance05 If TargetSelf05 SpellToCast05.Cast(akCaster, akCaster) Else SpellToCast05.Cast(akCaster, akTarget) EndIf EndIfEndIf If !akCaster.HasMagicEffect(cooldown06) If R6 < Chance06 If TargetSelf06 SpellToCast06.Cast(akCaster, akCaster) Else SpellToCast06.Cast(akCaster, akTarget) EndIf EndIfEndIf If !akCaster.HasMagicEffect(cooldown07)If R7 < Chance07 If TargetSelf07 SpellToCast07.Cast(akCaster, akCaster) Else SpellToCast07.Cast(akCaster, akTarget) EndIfEndIfEndIf 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) == trueGame.GetPlayer().RemovePerk(PerkToAdd)EndIf EndEvent Event OnDying(Actor akKiller) Actor TargetActor = GetTargetActor() OnDyingSpell.Cast(TargetActor, None) EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts