I recently looked into how to automate the refilling of goods in Feudum, and I wanted to share how I created this feature.
The goal is to have a button in the toolbar that, when pressed, refills only empty spaces. The bag(our deck) contains various types of goods, each of which must be sended in a designated spot.
The button on toolbar(for example saltpeter) is a GKC defined like this:
Button text: Refill SaltpeterGKC: refillSaltpeterPre-select by location Specific Deck(here insert the deck where all goods resides)Pre-select by properties BasicName==saltpeterFixed number of pieces 6(in Feudum only 6 spaces are refilled at the beginning and at the dawn of Epoch III, this filter send GKC only to 6 pieces in the deck and it’s faster)
Now we need some pieces(emptyCheck) on the map. These are pieces placed in an At-Start Stack(one for each stack) with these traits:
BasicPiece Saltpeter 4s(I use the name of location printed on map)Marker GoodRefilled=saltpeterPrototype: refiller
This refiller prototype is defined with these traits:
Does not stack move=neverMarker type=refillerLayer empty.png(an image with 10% opacity used for positioning the At-Start Stack)
Finally the goods of same type inside the deck have these traits(of course use prototype here) :
Basic Name=saltpeterSend To Locationkey command=refillSaltpeterdestination any counter, selected by properties {GoodRefilled=="saltpeter" && StackSize==1}so you send only on non refilled spot
Done!
Now if you need to replenish more goods as in Feudum I’ve created a GKC for each good. These are fired with an Action button like this:
Hot Keys refillSaltpeterHKHot Keys refillSulfurHKHot Keys refillIronHK
and to hide GKCs in the toolbar delete button text fields.
I hope it’s clear.