This is the last library that I will post on this forum for a long time. I must keep some secrets if I want an exiting map! To explain this map, I think that I will try by the FAQ method. This library is relatively easy to understand and it will be easy for you to use it in your map. So what are we wainting for? Let's get started!
What is C&C and why you have choose this example?
C&C is the game made by Westwood named Command and Conquer and in this game, if you have played, you will surely remember that the worker unit, the harvester, can accumulate a large quantity of resources before to go back to the drop-off building, the refinery. When I tried to do that in the galaxy editor, I quickly saw that it was impossible by the normal way, so I decided to do that workaround to prove that it is still possible.
What are the modifications you have done to make this possible?
I have actually created 4 units, 5 actors, 3 abilities, 1 button, 4 behaviors about 10 triggers to make a harvester cargo unit and a functionnal resource unit. You must understand that I need to create a new resource that is similar to tiberium in CNC, so a resource with only an amount of 4 that deplete in 1 shot.
Is there a special way to harvest this resource?
Open the map and test it in Starcraft 2. My resource is exactly like normal mineral, so you only have to right click on 1 node to begin harvesting. When the harvester reaches 4 nodes in its cargo, the last will be harvested normally so the unit will go back to the drop-off zone.
How does it actually works?
To make a short story, when you harvest the first node, it activates a trigger that destroy the resource to create 1 cargo unit inside your harvester. If you decide to drop this resource, the cargo unit will be destroyed and a new resource node will be created at the same place. The reason why I did it is simply that resource nodes cannot be cargo units. For example, my cargo resource is actually a dummy SCV with a resource type and state. This flag is important because I use it as a filter for my transport ability (to prevent 1 harvester to go inside another).
Great, but if I get attacked during I harvest and I'm not full, can I still go back to the drop-off zone?
Sure, this is why I have created the ability 'return even if not full'. This ability did nothing except activating another trigger. It's a little bit complicated, but when you click on this ability, the trigger destroys 1 cargo unit and create a new resource node that is instantly gathered by the harvester. To make sure that there is no bug, I make the harvester uncommandable for 0.2 seconds.
For example, I'm attacked and I use the ability 'return even if not full', but after the fight I'm far from the command center and I want to reharvest before going back. How can I do that?
This is the reason of my fourth trigger 'not full reharvest'. If you right click on a resource node to harvest it and you are not full, this trigger will destroy the resource node to create 1 cargo unit back inside the transport and you'll be able to harvest like nothing happened. In the galaxy editor, a worker that have 'harvested' is simply a unit with with a set property (carried resource) and a behavior 'carry mineral purple' to specify a loaded worker with its specific resource.
What happen if I harvest the cargo mineral and after I go at the refinery?
The harvester will simply harvest 1 vespene gas and when it will comes back to the command center, it will drop its vespene and its cargo. If you do the inverse (vespene and after cargo mineral), I put some script in my triggers to prevent the use of 'return even if not full' or anything else that could destroy the carried vespene. You must understand that this is workaround, so I patched for every possibility to have the least possible bugs.
Now, how can I get it to my map with my resources?
I recommand you to copy, in first, the things that are nessecary, like behaviors, resource units, button and abilities. the carry actor I've created is for aesthetical.For example, if your last harvested resource is a mineral cargo, the carried mineral will be purple, not blue. After all the datas are copied, you can go with the library (you can start with the library, but all the links with the data panel will return unknown).
Don't think that it will be easy to copy everything. They are several things that you must change in the data and trigger panel to fit your resource and if you got more than 1 type of cargo resource, it'll give you more challenge.
Everything works in my map, except that my harvester don't do its gather animation, why?
You simply need to add 1 actor event, ability, where you can select your gather ability and select start in the sub name. After that, use the action 'animation play' with the property that fits 'attack, works, start work,etc.'. Maybe you will need to open the cutscene editor to find which animation fits the most for your harvester with the ability. My harvester have this event, so you can use it as example.
Now the next question will be about making variant of my ability. I can't explain all the things you can change, because there is almost infinite possibilities, but I think that the next lines will help you a little bit.
If I want to change the resource type, how can I do that?
1. Change the mineral cargo 'resource type' and 'drop off' from 'mineral' to yours. You must do the same with the 'mineral field resource' and 'mineral field instant unit'.
2. Change the 'resource acquire+' in the cargo gather ability from 'mineral' to yours.
3. Go in the trigger panel and modify, inside the drop-off action definition, the action 'modify player resource' type from minerals to yours. In last, do in the action definition 'not full reharvest' and modify the unit's property 'carried minerals' to yours. Maybe there is something else, but I think that's all.
And how can I change the number of cargo units inside the harvester?
1. Change the maximum number of cargo unit in the mineral transport ability from 4 to yours.
2. Go in the trigger panel and go in the action definition 'harvest'. You must change 2 numbers (they are easy to spot, it's the number '4' at 2 places).
To conclude, remember that my map is not an exact science, but the sum of my trials and errors. If you got new ideas or you want to improve something, I'm always open to listen you!
P.S: I suggest you to go to my other libraries to leave comments and suggestions and I have finally done a wish list on the official forum of Starcraft 2. My only demand is that people who see, like and use my libraries could go on the battle.net forum and like my comments about the improvement for the editor. It's not an obligation, but It would me make very happy! Here is the link for the forum : http://us.battle.net/sc2/en/forum/topic/6307501153?page=6#110
Looks like patch 2.0.4 broke return cargo and only smart command is working (right click on drop off)
It seems like instead of moving to drop off harvester is trying to drop it where it stand could someone take a look please?
You know... I don't understand. In my main map, everything works perfectly, but in this map the return cargo is broken even on the scv gather ability. I transfered my library and it works fine, so I can't really help you.