Jump to content

changing NPC's essential status with spell


geisttgih

Recommended Posts

Hello, after searching through the TESCS wiki and related websites, I have yet to find a solution to my problem.

 

I'm trying to script a spell that, as part of the spell's effect, will change an NPC's essential status to 0 if it is currently at 1. My initial block attempt (not the full code):

 

If isEssential == 0

set isEssential to 1

 

crashed the game when used on an Essential NPC, for (as I now know) you can't treat isEssential like a changeable variable.

 

My search then led me to use "SetEssential [ActorBase] 0", but how can I script my spell to fill in [ActorBase] with the proper ID with each cast? Seeing as how it will be used on different NPCs.

Link to comment
Share on other sites

Hello, after searching through the TESCS wiki and related websites, I have yet to find a solution to my problem.

 

I'm trying to script a spell that, as part of the spell's effect, will change an NPC's essential status to 0 if it is currently at 1. My initial block attempt (not the full code):

 

If isEssential == 0

set isEssential to 1

 

crashed the game when used on an Essential NPC, for (as I now know) you can't treat isEssential like a changeable variable.

 

My search then led me to use "SetEssential [ActorBase] 0", but how can I script my spell to fill in [ActorBase] with the proper ID with each cast? Seeing as how it will be used on different NPCs.

 

You probably want to use the GetSelf function to get a reference to the magic effect target, and then test that reference to make sure that it is both an Actor (using IsActor) and is not a creature (using IsCreature) before executing the setessential on the reference. Probably might want to make sure that the reference is not to the player as well - I'm not really sure what would happen if you attempted to set the player as essential. <g>

Link to comment
Share on other sites

  • Recently Browsing   0 members

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