I made it so that when a worker is ordered to harvest minerals, it will forever harvest from the targeted ore chunk without ever returning to a building (the income is generated via GPTP plugin while the unit harvests).
Firegraft SettingsThe problem: When AI is given "Area Town" in the editor, their SCVs will pause for 20 seconds every 60 seconds.
VIDEOmini mod for testing it
Post has been edited 3 time(s), last time on Aug 8 2021, 9:19 am by Netbek.
AI will need breaks in between mining to check when new buildings can be setup up since that happens on cargo return, but... Does this even work with AI at all? Can it build?
Does this even work with AI at all? Can it build?
The AI in my mod does not need to build stuff. For now, the only thing it needs to do, is have its workers harvest forever.
Still no solution. Some ideas:
- Is there a way to make harvesters instantly "return" the carried resource piece at the location where they are?
- Is there a way to decrease how close they have to be to the building they return to.
In orders_ReturnHarvest, maybe you should try moving the
u8 orderId;
if (unit->pAI != NULL)
orderId = OrderId::ComputerAI;
else
if(unit->resourceType != ResourceCarried::Vespene)
orderId = OrderId::MoveToMinerals;
else
orderId = OrderId::HarvestGas1;
if (unit->worker.targetResource.unit != NULL)
function_00474A70(unit, unit->worker.targetResource.unit, orderId);
else
orderImmediate(unit, orderId);
unit->orderToIdle();
function_004F39A0(unit);
if (unitTypeIsHatcheryType(target))
function_004E92B0(unit, target);
part to replace
if (orderToMoveToTarget(unit, target))
unit->mainOrderState = 1;
above that make the unit move until reaching the resource depot or until being unmovable somehow
In orders_ReturnHarvest [...]
I cannot find
orders_ReturnHarvest in GPTP. I use
GPTP-For-VS2008-Update-4. Am I overlooking something?

Responsible for my own happiness? I can't even be responsible for my own breakfast
Yes, the newest GPTP can be found here:
https://github.com/BoomerangAide/GPTP
This works exactly as I wanted, thank you!
I had to switch from GPTP-For-VS2008 (Visual Studio 2008) to GPTP-master (Visual Studio 2019) for this. It could be a bit tedious to copy over everything I had changed into the new version. Is there an elegant way, maybe even automatic? (
new thread here)
Sidenote for future readers:
[...]above that make the unit move until reaching the resource depot or until being unmovable somehow
I did not need this, the code UndeadStar posted solved the problem without any further steps.
Post has been edited 1 time(s), last time on Aug 16 2021, 1:51 pm by Netbek.