Jump to content

Healing yourself upon killing an enemy


PeterTran

Recommended Posts

I'm trying to create a mod, and within it I want to incorporate an effect that makes it so whenever I kill an enemy, I automatically heal an amount. I can't figure out how to do this, and any advice would be appreciated.

Link to comment
Share on other sites

Scriptname HealonNPCDeath extends activemagiceffect

Actor Player = Game.GetPlayer()

Event OnDeath(Actor akKiller)
If(akKiller == Player)
Player.ModActorValue("Health", 10)
EndIf
EndEvent

 

 

(I'm relatively new to Papyrus, so if the OnDeath event is not the way to go, someone else please correct me.)

Assuming, for the time being, I got it right, the above script is the most basic method, but won't scale with level. If you want to scale the health received with the character's level or health or any other aspect, I'll have to tell you to learn scripting yourself, because there are just too many different ways to set it up for me to write all of them.

Link to comment
Share on other sites

The script wouldn't compile, here's the output:

 

 

 

Starting 1 compile threads for 1 files...
Compiling "BerserkerHeal"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BerserkerHeal.psc(3,15): no viable alternative at input 'Game'
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BerserkerHeal.psc(3,19): required (...)+ loop did not match anything at input '.'
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\BerserkerHeal.psc(3,6): Unknown user flag Game
No output generated for BerserkerHeal, compilation failed.
 

 

I got the script to compile when using this:
Scriptname BerserkerHeal extends activemagiceffect

Event OnDeath(Actor akKiller)
	if(akKiller == Game.GetPlayer())	
		Game.GetPlayer().ModActorValue("Health", 1000)
	endif
EndEvent

 

But when I tried to use it in game, it wouldn't work.

Edited by PeterTran
Link to comment
Share on other sites

  • Recently Browsing   0 members

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