Jump to content

Adding a keyword to an actor via magic effect (scripting question)


SilverDragon437

Recommended Posts

Hey there. I have been trying to figure out how to do something for a while. I want to create a spell that adds a keyword to a target actor.

 

Specifically, I am trying to create a spell that adds the ActorTypeUndead keyword to whatever it hits that lasts 30 seconds so that it can be affected by things like sun fire, vampire's bane, turn undead, etc. I don't want to alter the original spells in any way so as to maintain compatibility with other mods that may edit them.

 

I tried a few methods. I found a handy SKSE plugin, originally for the Maria Eden mod, which claims to allow you to add keywords to things. I haven't gotten it to work. Since the file itself is hosted on a NSFW site, I cannot link to it here, but google "MESKSEUtils" and you will find the file. Here is my script below:

Scriptname Jase1126PPZombify1ScriptTest extends MESKSEUtils
{Adds undead keyword to actor}

Keyword Property ActorTypeUndead  Auto  

Form Property FormTarget  Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)

AddKeyword(akTarget, ActorTypeUndead)

EndEvent


Upon attempting to compile, I get the following error:

 

Jase1126PPZombify1ScriptTest.psc(10,0): global function AddKeyword cannot be called on an object

 

I figured out that Papyrus doesn't seem to have an addkeyword function on its own.

 

Is there any kind of workaround, such as adding the keyword to a magic effect? Will that allow you to accomplish the same thing I am trying to do?

 

Or are there any kinds of SKSE plugins that I don't know about that allow you to do this? Perhaps script dragon?

 

Any help would be appreciated. Thanks :)

Link to comment
Share on other sites

Thinking out loud here...

 

Create a quest with an alias that has the keyword assigned to it.

The alias has a match condition that the target have a specific magic effect active.

The spell you cast at the target applies the magic effect, the magic effect has a small script which starts the quest and if the target wasn't automatically assigned to the alias, force fill it.

 

Not sure if it will work... worth a shot maybe?

Link to comment
Share on other sites

Yup, adding a keyword to the magic effect would be the way to go here. I think it's also possible to use a quest alias to temporarily add a keyword to an actor, some scripting required, still.

 

Btw, it's now officially allowed to link to "that site". ;-) Googling for "MESKSEUtils" got me nowhere, had to search for "Skyrim MESKSEUtils" to get to the file. I didn't know about this plugin yet, so thank you very much for the hint. :-)

Link to comment
Share on other sites

Thinking out loud here...

 

Create a quest with an alias that has the keyword assigned to it.

The alias has a match condition that the target have a specific magic effect active.

The spell you cast at the target applies the magic effect, the magic effect has a small script which starts the quest and if the target wasn't automatically assigned to the alias, force fill it.

 

Not sure if it will work... worth a shot maybe?

 

Adding the keyword to the magic effect doesn't seem to work. I tried using my spell with the effect and then sun fire and vampire's bane, but nothing happens and the game says the target actor resisted it.

 

I will have to go the quest route, but I'm unsure of what exactly to do after a certain point. I made the quest, the alias, and added the keyword to the alias. However, I am having a difficult time making a script that makes a magic effect force the ref to the alias on the quest. Papyrus doesn't like me -_-

 

I am trying to do something like this:

Event OnEffectStart(actor akTarget, actor akCaster)

Alias_MakeMeUndead.ForceRefTo(akTarget)


EndEvent

Papyrus doesn't like it when I try to extend activemagiceffect with this, so I tried with extending objectreference but the compiler still rejects it. Can anyone help me figure this out? Maybe post a functional script? (Credit will be given when I finally do release my mod)

Link to comment
Share on other sites

The magic effect has no clue what your alias on the quest is. You need to add a property to the magic effect script that points to the alias on your quest. However, you cannot add a property until the script exists. So you'll need to compile the script with the code using the property commented out.

 

Compile this script on your magic effect

Event OnEffectStart(actor akTarget, actor akCaster)

;Alias_MakeMeUndead.ForceRefTo(akTarget)


EndEvent

Then click the add property button. Set the new property to type ReferenceAlias, name to Alias_MakeMeUndead. Then when you fill the property, you need to select both the quest and the alias. Once that is done, edit the script and remove the semi-colon then re-compile.

 

Hopefully that helps, working from memory here ... definitely room for error :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

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