Jump to content

Photo

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

settlement; packages; itemcount; scripting;

  • Please log in to reply
4 replies to this topic

#1
Citizenbari

Citizenbari

    Regular

  • Members
  • PipPip
  • 74 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, 30 January 2020 - 05:39 PM.


#2
Citizenbari

Citizenbari

    Regular

  • Members
  • PipPip
  • 74 posts

.


Edited by Citizenbari, 06 February 2020 - 05:58 PM.


#3
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 4,082 posts

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.



#4
Citizenbari

Citizenbari

    Regular

  • Members
  • PipPip
  • 74 posts

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, 09 February 2020 - 02:40 PM.


#5
Zorkaz

Zorkaz

    Faithful poster

  • Premium Member
  • 2,310 posts

Cool. Please post a link to your mod here, once you're finished. I'm really curious about how you are using it







Also tagged with one or more of these keywords: settlement;, packages;, itemcount;, scripting;

Page loaded in: 1.169 seconds