Jump to content

How to add keywords to added armors by script


Halstrom

Recommended Posts

Hey I'm trying to script something to add keywords to added armors and getting an error when I try this:


Scriptname CCL:Kerrigan extends Quest

KeyWord Property kw01 Auto Const

Event OnInit()
	Int iArmorLevel = 1
	Armor arArmor
	Int iForm

	iForm = 0x00000800 ; Kerrigan Skinsuit
	arArmor = Game.GetFormFromFile(iForm, "Kerrigan.esp") as Armor
	arArmor.AddKeyword(kw01)

EndEvent

The error is :
"C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\CCL\Kerrigan.psc(35,9): AddKeyword is not a function or does not exist"

Any idea what I'm doing wrong and how to do it?

​Also is there an Equivalent to IsModLoaded so I could lock out the script if the Mod was not in Load Order?

Edited by Halstrom
Link to comment
Share on other sites

Armor is form, you can't dinamically add a keyword to a form. You can check script functions that work for a Form script in the CK wiki.

AddKeyword is Object Reference function, will work for references.

 

 

Forgot to say, you can't get reference of any object while it's inside a container, so not sure it's possible to achiieve what you want.

Edited by kitcat81
Link to comment
Share on other sites

For your second question I think you're looking for https://www.creationkit.com/fallout4/index.php?title=IsPluginInstalled_-_Game

 

As for the first part, trying to add the keyword to every instance already existing and to be created. Not possible. You would need to override the original form by creating a dependency on the mod. Otherwise as kitcat81 stated previously you could add the keyword to any individual object refs you happen to desire.

Link to comment
Share on other sites

For your second question I think you're looking for https://www.creationkit.com/fallout4/index.php?title=IsPluginInstalled_-_Game

 

As for the first part, trying to add the keyword to every instance already existing and to be created. Not possible. You would need to override the original form by creating a dependency on the mod. Otherwise as kitcat81 stated previously you could add the keyword to any individual object refs you happen to desire.

 

Thanks for replies, I'm really trying to be good and not create hard dependancies of course, I may have to duplicate the assets to pull it off I guess :smile:

Edited by Halstrom
Link to comment
Share on other sites

  • Recently Browsing   0 members

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