Jump to content

Recommended Posts

Posted

Just like the title says - how do you make a script run when a mod is applied to an armor/weapon?

(ideally i would like to run a script the second the mod is applied - before the player closes the workbench menu)

 

 

ive tried adding the script to the armor mod's miscmod, but nothing...

ive tried making the objectmod add a keyword for a script in the armor record to detect and do stuff - but for some reason it doesnt find the keyword in the armor.

(maybe i have to search the actor for the keyword not the actual armor itself?)

 

anyone know how to do this?

Posted (edited)

I would use OnTutorialEvent with "ModdingSuccess".

https://www.creationkit.com/fallout4/index.php?title=OnTutorialEvent_-_ScriptObject

 

I didn't tried it, but I think that attaching the script to the weapon or armor where the mod is going to be applied, and the mod adds a keyword to it, the script would be something like that:

Scriptname WeaponOrArmorModded extends ObjectReference

Keyword Property KeywordOfTheMod Auto

Event OnInit()
	RegisterForTutorialEvent("ModdingSuccess")
EndEvent

Event OnTutorialEvent(String asEventName, Message aMessage)
	If(asEventName == "ModdingSuccess")
		If(HasKeyword(KeywordOfTheMod))
			Debug.MessageBox("Mod applied")
		EndIf
	EndIf
EndEvent
Edited by DieFeM
Posted (edited)

I've noticed that Once the event is received, you will be unregistered automatically for RegisterForTutorialEvent, you may want use an "else" statement in order to re-register it if the mod installed was for other weapon/armor or mod.

Scriptname WeaponOrArmorModded extends ObjectReference

Keyword Property KeywordOfTheMod Auto

Event OnInit()
	RegisterForTutorialEvent("ModdingSuccess")
EndEvent

Event OnTutorialEvent(String asEventName, Message aMessage)
	If(asEventName == "ModdingSuccess")
		If(HasKeyword(KeywordOfTheMod))
			Debug.MessageBox("Mod applied")
		Else
			RegisterForTutorialEvent("ModdingSuccess")
		EndIf
	EndIf
EndEvent
Edited by DieFeM
  • Recently Browsing   0 members

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