Jump to content

Adding a keyword to a object via script


Recommended Posts

So I have a mod idea that may require adding a keyword to a object via a spell.

 

What I want to do is when you use a targeted spell on a object the script will add a keyword to he object called isEditable.

 

Then I will have another spell that when you use it on the same object it will check for the keyword in the object and if true it will pop up a series of notifications telling you the objects Position for X,Y,Z and Angle for X,Y,Z.

 

And another spell that removes the keyword from the object when you use the spell

 

I want this script to work on any static object in game

Is it possible?

Edited by DarkWolfModding
Link to comment
Share on other sites

To my knowledge, it isn't possible to add/modify/delete keywords via script. These are only associated via the Creation Kit and are immutable.

 

What I would suggest is to create a formlist, let's call it flstIsEditable, to which you could add individual object instances or base object types of those you would want to tag with the keyword. (Unlike keywords, formlists can be modified via script.) You can use your spell to check against the list for that object, or you could use the Game.FindClosestReferenceOfAnyTypeInList (or similar functions) to locate similar object instances to the ones you have tagged.

 

As for locating static objects and getting their X/Y/Z coordinates or rotations, please feel free to take a look at the source code included in my Positioner mod. Perhaps some snippets there that would be helpful for your project.

 

All the best.

Link to comment
Share on other sites

To my knowledge, it isn't possible to add/modify/delete keywords via script. These are only associated via the Creation Kit and are immutable.

 

What I would suggest is to create a formlist, let's call it flstIsEditable, to which you could add individual object instances or base object types of those you would want to tag with the keyword. (Unlike keywords, formlists can be modified via script.) You can use your spell to check against the list for that object, or you could use the Game.FindClosestReferenceOfAnyTypeInList (or similar functions) to locate similar object instances to the ones you have tagged.

 

As for locating static objects and getting their X/Y/Z coordinates or rotations, please feel free to take a look at the source code included in my Positioner mod. Perhaps some snippets there that would be helpful for your project.

 

All the best.

I know how the getPosition and set position functions work in papyrus. Ive been doing papyrus scripting for about 6 months to a year so Its just some stuff like this I dont know how to do. As well as making a quest (the only one I know how to do is the one you attach a script to to make the script run on game start).

 

Thank you all nexus forums you help me a lot.

 

Looking forward to Elder scrolls 6 and exploring the scripting possibilities in it. (If they make it)

Link to comment
Share on other sites

I'm puzzled a bit because your response seems to have little to do with your original question or the information I provided. Perhaps that is a language thing.

 

In any event, you might consider the TranslateTo function as a better alternative to SetPosition. It behaves better with most items, especially non-static ones.

Link to comment
Share on other sites

I'll try it out as soon as I can and let you guys know how it goes.

Should have more time after next week cuz of summer. 😋

Link to comment
Share on other sites

  • Recently Browsing   0 members

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