Jump to content

Help Needed - Make NPC heal others AND add player to Faction on NPC death


Recommended Posts

I'm making a Goblin city/town using Mihail's Goblins as a base, I want to be able to kill the Goblin king and have the player character become the new King/Queen of the Goblin city by adding them to an 'allied' faction.

Then secondly as a death item from the King you would receive a series of Goblin summoning tomes, which all work as intended apart from the Goblin healer. I would like them to heal (Healing hands etc) other goblins but mainly to heal the player.

I've attempted to learn scripting to tackle these problems but I've hit various problems on my system, can't compile in the CK and I just don't really understand what I'm looking at with scripts at all.

1 - How do I add player to faction on NPC death?
2 - How can I make an NPC heal the player? (and less importantly heal other NPCs)

Thanks in advance.

Link to comment
Share on other sites

For adding to faction on death, that's pretty simple. Put a script like this on your goblin:

 

Scriptname TM_ActorScript extends Actor 

Actor Property PlayerRef Auto 
Faction Property GoblinFaction Auto 

Event OnDeath(Actor akKiller) 
    PlayerRef.AddToFaction(GoblinFaction) 
    ;and or 
    PlayerRef.SetFactionRank(GoblinFaction, 2)
EndEvent

Change 2 to whatever faction rank you want. Change the script name to something more unique. Also, don't forget to fill properties after compiling. What I mean by that is, in the creation kit, click on the script, properties and Auto Fill All. If your properties are named exactly the same in the script as in the CK, they should fill automatically. You can also set them manually by clicking on the property, choose edit value and choose from the drop down.

 

For making a healer, I'm not sure the best way, but you can maybe check out another healer mod like Toccata to see how they did it. https://www.nexusmods.com/skyrimspecialedition/mods/12713.

 

Off the top of my head, you could put a spell ability on your goblin with the condition GetActorValuePercent Health < 0.5 and have it run on the player, then put a script on the abilities magic effect like this:

Scriptname TM_MagicEffectB extends ActiveMagicEffect 

Spell Property HealingHands Auto 
Actor Property PlayerRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) 
    HealingHands.Cast(akTarget, PlayerRef) ;target casts healing hands on player 
EndEvent

Then your goblin will cast healing hands on the player whenever health gets below 50%.

Link to comment
Share on other sites

Thank you so much!

Also I have to say how nice it is to be helped by someone with 'Uncle' as their avatar.

Anyway, I tried making the first script in the CK but I cannot compile, I have been trying for hours.
When I attempt it with Notepad++ the CMD window gives me a long list of things like this, pointing at various .psc files.

"H:\Games\SSE\Skyrim Special Edition Together\Data\Scripts\Source\Actor.psc(768,27): unknown type package"

Link to comment
Share on other sites

To create a healer you need to work with 'Packages' and make your own "Do Combat Apply Spell Package", the vanilla default package will not work for what you need.

This way your npc will heal the other npcs using the corresponding 'Healing Animation' and not just casting a spell from nowhere.


If done correctly, with such a package you can make an npc that will and can heal everyone in Tamriel.


Adding info/data on how to create such a package is a little hard in a written post, you will understand why once you start creating it.

Edited by maxarturo
Link to comment
Share on other sites

No problem :smile: if it's not compiling, you probably don't have the source scripts. You need to extract the scripts.zip found in your data folder. Also in SSE they changed the source file path to Data/Source/Scripts where as in LE it's Data/Scripts/Source. To keep things simple, I just put all source .psc scripts in both of those folders.

 

Link to comment
Share on other sites

Thank you both. I will attempt to get the healer healing once I have this Goblin King thing fixed.
I have managed to get stuff to compile now, it was indeed the reverse folder structure that got me stuck.

I'm working with a tweaked version of what you gave me, I'm unable to edit properties/autofill anything. (and that's probably why it doesn't seem to be working)
Does this look right? Tried changing the name to my NPC and Faction IDs....

------------------------------------------------------
Scriptname WBGoblinOnDeath extends Actor
{Actor Property PlayerRef Auto
Faction Property WBGoblinAllyPlayerFaction Auto

Event OnDeath(Actor WBGoblinKingNPC)
PlayerRef.AddToFaction(WBGoblinAllyPlayerFaction)
;and or
PlayerRef.SetFactionRank(WBGoblinAllyPlayerFaction, 0)
EndEvent}
------------------------------------------------------


Link to comment
Share on other sites

That looks right except get rid of the { at the beginning of Actor Property and the } at the endEvent. That means the whole thing is commented out. The playerRef actor should fill automatically in the CK and so should your faction if it's named the same. You also don't need the SetFactionRank line because AddToFaction adds to faction with rank 0 by default. You can also put debug.notification("Goblin King Died") in the OnDeath event to make sure the script is firing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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