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.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Roy, RIVE, IlyaSnopchenko