Elias555 Posted January 27, 2017 Share Posted January 27, 2017 (edited) Not sure why this isn't firing. The actor kills another actor but nothing happens.http://www.creationkit.com/fallout4/index.php?title=OnKill_-_Actor Scriptname AceOnKillScript extends Actor Actor Property PlayerRef Auto Event OnKill(Actor akVictim) PlayerRef.RestoreActorValue("Health", 85) Debug.Notification("Health restored") EndEvent Edited January 27, 2017 by Elias555 Link to comment Share on other sites More sharing options...
Masterofnet Posted January 27, 2017 Share Posted January 27, 2017 If you are attempting you use that in the Skyrim kit it does not work. That function is only available in the Fallout 4 Kit. Link to comment Share on other sites More sharing options...
Di0nysys Posted January 27, 2017 Share Posted January 27, 2017 Do an Event OnDying(Actor akKiller), if akKiller == MyKillerActor, do stuff. Link to comment Share on other sites More sharing options...
Elias555 Posted January 28, 2017 Author Share Posted January 28, 2017 If you are attempting you use that in the Skyrim kit it does not work. That function is only available in the Fallout 4 Kit. Oh, damn. Do an Event OnDying(Actor akKiller), if akKiller == MyKillerActor, do stuff.Like this didn't fire. How is it supposed to be? Event OnDying(Actor akKiller) Actor MyKillerActor = Self If akKiller == MyKillerActor PlayerRef.RestoreActorValue("Health", 100) Debug.Notification("Health restored") EndIf EndEvent Link to comment Share on other sites More sharing options...
TomTesoro Posted January 28, 2017 Share Posted January 28, 2017 Not sure if this will fix it, but one general rule of thumb I like to follow is... instead of using PlayerRef, I use Game.GetPlayer().WhateverHere() Link to comment Share on other sites More sharing options...
Masterofnet Posted January 28, 2017 Share Posted January 28, 2017 (edited) If you are going to post a script please post the whole script. Who is this script on?? The script is asking if it the NPC killed them self. Also why would you do this? Actor MyKillerActor = Self If akKiller == MyKillerActor Just do this. If akKiller == Self ; Whatever self is. Edited January 28, 2017 by Masterofnet Link to comment Share on other sites More sharing options...
Di0nysys Posted January 28, 2017 Share Posted January 28, 2017 If you are attempting you use that in the Skyrim kit it does not work. That function is only available in the Fallout 4 Kit. Oh, damn. Do an Event OnDying(Actor akKiller), if akKiller == MyKillerActor, do stuff.Like this didn't fire. How is it supposed to be? Event OnDying(Actor akKiller) Actor MyKillerActor = Self If akKiller == MyKillerActor PlayerRef.RestoreActorValue("Health", 100) Debug.Notification("Health restored") EndIf EndEvent Just define MyKillerActor normally through a property, then if (akkiller == mykilleretc), do stuff.This script has to sit on the victim. Link to comment Share on other sites More sharing options...
NexusComa Posted January 28, 2017 Share Posted January 28, 2017 Event OnDeath(Actor ref) Link to comment Share on other sites More sharing options...
Elias555 Posted January 28, 2017 Author Share Posted January 28, 2017 Not sure if this will fix it, but one general rule of thumb I like to follow is... instead of using PlayerRef, I use Game.GetPlayer().WhateverHere()Is that faster/less taxing? I thought it was the other way around. Cool. If you are going to post a script please post the whole script. Who is this script on?? The script is asking if it the NPC killed them self. Also why would you do this? Actor MyKillerActor = Self If akKiller == MyKillerActor Just do this. If akKiller == Self ; Whatever self is. It's in the OP, it's obvious what I added. The script is on the actor doing the killing. If you are attempting you use that in the Skyrim kit it does not work. That function is only available in the Fallout 4 Kit. Oh, damn. Do an Event OnDying(Actor akKiller), if akKiller == MyKillerActor, do stuff.Like this didn't fire. How is it supposed to be? Event OnDying(Actor akKiller) Actor MyKillerActor = Self If akKiller == MyKillerActor PlayerRef.RestoreActorValue("Health", 100) Debug.Notification("Health restored") EndIf EndEvent Just define MyKillerActor normally through a property, then if (akkiller == mykilleretc), do stuff.This script has to sit on the victim. I was trying to avoid putting the script on each victim. The goal is to have an actor kill and recharge the players health per kill. Thought it would be simple. Event OnDeath(Actor ref)See above. Link to comment Share on other sites More sharing options...
Masterofnet Posted January 28, 2017 Share Posted January 28, 2017 It's in the OP, it's obvious what I added. The script is on the actor doing the killing. No, It is not in the "OP" your onkill script is in the "OP". Here is the wiki page for this event. https://www.creationkit.com/index.php?title=OnDying_-_Actor "Event called when the actor begins dying." "akKiller: The Actor that killed this one." How could you have expected this to work on the Actor that does the killing? You could use and enchantment or spell. When the "Target" is being effected by the magic effect you can run the OnDying script on them. Link to comment Share on other sites More sharing options...
Recommended Posts