Jump to content

First Script Issue


Disturbed_1

Recommended Posts

So, I'm working on my first papyrus script, trying to make a staff to kill NPCs. I've got the kill part down, but am now trying to mark them as unessential if they are THEN kill them.


Scriptname DeathSpellSCR extends activemagiceffect


ObjectReference property Victim auto


Event OnEffectFinish(Actor target, Actor caster)

;This part works:

If (target.isEssential())

Debug.Notification("This actor is essential and cannot be killed")

;This part throws an error:

target.setEssential 0

EndIf

target.Kill()

EndEvent


The error I'm getting is "No viable alternative at input 'setEssential'".

Can anyone tell me what this means, and how to go about fixing it?

Link to comment
Share on other sites

You are using SetEssential with the incorrect syntax. You have the console syntax rather than the papyrus syntax.

 

See the wiki page: SetEssential

 

Unlike IsEssential, SetEssential can only be run on the ActorBase and not the actor. So you'll have to obtain the ActorBase of the Actor before running it.

 

Correct usage for your script:

target.GetActorBase().SetEssential(false)

Link to comment
Share on other sites

  On 1/12/2015 at 2:52 AM, Disturbed_1 said:

 

So, I'm working on my first papyrus script, trying to make a staff to kill NPCs. I've got the kill part down, but am now trying to mark them as unessential if they are THEN kill them.
Scriptname DeathSpellSCR extends activemagiceffect
ObjectReference property Victim auto
Event OnEffectFinish(Actor target, Actor caster)
;This part works:
If (target.isEssential())
Debug.Notification("This actor is essential and cannot be killed")
;This part throws an error:
target.setEssential 0
EndIf
target.Kill()
EndEvent
The error I'm getting is "No viable alternative at input 'setEssential'".
Can anyone tell me what this means, and how to go about fixing it?

 

Thank you! That worked perfectly, except for on Balgruf and crew, but I've a hunch as to why that might be.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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