Staredit Network > Forums > Modding Assistance > Topic: I made SCVs harvest the same mineral patch forever...
I made SCVs harvest the same mineral patch forever...
Aug 5 2021, 2:07 pm
By: Netbek  

Aug 5 2021, 2:07 pm Netbek Post #1



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 Settings

The problem: When AI is given "Area Town" in the editor, their SCVs will pause for 20 seconds every 60 seconds.
VIDEO
mini mod for testing it

Post has been edited 3 time(s), last time on Aug 8 2021, 9:19 am by Netbek.




Aug 7 2021, 7:45 am Nekron Post #2



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?




Aug 7 2021, 9:43 am Netbek Post #3



Quote from Nekron
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.




Aug 10 2021, 11:32 am Netbek Post #4



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.




Aug 10 2021, 11:43 am UndeadStar Post #5



In orders_ReturnHarvest, maybe you should try moving the
Code
                    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
Code
                if (orderToMoveToTarget(unit, target))
                    unit->mainOrderState = 1;

above that make the unit move until reaching the resource depot or until being unmovable somehow




Aug 12 2021, 6:26 pm Netbek Post #6



Quote from UndeadStar
In orders_ReturnHarvest [...]
I cannot find orders_ReturnHarvest in GPTP. I use GPTP-For-VS2008-Update-4. Am I overlooking something?




Aug 12 2021, 6:50 pm Voyager7456 Post #7

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



all i am is a contrary canary
but i'm crazy for you
i watched you cradling a tissue box
sneezing and sniffling, you were still a fox


Modding Resources: The Necromodicon [WIP] | Mod Night
My Projects: SCFC | ARAI | Excision [WIP] | SCFC2 [BETA] | Robots vs. Humans | Leviathan Wakes [BETA]


Aug 16 2021, 1:44 pm Netbek Post #8



Quote from UndeadStar
[...]
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:
Quote from UndeadStar
[...]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.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
Please log in to shout.


Members Online: Revenant