Jump to content

[LE] Need help with adding ability on OnKill Events


Recommended Posts

Hi there, Modding newbie here.
I recently picked up the Creation Kit and am working on a mod right now that changes up enchantments and magical effects.
To add to the game-play I'm trying to add abilities that take effect on certain events:

To give an example, A short 10s Regeneration Ability triggering when the player kills an actor if the player has a standing stone perk.
Or a Burst of Magicka Regeneration Ability triggered by slaying a target under a soul trap effect.

From what I understand these sort of events require scripting (Which I am just picking up through deconstruction)
If what I've gathered is correct, I think I need to Adjust the standing stone perk to make the player apply a "VictimPerk" with their attacks,
And then Script in the "VictimPerk" to apply an ability on to the "Killer". Not at all sure if this is the easiest way to do this... Or if anyone has an idea for a better way to do this?
Is anyone able to share some of their insight with a rookie modder?

Thanks to anyone that can help.

Link to comment
Share on other sites

Since you are a beginner, what you want to do it's not that simple, it's not like pressing a button or adding somewhere a script and you are done.


You need to start from something simple or start studying / researching how the "Ebony Blade Quest" handles the "Death Event" of an actor that has been killed by the player.


After you have comprehend that, adding bonuses or abilities to the player on the "Death Event" comes much easier.

Link to comment
Share on other sites

Thank you Maxarturo.
I figured it wouldn't be simple.
I know the ebonyblade quest uses a Quest, as well as StoryMode Event Node for ActorKill.
I'm still, trying to comprehend how the Quest and StoryMode Event connect with each other and how to actually setup an "Ability" with a duration reward for completing this repeatable quest.
I though going the Apply perk to enemy route might be simpler, but if this is the better way, I guess I need to get a better understanding of how to setup the Quest + Reward.

Link to comment
Share on other sites

Ok, you are on a good path.

- Start by studying the StoryMode Event Node, and how the SM handles things.

- Then, you go to how the quest listens the SM event.

- And then comes the easy part, adding / doing things to the player using the quest / papyrus fragment.


* You can't add a perk to an actor except the player in-game, it's not supported by the game, the perk will just not work.

The perk route can only work if it's intended to work on a specific number of npcs, like the actors of your quest mod, if you want this to fire on every and random actors, then the SM way it's the way to go.


Take it one step at the time and go to the next after you have fully comprehend the previous.


Have a nice learning journey.

Edited by maxarturo
Link to comment
Share on other sites

Another option, if you're interested, is to make an ability spell with a script attached to its magic effect with the OnDeath event.

 

Example script:

Scriptname TM_MagicEffectC extends ActiveMagicEffect 

Spell Property BuffSpell Auto 
Spell Property SpellAbilityToCheck auto

Event OnDeath(actor akKiller) 
    If akKiller.HasSpell(SpellAbilityToCheck) ;Does the killer have the SpellAbilityToCheck?
        BuffSpell.Cast(akKiller, akKiller) ;If so, killer of this NPC casts the BuffSpell on themself 
    Endif 
EndEvent

To give the OnDeath ability spell to NPC's you could use Spell Perk Item Distributor: https://www.nexusmods.com/skyrimspecialedition/mods/36869

Or use a cloak spell on the player that gives the ability spell to NPC's. For an example of how to do that, check out my mod NPC Death Alert's: https://www.nexusmods.com/skyrimspecialedition/mods/33126

Link to comment
Share on other sites

Hmm, I've been at it for most of the day trying to make it work by reconstruction your NPC Death Alert Mod, feel like I'm so close but something's amiss.
Ive set up my abilities same as your mod,
Cloak spell => Cloak Effect => Mark with ability Spell => Mark with ability Script Effect => Token Ability => Token Script Effect (With on death event) to "apply a restore health" ability.
Ive set up debug Notifications to let me know when the scripts fire.
As soon as I spawn an NPC I get a debug that "The Lord Token Ability was added to Foe" and as soon as I kill the Foe I get a debug that I am "Regenerating from Lord Passive". But I'm not actually healing.
The effect itself works fine if I attach it anywhere else, so that shouldn't be the issue. Kinda scratching my head right now.
Here is what I have for scripts:
=======================================================
*** Mark with ability Script Effect ***
Scriptname ReRe_DoomLordMarkScript extends activemagiceffect

SPELL Property TheLordTokenSpell Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
akTarget.AddSpell(TheLordTokenSpell)
debug.notification("The Lord Token Ability to Foe")

EndEvent

*** Token Script Effect ***
Scriptname ReRe_DoomLordKillRewardScript extends activemagiceffect

SPELL Property Regeneration Auto
SPELL Property LordAbility Auto

Event OnDeath(actor akKiller)
If akKiller.HasSpell(LordAbility)
Regeneration.Cast(akKiller, akKiller)
debug.notification("Regenerating Health From Lord Passive...")
EndIf
EndEvent
========================================================
Since my messages all fire as they are supposed to I think that means that my issue is literally at the last part of my ability and script chain.
Do I need to define "akKiller" as a property in my script?
Aside from this I have no idea why it's not properly granting the defined ability.












Link to comment
Share on other sites

Man, I have a nasty habit of posting on forums asking for help minutes before figuring things out...
For the Record, Subbing out "Regeneration.cast(akKiller, AkKiller)" with "AkKiller.AddSpell(Regeneration)" Did the trick.
Thank you Dylbill for helping me figure out this elegant solution~ Works perfectly now.

Link to comment
Share on other sites

Hey guys.


This is simple as a reference.

It may not appear so, but using the 'Story Manager' is way less expensive in processing level than using 'Abilities' and 'Cloak Spells', and especially taking in account the fact that the majority of modders (99%) always take the 'Ab Spell' route because it's seems easier, so imagine:

- If you have 200 mods and each one adds 1 'Ab Spell' to the player, you will end up with a character ready to have a stroke!!.


You may find the SM incomprehensible but i assure you it's not, the SM is so easy to learn and a light and powerful tool, plus you will be taking advantage of a tool that's always ON in game.


Cloak spells it's like having a trigger box around the player that it's using the "OnTrigger()" event or "RegisterForUpdate(0.1)", the "OnTrigger()" event fires continuously and multiple time non-stop.


Have a pleasant day everyone.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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