Jump to content

Cant find keyword on power armor Omod while in workbench


Recommended Posts

De ja vu...

 

I'm trying to listen for a certain object mod being added to my power armor while im in the power armor workbench menu.

 

not sure of the best way to do it.

 

This is what i have so far...

(this script is attatched to a refrence alias in a quest)

("TESTKWD" keyword is attached to an object mod that is crafted in the power armor workbench)

Scriptname MPA_KWDTEST extends ReferenceAlias


Keyword Property TESTKWD Auto
Keyword Property powerArmorFurnitureKW Auto


Event OnInit()
    RegisterForTutorialEvent("PowerArmorWorkbenchEntered")
EndEvent

Event OnTutorialEvent(String asEventName, Message aMessage)
    if asEventName == "PowerArmorWorkbenchEntered"
        Debug.Notification("Entered workbench")
	    RegisterForTutorialEvent("moddingSuccesss")
    EndIf

    if asEventName == "moddingSuccess"
        Debug.Notification("modding sucess")

        ObjectReference[] nearbyPowerArmors = Game.GetPlayer().FindAllReferencesWithKeyword(powerArmorFurnitureKW, 200.0)
	If nearbyPowerArmors.Length > 0
	    ObjectReference nearestPowerArmor
	        float fnearestDistance = 9999.0
	        int i = 0
	      while (i < nearbyPowerArmors.Length)
	        float fcurrentDistance = Game.GetPlayer().GetDistance(nearbyPowerArmors[i])
	      if( fcurrentDistance < fnearestDistance )
	        nearestPowerArmor = nearbyPowerArmors[i]
		fnearestDistance = fcurrentDistance
	      endIf
		i = i + 1
	      endWhile

	    if(nearestPowerArmor)
                If nearestPowerArmor.HasKeyword(TESTKWD)
                    Debug.Notification("TESTKWD Found!")
		EndIf
	    EndIf
	Endif
    EndIf
EndEvent

im not getting the "modding succsess" debug, and im not getting the "TESTKWD Found" debug either.

 

 

Anyone know how i can listen for my keyword/Omod being added to the power armor?

Link to comment
Share on other sites

When the power armor is in the workbench, the powerArmorFurnitureKW gets removed, so instead you might want to find the workbench and check if that has your keyword, as I believe the "workbenchKeyword" gets added to the power armor itself making it a workbench.

Link to comment
Share on other sites

I'm not sure...see if you can get it from other workbench types (the "moddingsuccess" debug I mean), maybe it doesn't get sent from power armor workbenches or something. Also, I've had trouble before with getting certain tutorial events to fire, mainly "PowerArmorWorkenchExited", I may have done it wrong when I tried...but I could not get that to fire, ever. You could also try OnPlayerModArmorWeapon event instead, though I'm not sure if that would do exactly what you want.

 

Because I couldn't get "PowerArmorWorkenchExited" to fire before, I instead used:

 

 

 

bool InWorkbench = False



Event Actor.OnPlayerUseWorkBench(Actor akSender, ObjectReference akWorkBench)

If (akWorkBench.HasKeyword(AnimFurnWorkbenchPowerArmor))

     If (InWorkbench == False)

         InWorkbench = True

         RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerModArmorWeapon")

     ElseIf (InWorkbench == True)

             InWorkbench = False

             UnRegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerModArmorWeapon")

    EndIf

EndIf

EndEvent

 

 

 

It's not perfect and could be done better I'm sure but it always fired on Enter/Exit, and the "OnPlayerModArmorWeapon" always fired when I created or attached a mod to the frame.

 

(The above was attached to a quest by the way.)

 

 

Edit: Also you might want to try ""ModdingSuccess", but I don't know if the capitalization matters, that's just how the wiki spells it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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