I need to make a set of neutral garrisons with the following requirements.
1) Players need to be able to right click units into the neutral buildings as if they were their own bunkers.
2) Once inside the building, the building should convert to the owning players color until they leave the building, preventing any other player from garrisoning it.
3) When the building is down to 20% of its maximum health, it should no longer be considered a garrison and force any occupying units from it. If it is repaired to back above 20%, it will once again become a garrison.
Took a bit of tweaking (transport abilities have some quirks) but I have attached a map with modified bunkers with garrison functionality. How it works:
1) Very simple, changed the Bunker Load ability target filters to include neutral units.
2) Some complexity creeps in. I've configured the Load ability so that it gives the bunker the "Occupied' behavior, which in turns periodically applies and refreshes a "Captured" behavior (it also periodically checks to bunkers health to make sure its useable). The "Captured" behavior is the meat of it that changes the owner of the bunker to its occupants, but the two behaviors are necessary to keep everything working (otherwise bunkers ownership changes immediately on unloading and ends up changing the ownership of the previously occupying units and we don't want that). There's also a number of validators in place to make sure then behaviors are only removed if the bunker is empty.
3) More validators. One validator is used to only allow the bunker to load units if its life is above 20%. The Occupied behavior also checks the bunkers health every time it refreshes the Captured behavior, and if the bunker's life dips below 20% if issues an order to the bunker to unload all (which in turn removes the Occupied behavior, which in turn fails to refresh the Captured behavior, allowing to fall off).
There may be a simpler way of creating this functionality but I could not find one.
I need to make a set of neutral garrisons with the following requirements.
1) Players need to be able to right click units into the neutral buildings as if they were their own bunkers.
2) Once inside the building, the building should convert to the owning players color until they leave the building, preventing any other player from garrisoning it.
3) When the building is down to 20% of its maximum health, it should no longer be considered a garrison and force any occupying units from it. If it is repaired to back above 20%, it will once again become a garrison.
What is the best way to go about doing this?
Took a bit of tweaking (transport abilities have some quirks) but I have attached a map with modified bunkers with garrison functionality. How it works:
1) Very simple, changed the Bunker Load ability target filters to include neutral units.
2) Some complexity creeps in. I've configured the Load ability so that it gives the bunker the "Occupied' behavior, which in turns periodically applies and refreshes a "Captured" behavior (it also periodically checks to bunkers health to make sure its useable). The "Captured" behavior is the meat of it that changes the owner of the bunker to its occupants, but the two behaviors are necessary to keep everything working (otherwise bunkers ownership changes immediately on unloading and ends up changing the ownership of the previously occupying units and we don't want that). There's also a number of validators in place to make sure then behaviors are only removed if the bunker is empty.
3) More validators. One validator is used to only allow the bunker to load units if its life is above 20%. The Occupied behavior also checks the bunkers health every time it refreshes the Captured behavior, and if the bunker's life dips below 20% if issues an order to the bunker to unload all (which in turn removes the Occupied behavior, which in turn fails to refresh the Captured behavior, allowing to fall off).
There may be a simpler way of creating this functionality but I could not find one.
@PirateArcade | I make games | Ask me things on Discord
I think I managed to replicate all of it.
Thanks!