Jump to content

[LE] Noob papyrus questions


candlepin

Recommended Posts

If anyone has time, could you take a look at my Resist Paralysis script? In particular, I'm wondering about my Update time; is 0.1 too frequent? I'm also not sure about how the script would handle multiple paralyze effects; what happens to a paralyzed player when they are hit with another paralyze effect? Do they concatenate? Does the new effect replace the old effect? Does the new effect get ignored since they are already paralyzed? As-is, my script will only handle the last case.

 

I'll give a try tonight, but I'm always open to input to make it better/work. Any input is appreciated!

 

 

 

Scriptname CP_ResistParalysisScript extends activemagiceffect
{Script for actor to resist paralysis}
Actor Property akTarget auto
Bool Property ResistAttempted = false auto
Event OnEffectStart(Actor akCaster, Actor akTarget)
RegisterForSingleUpdate(0.1)
EndEvent
Event OnEffectFinish(Actor akCaster, Actor akTarget)
UnregisterForUpdate()
EndEvent
Event OnUpdate()
If akTarget.GetAV("Paralysis") != 0 ;if akTarget is paralyzed
If ResistAttempted == false
ResistAttempted = true ;so that this will only be checked once per paralysis
Float Mag = Self.GetMagnitude()
Float RandomNumber = Utility.RandomFloat(0, 100)
If Mag >= RandomNumber
akTarget.SetAV("Paralysis", 0)
ResistAttempted = false ;so that if the actor gets paralyzed again during the magic effect, they will
;attempt to resist future paralysis effects (for the duration of the effect)
EndIf
EndIf
ElseIf akTarget.GetAV("Paralysis") == 0
ResistAttempted = false ;so that if an actor's paralysis ends naturally, they have a chance to resist
;future paralysis effects (for the duration of the effect)
EndIf
RegisterForSingleUpdate(0.1)
EndEvent

 

 

 

Edited by candlepin
Link to comment
Share on other sites

  • Replies 89
  • Created
  • Last Reply

Top Posters In This Topic

what happens to a paralyzed player when they are hit with another paralyze effect? Do they concatenate? Does the new effect replace the old effect? Does the new effect get ignored since they are already paralyzed? As-is, my script will only handle the last case.

 

They stack independently. If you keep casting it again before the previous stack expired, it keeps the target paralysed for the entire time.

Link to comment
Share on other sites

I look at your Script and went no way is that going to work, what would I do? i came up this

Scriptname ResistParalysisScript extends activemagiceffect  

Spell Property ParalysisDispell Auto ; Custom spell design to dispel Magic Effect with the Keyword "MagicParalysis"
Keyword Property MagicParalysis Auto
Actor Target
Bool IsUpdating = false
 
Event OnEffectStart(Actor akCaster, Actor akTarget)

    If(akTarget == Game.GetPlayer() && !IsUpdating)
        Target = akTarget
        IsUpdating = true
        RegisterForSingleUpdate(2)
    EndIf    
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

    IsUpdating = false
EndEvent
 
Event OnUpdate()

    Int nIndex = 7        ; a loop of lucky # 7 for Stacking Effects
    While(Target.HasMagicEffectWithKeyword(MagicParalysis) && nIndex)
        nIndex -= 1
        ParalysisDispell.Cast(Target, Target)
    EndWhile
    RegisterForSingleUpdate(1)
EndEvent

but then came the testing for Function bit, and I really didn't want to take it any further, so feel free the script is yours. The loop should counter any stacking effect, it design to short the effect has much as possible, not magically shrug it off. I expect the player to a least fall to the ground.

 

If your script works & works well I am very happy to be proven wrong. :thumbsup:

 

Anywho Good Modding

 

PS Also I only use the loop cause Stacking was mention in an above post, It may not be necessary. Like I said not test for Function, but I can't see a problem with not working, except user.(sorry don't mean to offend)

 

PSSS Magic Effects Auto unregister for everything so there no need to to unregister for update. But if make feel better you can add it.

Link to comment
Share on other sites

another option is on Effect Start give the player a Force Selected Alias with Keyword "ImmuneParalysis" then Clear the Alias on Effect End, also untested, yep that it, out of ideas. :huh:

 

But really like this one, since I believe it come the closest to what your trying to achieve, but I could wrong.

 

Good Modding.

 

Ps be sure to sure to tick right boxes, so it clear correctly. (Irish Accent) I 'm going to bed.

 

Edit

 

sometime Papyrus isn't the answer, since I seen post that it impossible give Actor's Keywords, nevertheless, I done it with Alias & it works. Ok it still needs papyrus to apply the alias.

Edited by PeterMartyr
Link to comment
Share on other sites

Very interesting approach. I might use some of this in my script, particularly the while loop checking for HasMagicEffectWithKeyword. I would likely remove "akTarget == Game.GetPlayer() && " from the OnEffectStart though, since I'd like this to work with any target, not just the player.

 

Also, instead of making another Spell I should be able to remove any paralysis effects from within this script (where "ParalysisDispell.Cast(Target, Target)" is), right? I'm not sure how well this would work for non-player actors.

 

Instead, I should be able to use something like:

 

if akTarget.HasMagicEffect("Paralysis")

Paralysis.Dispel()

 

The problem I'm having is that Dispel appears like it should only work on spells. I'd preferably like an effect that prevents paralysis from all sources; spells, poisons, traps, etc. Therefore I'd like to remove the paralysis Magic Effect itself, but I'm having a difficult time figuring out how to do this. Thus my earlier script attempt of akTarget.SetAV("Paralysis", 0). Any insight would be helpful.

 

The Forced Alias approach might work, but that would be all or nothing (not checking for each paralysis attempt). Also not sure how well this would work with non-player actors (e.g. companions).

 

Also, the Forced Alias approach might work, but that would be all or nothing (not checking for each paralysis attempt). Also not sure how well this would work with non-player actors (e.g. companions).

Link to comment
Share on other sites

A little update on one of my scripts. I've changed tack on how I'm going to do my silence effect. I really liked the idea of changing the combat style of the NPC (and setting the player's magic & magic regen to 0), but that won't work. Well, I think it would work but with one main problem; Combat Styles are linked to ActorBase and not Actor. Thus if you change the combat style of one target, you'd be changing the Combat Style of all actors with that ActorBase. Obviously this makes my approach untenable, since if you're fighting two mages of the same type silencing one of them would silence both of them.

 

So here is my Silence script for now. Any help, especially with figuring out what potion magnitude values are likely to be, would be appreciated.

 

 

 

Scriptname CP_AlchSilence extends activemagiceffect
{Temporarily reduces target's magicka and magicka regen to 0, thereby silencing them}
Actor Property akTarget auto
ObjectReference Property PlayerRef auto
Float StartingMagicka
Float StartingMagickaRate
Bool AlreadySilenced = false
Event OnEffectStart(Actor akCaster, Actor akTarget)
Float Mag = Self.GetMagnitude()
Float Chance = Utility.RandomFloat(0.0, 10.0) ; will need to change the 10.0 - still not sure how magnitude is calculated
If Mag > Chance && AlreadySilenced == false
AlreadySilenced = true
StartingMagicka = akTarget.GetAV("Magicka")
StartingMagickaRate = akTarget.GetAV("MagickaRate")
akTarget.SetAV("Magicka", 0.0)
akTarget.SetAV("MagickaRate", 0.0)
RegisterForSingleUpdate(1)
EndIf
EndEvent
Event OnUpdate()
akTarget.SetAV("Magicka", 0.0)
akTarget.SetAV("MagickaRate", 0.0)
RegisterForSingleUpdate(1)
EndEvent
Event OnEffectFinish(Actor akCaster, Actor akTarget)
akTarget.SetAV("Magicka", StartingMagicka)
akTarget.SetAV("MagickaRate", StartingMagickaRate)
EndEvent

 

 

 

Link to comment
Share on other sites

Any help with the Silence effect would be greatly appreciated. The above script compiles fine, but doesn't work in game, even when deleting the chance check (If Mag > Chance && AlreadySilenced == false, so this should happen 100& of the time). I even tried cranking up the update time to 0.1 but when I tried it against a weak fire mage my test character was still BBQ. The mage's magicka & magicka regen rate did not appear to be altered by the spell. I also checked to make sure the player's magicka & magicka regen rate were not altered; they were not. Oh, and I also tried ForceAV instead of SetAV, to no avail. Not sure why this doesn't seem to be working.

Link to comment
Share on other sites

  • 4 weeks later...

Got many of my effects to work. I still need to go back and tweak some values, but they're working.

 

The one effect that I'm still having trouble with is a blind effect. I have it working for NPCs but I'm having difficulty with custom Imods for when the player is binded. Is there a tutorial, post, or any advice someone can point me to for making a brand new Imod?

Link to comment
Share on other sites

  • 1 month later...

More noobish questions :)

 

I generally have the alchemy effects that I want working, and am now concentrating on getting the magnitudes and durations of the effects to be balanced (i.e. not batshit crazy). I'm specifically looking for advice on how to handle the magnitudes of my scripted effects.

 

With SKSE I can use Self.GetMagnitude. I was hoping that would get the magnitude of the effect, factoring in perks, enchanted gear, etc. Unfortunately, this only returns the magnitude of the alchemy effect for this ingredient. Therefore, it seems I might have to calculate this in the script. The big problem with this: if this is calculated during the magic effect, it will check the alchemy level, enchanted gear, etc AT THE TIME OF USE. For a number of obvious reasons, I'd prefer that this be calculated at the time of potion creation.

 

Can anyone help me out with this? Is there a way I could calculate this number, store it in some sort if array, and recall this number upon potion use? This seems extremely convoluted, but I can't think of anything else/better.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...