Jump to content

Instant kill console command


Abssso

Recommended Posts

Hello everyone, for some time now, I’ve been trying to create a console command that allows me to instantly kill an actor when I press the X key on my keyboard, without needing help from the console, and that is activated from a quest. I just want to move my crosshair over the actor, then press X to instantly kill them, no matter the distance from me. Here is the script I have currently, which doesn't work for long distances and i things it kill the player..... (Just a note) I don’t want to kill all the actors in a radius, only the one on my crosshair. 

 

Scriptname pickupquest extends ReferenceAlias

 

import PO3_SKSEFunctions

import PO3_Events_Alias

 

Event OnInit()

    RegisterForKey(45) ; Register "x" entry

EndEvent

 

Event OnKeyDown(Int KeyCode)

    If KeyCode == 45 ; "X"

        KillTargetUnderCrosshair()

    EndIf

EndEvent

 

Function KillTargetUnderCrosshair()

    Actor player = Game.GetPlayer()

    Actor target = Game.FindClosestActorOfTypeFromRef(player, None, 100000.0)

 

    If target && !target.IsDead()

        target.Kill()

    Else

        Debug.Notification("got nothing")

    EndIf

EndFunction

 

Link to comment
Share on other sites

A thought:

That option in follower dialogue - 'Can you do something for me?' It invokes SetDoingFavor()  function on the actor.   

You can then target furniture to use or NPCs to attack from quite a distance.    And then there is a 'Favor' quest dialogue where your follower responds to your request.

This is not EXACTLY how you want it, but the general thought:
A constantly running quest script monitors for the X key being pressed.   When that happens, it summons an invisible, 0-size bounding box actor to your location, and calls SetDoingFavor(true) on this actor.
This should invoke the favor targeting mode.   You need to click on target you want killed.   This triggers the Favor dialogue set specifically for this invisible actor, and script fragment attached to this dialogue performs the kill command. 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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