Jump to content

How to count the amount of an individual item placed in settlements


Citizenbari

Recommended Posts

Hello,

 

i need some help to solve this problem (my skills end here..), if someone has a solution i would be very very happy :smile:

 

Problem:

 

I want to find out the number of a certain item when it is placed in an settlement. This amount should be available in a GlobalVar,

so that I can query this GlobalVar value within packages / conditions.

 

For example: If in Covenant, Taffington Boatshouse and Sanctuary each one of this item is placed then the GlobalVar should contain "3"

 

Right now i am already able to get the info if this object is in the local area placed by using the condition "LocationHasRefType" and

assign the Furniture / item to my created ForceRefType category.

 

 

Additional question:

Is it ok to choose already ingame placed item (like a car or road sign) to let an NPC travel to that destination

(with an individual package) or does it have to be an xmarker/xmarker heading?!

Edited by Citizenbari
Link to comment
Share on other sites

What types of objects are you interested in, are they base game or have you created therm so you can attach scripts ?

 

Actor AI package travel targets can be any ObjectReference as long as they can path to them, best to allow a "near" radius ~512 units incase they are not attached to navmesh.

Link to comment
Share on other sites

Thank you for your post SKK50,

 

meanwhile Kitcat81 helped me here. The following script does exactly what i needed. I hope it helps others who have equal problem too!

The script attached to a workshop object (chair, table whatever, more than one is possible) will count the amount and set it in a GlobalVar (in this case GlobalVar name is "x").

The GlobalVar hast to set in the properties of the script! When the object is destroyed or removed the value will change.

 

 

 

GlobalVariable Property XObjectCount Auto Const ; the property must be filled with your global variable

Event OnWorkshopObjectPlaced(ObjectReference akReference)
XObjectCount.SetValue(XObjectCount.GetValue() + 1) ; adds 1 to the global count when the object is created in the workshop
EndEvent

Event onWorkshopObjectDestroyed(ObjectReference akReference)
XObjectCount.SetValue(XObjectCount.GetValue() - 1) ; removes 1 from the global count when the object is destroyed or stored.
EndEvent

Edited by Citizenbari
Link to comment
Share on other sites

  • Recently Browsing   0 members

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