Jump to content

Attaching script to npc using reference alias


Recommended Posts

Hello everyone, 

I'm trying to learn about alias' in Skyrim but still haven't really quite figured it out.  I'm trying to make a very simple mod that just notifies the player when they kill an npc, using the onDeath Event. I'm sure this is very easy and i'm just missing something but didn't want to waist too much time just spinning wheels.  Have I not done the alias part correctly? If anyone could pls help me out id be grateful.

Thanks

Screenshot 2025-01-26 091518.png

Screenshot 2025-01-26 091659.png

Screenshot 2025-01-26 091744.png

Link to comment
Share on other sites

You likely have to check the "Allow Dead" box for this to work

Otherwise ReferenceAlias automatically releases NPCs from being aliased when they die, and I never tested if OnDeath script triggers happen before that

Aside, there is OnDying() which you can mess with too. Just a reminder that exists too

Unrelated but yeah: I would avoid naming a script the same as an event name. Maybe that's my coder-OCD triggering but I avoid syntax overlaps like that

Link to comment
Share on other sites

The alias will remain filled when the NPC dies.  It just can't be dead when filling the alias (at Quest start) unless you flag "allow dead".

Your alias fill conditions though will grab any random object in the player's immediate vicinity when the quest starts.  You likely want to use the "specific reference" fill type instead and select your target NPC.

If you want ANY npc's death to be detected, that's a tougher job. It can't be done through the alias mechanism.

You may also want to share details on how the quest is started... aliases are filled when the quest starts... so that won't work if you don't, or do it at the wrong time.

In game, use the console's "sqv myquest" command to check on the quest's status (started or not) and what got filled in the alias.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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