How do I do an action with papyrus when the player kills som

Post » Sun Jun 17, 2012 12:07 pm

I am looking through the documentation and cannot find a single way to do an action with papyrus if the player kills something?

or if it comes down to it, how do I get an event to fire when a specific weapon (A pickaxe, for example) kills something?
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Sun Jun 17, 2012 4:05 pm

I'd try it with an OnHit Event, and then checking if the receiving actor is dead or not. Or just OnDying or OnDeath, with the appropriate checks.

I only just started reading the wiki though, so there may be an easier way.
User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Post » Sun Jun 17, 2012 10:11 pm

I'd try it with an OnHit Event, and then checking if the receiving actor is dead or not. Or just OnDying or OnDeath, with the appropriate checks.

I only just started reading the wiki though, so there may be an easier way.

The problem with both onDeath and onHit is that both of them seem to have to be on the receiving end (the person who gets killed) and as far as I am reading this, that somehow means I have to add the script to every single possible actor in the game.

Unless I am perceiving this totally wrong.
User avatar
Sunny Under
 
Posts: 3368
Joined: Wed Apr 11, 2007 5:31 pm

Post » Sun Jun 17, 2012 11:23 pm

No help?
User avatar
Harry Hearing
 
Posts: 3366
Joined: Sun Jul 22, 2007 6:19 am

Post » Sun Jun 17, 2012 1:39 pm

Nope, sorry. I've had the same issue. There' doesnt seem to be much way anymore of having something run on the non-receiving end of stuff short of setting your script as the enchantment.
User avatar
Tasha Clifford
 
Posts: 3295
Joined: Fri Jul 21, 2006 7:08 am

Post » Sun Jun 17, 2012 12:33 pm

Nope, sorry. I've had the same issue. There' doesnt seem to be much way anymore of having something run on the non-receiving end of stuff short of setting your script as the enchantment.

Hm, I was looking at enchantments but I can't figure out how you are supposed to make one? With scripted papyrus attacks?
User avatar
katie TWAVA
 
Posts: 3452
Joined: Tue Jul 04, 2006 3:32 am

Post » Sun Jun 17, 2012 9:28 pm

You'll need to create some magic effect as well, to go inside the enchantment (if I'm not mistaken).
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Mon Jun 18, 2012 12:47 am

You'll need to create some magic effect as well, to go inside the enchantment (if I'm not mistaken).

Looking at creating a magic effect, how would I make it do something in papyrus on it killing a player (basing this on the fire damage enchantment).
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Sun Jun 17, 2012 8:28 pm

Something like this. is this for a SET actor or random actors?
http://www.creationkit.com/OnDeath_-_Actor
[code]

Event OnDeath(ObjectReference actorsbaseid)
if actorsbaseid == game.getPlayer()
;do something here
endif
EndEvent
User avatar
Stacy Hope
 
Posts: 3391
Joined: Thu Jun 22, 2006 6:23 am

Post » Sun Jun 17, 2012 6:44 pm

Something like this. is this for a SET actor or random actors?
http://www.creationkit.com/OnDeath_-_Actor
Event OnDeath(Actor akKiller)  if (akKiller == Game.GetPlayer())	Debug.Trace("We were killed by the player!")  endIfendEvent

^ This is exactly what you neeed
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Sun Jun 17, 2012 12:33 pm

Yes, but that will work for only one specific actor, no?
User avatar
Flutterby
 
Posts: 3379
Joined: Mon Sep 25, 2006 11:28 am

Post » Sun Jun 17, 2012 11:26 am

Yes, but that will work for only one specific actor, no?

This is pretty much what I am pointing out, all the scripts that I have seen have to be on the receiving end, tied to a single actor. What I want is a script tied to a weapon that when the weapon gets a kill it will execute an event with an object of the actor that was just killed (not the killer)
User avatar
Matt Gammond
 
Posts: 3410
Joined: Mon Jul 02, 2007 2:38 pm

Post » Sun Jun 17, 2012 9:13 pm

All actors are of the actor type, so edit the Base Actor type script to include your function.

Atleast this is the way I gathered "types" now work.
User avatar
Lucky Girl
 
Posts: 3486
Joined: Wed Jun 06, 2007 4:14 pm

Post » Sun Jun 17, 2012 5:07 pm

I haven't tested it, but I think it could work like this:

Make the Weapon add a new Perk to the Player through a script (look at the Silver weapons for an example). In this Perk make a new Entry, set the Entry Point to Apply Combat Hit Spell. Create a new Spell with a new Magic Effect, and make that the spell that the Perk uses for Apply Combat Hit Spell. Now add a new Papyrus Script to the new Magic Effect, which I expect will run on the actor that you hit with your weapon. If so, from there use an OnHit Event with a check for the aggressor parameter to be the Player.
User avatar
Laura Elizabeth
 
Posts: 3454
Joined: Wed Oct 11, 2006 7:34 pm

Post » Sun Jun 17, 2012 7:24 pm

You can do this with a Story Manager event... make a quest that responds to Kill Actor, then conditionalize its SM node to only fire if the Killer is the player.
User avatar
christelle047
 
Posts: 3407
Joined: Mon Apr 09, 2007 12:50 pm

Post » Sun Jun 17, 2012 9:01 pm

Thanks SJML, I was wondering how to do this as well.
User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Sun Jun 17, 2012 12:27 pm

I currently have what I want to make tied to an enchantment with this script in magic effects:
Scriptname ThrallMake extends activemagiceffect {Makes a thrall when user kills something}Spell property reanimateSpell autoEVENT onInit()					   ; This event will run once, when the script is initialized    ; debug.messagebox("init")if GetTargetActor().IsDead()reanimateSpell.Cast(game.getPlayer(), GetTargetActor()); debug.messagebox("Other guy killed")endifendEVENT
The code works find except it also gets called when the player hits a dead body, I would like it to only get called if the enchanted weapon does the killing blow (not the killing special move, just generally the killing blow).

Also, is there anyway to circumvent the resurrect script to allow the player to have more than one zombie at a time?
User avatar
Liv Brown
 
Posts: 3358
Joined: Wed Jan 31, 2007 11:44 pm

Post » Sun Jun 17, 2012 7:51 pm

Is it even possible at all?
User avatar
Sophie Louise Edge
 
Posts: 3461
Joined: Sat Oct 21, 2006 7:09 pm

Post » Sun Jun 17, 2012 8:47 pm

I haven't tested it, but I think it could work like this:

Make the Weapon add a new Perk to the Player through a script (look at the Silver weapons for an example). In this Perk make a new Entry, set the Entry Point to Apply Combat Hit Spell. Create a new Spell with a new Magic Effect, and make that the spell that the Perk uses for Apply Combat Hit Spell. Now add a new Papyrus Script to the new Magic Effect, which I expect will run on the actor that you hit with your weapon. If so, from there use an OnHit Event with a check for the aggressor parameter to be the Player.

Be careful when you are using perks that apply combat hit spell because only one such perk can work at a time. That is why you must set priority on that perk entry so when all "apply combat hit spell" perks are processed only one with lowest priority will win. So if you make that perk and give it priority 0 don't expect that axe bleed damage and top tier weapon perks will ever work. There can be more than that in case someone is using other mods with "apply combat hit spell" entry.
User avatar
Richus Dude
 
Posts: 3381
Joined: Fri Jun 16, 2006 1:17 am


Return to V - Skyrim