Jump to content

Capabilities of: OnTutorialEvent - ScriptObject


Recommended Posts

thanks.

 

 

Scriptname CaDW_Drop_WW extends ObjectReference
Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const mandatory
MiscObject property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory auto const mandatory
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if (!akNewContainer && akOldContainer == game.getPlayer())
;self.MoveToNearestNavmeshLocation()
self.disable()
self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround)
utility.wait(0.5)
self.delete()
endif
endEvent
Event OnExitFurniture(ObjectReference akActionRef)
if (akActionRef == game.getPlayer())
utility.wait(1.0)
akActionRef.addItem(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory)
utility.wait(0.2)
self.delete()
endIf
EndEvent
Link to comment
Share on other sites

I suppose you want to detect drop of the item (on which the script is attached to) and then place wokbench on the ground and when player exits that workbench, add that item back to player again.

 

I'll sugest to use OnItemRemoved instead:

Scriptname CaDW_Drop_WW extends ObjectReference
 
Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const mandatory
MiscObject property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory auto const mandatory

Event OnInit()
 AddInventoryEventFilter(None)
Endevent

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
 if !akDestContainer
  ;self.MoveToNearestNavmeshLocation()
  self.disable()
  self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround)
  utility.wait(0.5)
  self.delete()
  endif
endEvent
 
Event OnExitFurniture(ObjectReference akActionRef)
 if (akActionRef == game.getPlayer())
  utility.wait(1.0)
  akActionRef.addItem(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory)
  utility.wait(0.2)
  self.delete()
 endIf
EndEvent
Link to comment
Share on other sites

Thanks for the prompt response. I forgot to say what the problem was with the script. Well it droped and converted into the workbench fine. I could use it but on exiting the menu It did not readd to my inventory or disappear from the game world.

 

 

I have just tested the script you sent me and it just drops the misc object without converting it into furniture.

 

Sorry again for not telling you the problem.

Edited by stonefisher
Link to comment
Share on other sites

ok, if it was placing workbench then use OnContainerChanged, seems I have something wrong with OnItemRemoved (I think it's problem with filtering) but never mind OnContainerChanged works. Try this:

Scriptname CaDW_Drop_WW extends ObjectReference
 
Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const mandatory
MiscObject property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory auto const mandatory
 
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
 if (!akNewContainer && akOldContainer == game.getPlayer())
  ;self.MoveToNearestNavmeshLocation()
  self.disable()
  ObjectReference workbenchRef = self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround)
  utility.wait(0.5)
  self.delete()
  endif
endEvent
 
Event OnExitFurniture(ObjectReference akActionRef)
 if (akActionRef == game.getPlayer())
  utility.wait(1.0)
  workbenchRef.disable()
  akActionRef.addItem(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory)
  utility.wait(0.2)
  workbenchRef.delete()
 endIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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