In my map, neutral buildings are taken over by garrisoning a player's unit inside. Emphasis is on commandeering existing structures. Building or repairing will be time and resource-intensive by design.
The solution I've worked out is susceptible to abuse and another avenue is needed.
The Big Picture
Before I explain the issue, let me first share the different neutral buildings and how they will function differently:
My ad hoc solution
I gave the orc peon an ability based on Purge (orc shaman). When targeting a neutral structure, that neutral structure will cast Devour (kodo) on the casting peon.
Here's that trigger. Note that by "farm" I mean "burrow":
I thought I figured this out with the second trigger:
This works if you select the burrow and click the ability "Stand Down". It doesn't work if you unload the peon by clicking on the portrait. He leaves the burrow and it stays in your ownership.
My assessment
From playing with this and doing a little reading, it seems unlikely that I can do this using straight-forward Events and Conditions. (Update: I was wrong, it is possible using order(unload).)
A Hive member asked about this very thing in March 2010: how can i make a unit garrison inside a neutral building and change its owner
That's where I got the idea to use Devour, because I couldn't get Battle Stations to work. If anyone has ideas to make Battle Stations work without Devour, I'm all ears (think it'd be a bit more elegant, no?).
Others alluded to solutions involving "custom data to control units count (0-4)". That same user made an other post I didn't really understand:
I'm assuming this guy is right (or close).
Asking for guidance
I've done my best to research this problem further but didn't turn anything up. If anyone is able to find and share a relevant thread, that'd be great.
The solution I've worked out is susceptible to abuse and another avenue is needed.
The Big Picture
Before I explain the issue, let me first share the different neutral buildings and how they will function differently:
- orc burrow
- +10 food
- Cargo Hold ability modified to hold 1 peon-type unit.
- haven't decided if I want an attack function from this.
- Creates a farmstead (Undead blight) on which other farms cannot be constructed.
- watchtower
- based on orc burrow unit.
- Cargo Hold ability modified to hold 4 or more ground units (non-peon).
- attack-speed increases as more units are added (just like orc burrow).
- lumber mill
- Cargo Hold ability modified to hold 1 peon-type unit.
- town hall
- uncertain how I want to use the Cargo Hold ability and which type of units it will garrison, but this will enable players to harvest gold from a gold mine.
My ad hoc solution
I gave the orc peon an ability based on Purge (orc shaman). When targeting a neutral structure, that neutral structure will cast Devour (kodo) on the casting peon.
Here's that trigger. Note that by "farm" I mean "burrow":
-
Control Farm
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
((Ability being cast) Equal to Control Farm ) and (((Owner of (Target unit of ability being cast)) Equal to Neutral Passive) and ((Unit-type of (Target unit of ability being cast)) Equal to Orc Burrow))
-
-
Actions
-
Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
-
Unit - Order (Target unit of ability being cast) to Orc Kodo Beast - Devour (Casting unit)
-
-
I thought I figured this out with the second trigger:
-
Lose Control of Farm
-
Events
-
Unit - A unit Finishes casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Stand Down
-
(Unit-type of (Triggering unit)) Equal to Orc Burrow
-
-
Actions
-
Unit - Change ownership of (Casting unit) to Neutral Passive and Change color
-
-
This works if you select the burrow and click the ability "Stand Down". It doesn't work if you unload the peon by clicking on the portrait. He leaves the burrow and it stays in your ownership.
My assessment
From playing with this and doing a little reading, it seems unlikely that I can do this using straight-forward Events and Conditions. (Update: I was wrong, it is possible using order(unload).)
A Hive member asked about this very thing in March 2010: how can i make a unit garrison inside a neutral building and change its owner
That's where I got the idea to use Devour, because I couldn't get Battle Stations to work. If anyone has ideas to make Battle Stations work without Devour, I'm all ears (think it'd be a bit more elegant, no?).
Others alluded to solutions involving "custom data to control units count (0-4)". That same user made an other post I didn't really understand:
There is Loading Unit pointer and unit custom value.
Custom value should be equal to loaded units count.
+1 per each loaded unit
-1 per each unloaded unit
And no need custom ability for this. Just script. Try in vJass section how to refer to easiest refer to loaded unit.
I'm assuming this guy is right (or close).
Asking for guidance
- Can someone help me understand the above comment?
- Will that comment, or any others in that thread, help solve my problem?
- Is there a simple enough solution that you can modify my triggers to work or write sample code?
- Do I need to be directed to a particular tutorial in order to help myself?
I've done my best to research this problem further but didn't turn anything up. If anyone is able to find and share a relevant thread, that'd be great.
Last edited: