Jump to content

Conditions on abilities/spells


Recommended Posts

Yes I saw those earlier, unfortunately those pages state that they do nothing for NPCs:(

 

So.. is 'OnCellDetach, OnCellAttach, OnUnload, OnLoad' an exhaustive list of events that remove an ability on an NPC? I ask because I'm pondering making the ability when on the player, whenever these events occur, check for the magic effect on relevant NPCs; and if missing, re-add the appropriate spell.

Note that merely entering Breezehome and exiting does not appear to remove the abilty from my follower.

 

 

diziet

Link to comment
Share on other sites

I don't know how accurate is that... you need to run some test in order to be sure.

* I personally don't trust at all the "creationkit.com", i've run into so many inaccurate descriptions and found so many errors on functions that are not listed, that i only trust and use those functions after i have tested them to death.
Link to comment
Share on other sites

I've been experimenting with my testscript posted earlier in the thread by adding a line to add a dummy perk I made, that didn't work on the NPC but did work on the player. So i went back to my idea of having the OnEffectFinish reapply the spell thus:

scriptname testscript extends Activemagiceffect
spell property dz_test_ability auto

spell property dz_outfits_ability_spell auto

perk property dz_dummy_perk auto
Event OnEffectStart(Actor Target, Actor Caster)

debug.messagebox("effect starting")

target.addperk(dz_dummy_perk)

EndEvent
Event OnEffectFinish(Actor Target, Actor Caster)

debug.messagebox("effect finishing")

utility.wait(10)

debug.messagebox("this is a message")

target.addspell(dz_test_ability)

EndEvent

this script is attached to the effect for the dz_test_ability spell, for good measure I added a blue aura FX to the effect. What happens now is that I give my follower the dz_test_ability spell in the console while in Whiterun, exit the gates or fast travel; the follower loses the effect as inidcated by the messagebox "effect finishing", then 10s later the next messagebox appears - and - the blue aura comes back!

 

However I think this will mess up the mechanism in my actual ability effect where checking with an MCM menu variable remove the ablity i.e.

If dz_mcm.activate_toggle[dz_mcm.index] == False       ;check to see if mcm menu toggle for ability has been deactivated

  debug.messagebox("dispel_loop for "+this_npc_name+", activate_toggle = "+dz_mcm.activate_toggle[dz_mcm.index])

  self.dispel()               ;dispel the ability

  Return                 ;and return, no more to be done

EndIf

more testing to be done

 

edit:

well I was right, self.dispel does lead to an OnEffectFinish event and an infinite loop unless I also put the check for the self.dispel condition in the OnEffectFinish with an immediate return thus:

 

 

scriptname testscript extends Activemagiceffect
spell property dz_test_ability auto

spell property dz_outfits_ability_spell auto

perk property dz_dummy_perk auto

dz_auto_outfit_mcm_menu property dz_mcm auto
Event OnEffectStart(Actor Target, Actor Caster)

debug.messagebox("effect starting")

target.addperk(dz_dummy_perk)

string this_npc_name

this_npc_name = target.GetDisplayName()

If dz_mcm.combat_override_toggle == False       ;check to see if mcm menu toggle for ability has been deactivated

  debug.messagebox("dispel_loop for "+this_npc_name+", activate_toggle = "+dz_mcm.activate_toggle[dz_mcm.index])

  self.dispel()               ;dispel the ability

  Return                 ;and return, no more to be done

EndIf



EndEvent
Event OnEffectFinish(Actor Target, Actor Caster)

debug.messagebox("effect finishing")

utility.wait(1)

;debug.messagebox("this is a message")

string this_npc_name

this_npc_name = target.GetDisplayName()

If dz_mcm.combat_override_toggle == False       ;check to see if mcm menu toggle for ability has been deactivated

  ;debug.messagebox("dispel_loop for "+this_npc_name+", activate_toggle = "+dz_mcm.activate_toggle[dz_mcm.index])

  ;self.dispel()               ;dispel the ability

  Return                 ;and return, no more to be done

EndIf

target.addspell(dz_test_ability)

EndEvent

 

 

 

 

diziet

Link to comment
Share on other sites

Are you completely sure that the 'addperk' isn't working on your npc ?.


I'm asking this because i have one case / boss that she has an "Energy Shield Spell", every time she casts it the spell adds to her a resist damage 'Perk', the 'Perk' is handling a 'Resist Damage Ability Spell' that reduses the damge taken by 75%.


Without the "Energy Shield Spell" / "Resist Damage Perk" the damage done to her is very noticeable, but with the perk is really hard to kill her.


I've tested and work on this boss for so long that i'm 100% sure that the perk does work on her.





EDIT: Scratch that...!!!

I just took a look at the npc i was talking about before start packing the mod, just to be sure and to satisfy my curiosity, and...


When i start looking at it (for the Perk) i remember that, indeed the perks added to npcs do not work, neither the "Perk to Apply" in the 'Magic Effect' if it's targeting an npc.


The way i did that back then is to add/remove the 'Resist Damage Ab Spell' when she cast the "Energy Shield Spell" !!....


Sorry about that !!... it's has passed quite some time from when i was working on her and i had wrongly the impression that she was using Add/Remove Perk.

Edited by maxarturo
Link to comment
Share on other sites

That's ok, I just found out that my excitement at getting abilities to stay on an NPC by getting the OnEffectFinish event to reapply it doesn't work when there are conitions on the ability!

My current plan is to have a 'meta' ability with no conditions, to run on the NPC that reapplies the others on cell load etc.

 

This is the frustrattion of Skyrim modding, if I had known a few months ago that abilities and NPCs didn't really mix, I'd have tried to find a different project to entertain me, it's not as if my little mod in progress will very useful; most people will use a follower framework for outfits and stuff. But now I'm into it I don't want to give up:)

 

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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