Shoneah0Tokala Posted November 13, 2020 Share Posted November 13, 2020 Hiya people, I Recently had the idea to rewrite my scripts so as to be usable with multiple magic effects, and take the player's perks and Action Points into account. To me this seems A lot more sensible than writing pretty much identical lines of code for every effect.The thing is, my scripting ability is all self taught or gained through conversation with other modders (more often than not the Papyrus Primer feels like gibberish to me) so I'm not certain if my current method is smarter, or just lazier. I also wonder about the performance impact my scripts will have on the game, So I was hoping you guys and girls could just take a poke around and let me know if I'm on the right track, or what you'd do differently in my place. Here's one of the original codes I was using: ScriptName SHSS_IceSkinActivatorScript extends activemagiceffectEvent Oneffectstart(Actor akTarget, Actor akCaster)If (akTarget == Game.GetPlayer() && akTarget.GetValue(ActionPoints) >= 50 as float)SHSS_DmgAPCloak.Cast(akTarget as ObjectReference, None)akTarget.PlayIdle(ThirdPUseStimpackOnSelf)Utility.wait(0.3)SHSS_IceSkinSpell.Cast(akTarget as ObjectReference, None)Utility.wait(0.2)akTarget.additem(SHSS_IceSkinSpellActivator as Form, 1, True)ElseakTarget.additem(SHSS_IceSkinSpellActivator as Form, 1, True)SHSS_FFNeedAPmsg.Show()EndIfEndEventIdle Property ThirdPUseStimpackOnSelf Auto Const ;it turns out I can't call on this anim as an idle, so I switched it out for another.Potion Property SHSS_IceSkinSpellActivator Auto ConstSpell Property SHSS_IceSkinSpell Auto ConstSpell Property SHSS_DmgAPCloak Auto ConstActorValue Property ActionPoints Auto ConstMessage Property SHSS_FFNeedAPmsg Auto Const mandatory And then here's the rewrite: Scriptname SHSS_PwrCloakActivatorScript extends activemagiceffect Event Oneffectstart (actor akTarget, actor akCaster)If (akTarget.GetValue(ActionPoints) >= LowAP1) || (akTarget.HasPerk(Perk1) == True && akTarget.GetValue(ActionPoints) >= LowAP2) || (akTarget.HasPerk(Perk2) && akTarget.GetValue(ActionPoints) >= LowAP3) || (akTarget.HasPerk(Perk3) && akTarget.GetValue(ActionPoints) >= LowAP4)SHSS_DmgAPCloak.Cast(akTarget)akTarget.PlayIdle(JumpLand)utility.wait(0.3)CloakSpell1.Cast(akTarget)utility.wait(0.2)akTarget.additem(CloakSpellActivator1, 1, true)ElseakTarget.additem(CloakSpellActivator1, 1, true)SHSS_msgNeedAP.Show()EndIfEndEvent Potion Property CloakSpellActivator1 Auto constSpell Property CloakSpell1 Auto constSpell Property SHSS_DmgAPCloak Auto const ;Should I bother with this spell, or call "akTarget.DamageAV("ActionPoints", 50.0)" instead?Perk Property Perk1 Auto constPerk Property Perk2 Auto constPerk Property Perk3 Auto const Idle Property JumpLand Auto const MandatoryActorValue Property ActionPoints Auto const MandatoryMessage Property SHSS_msgNeedAP Auto const Mandatory Float Property LowAP1 = 50.0 Auto constFloat Property LowAP2 = 40.0 Auto constFloat Property LowAP3 = 25.0 Auto constFloat Property LowAP4 = 10.0 Auto const As stated before, the latter method is far easier and quicker. And to my untrained eyes it looks like the smarter solution, but clarification would be much appreciated. As for my questions about AV's, I've put together a custom Actor Value that I'm planning to use a great deal later down the line, unfortunenately I can't find a way to increase it's total Value in game without papyrus.eg. the AV starts at 0, player has 2 chems with "Value Modifier" & "Peak Value Modifier" Archtypes attached to them and a Magnitude of 5 on each. I reckon one of those should have increased my AV to 5, the problem is that nieither of those effects actually do so. Inversely if I change the effect of the chem to Detrimental and flag the AV as "damage is positive" then use the chem in game my AV does increase as expected.If that last paragraph hasn't confused you in the slightest then you're the one I'm looking for :wink:Essentially what I want to accomplish with this AV is: AV will have a min of 0 and a max of 10,000, when the game starts AV is at 0 and by accomplishing certain tasks the AV will increase (similar to xp) and when the player Unlocks or Upgrades new Powers (the spells mention previously, Ice Skin etc) the Av will be decreased again by the specified amount. I could use "damage is positive" if I really need to but I'm worried that I'm going to trip myself up further down the line with this method (ResAV = DamAV, DamAV=ModAV....??). That's all I have for today, thanks in advance. Link to comment Share on other sites More sharing options...
Recommended Posts