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.
[2026-10-11. : 6:02 am]
Donald -- Samase
[2026-10-09. : 2:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[2026-10-09. : 2:47 am]
Symmetry -- I'll check it out this weekend!
[2026-10-09. : 2:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[2026-10-09. : 2:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[2026-10-09. : 1:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[2026-10-09. : 1:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[2026-10-09. : 1:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
[2026-10-09. : 1:31 am]
Ultraviolet -- Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Please log in to shout.


Members Online: Symmetry, Butch, Ultraviolet