• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

SetSlowChopping() makes undead ghouls not harvest lumber?

Status
Not open for further replies.
Level 3
Joined
Jul 5, 2022
Messages
16
Hello to you all,
I've ran into a strange issue. I'm working on a map where I make use of AI editor. The AI is an vanilla undead race except one thing and that is it makes use of a custom hero. I have everything setup - the build order and worker priorities. Here is where it gets strange. I obviously set Ghouls as workers to harvest lumber BUT they only harvest lumber when SetSlowChopping is set to false. I want them to chop trees even though I set slow harvesting to true but that doesn't seem to work. The AI will simply train the ghouls and makes them hang around the base doing nothing. Any idea what's the issue and how could I fix it?

EDIT: So today I tested it on a fresh empty map. I placed a gold mine and trees as well as AI starting position. And still when the SetSlowChopping() is se to true the ghouls won't harvest any lumber.
 
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
why can't we just disable slowchopping? you did put the true/false parameter in the parenthesis?

I can't find out exactly what slowchopping does in the api manual.
 
Last edited:
Level 3
Joined
Jul 5, 2022
Messages
16
why can't we just enable slowchopping? you did put the true/false parameter in the parenthesis?

I can't find out exactly what slowchopping does in the api manual.
Yes the parameter is provided correctly.

SetSlowChopping (Or Slow Harvesting from AI editor) should make the AI harvest 1 gold and 1 lumber massively putting the AI to economic disadvantage.
 
Level 18
Joined
Mar 16, 2008
Messages
721
are you using the gui editor or manually editing the code? How are you currently making the AI harvest any amount of gold/lumber?

here is the JASS of what GUI AI Editor generates

JASS:
//===========================================================================
// Specifies harvesting priorities for workers
//===========================================================================
function HarvestPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    local integer allGold = GetUnitCountDone(PEASANT)
    local integer allWood = GetUnitCountDone(PEASANT)
    local integer numWorkers
    set numWorkers = 1
    call HarvestGold( 0, numWorkers ) /// has 1 workers mine gold at first town "town 0"
    set numWorkers = 1
    call HarvestWood( mine, numWorkers )  /// has 1 worker harvest lumber, the "mine" parameter seems to make it harvest gold at any town. not an expert on this but this should have the same effect as SlowChopping?
endfunction

//===========================================================================
// Determines all building and harvesting assignments for workers
//===========================================================================
function WorkerAssignment takes nothing returns nothing
    loop
        call UpdateConditions(  )

        // Harvesting
        call ClearHarvestAI(  )
        call HarvestPriorities(  )

        // Building
        call InitBuildArray(  )
        call BuildPriorities(  )

        call Sleep( 2 )
    endloop
endfunction

...
    call StartThread( function WorkerAssignment )
...

So this is a thread which I understand to mean it keeps running over and over again.
 
Last edited:
Level 3
Joined
Jul 5, 2022
Messages
16
are you using the gui editor or manually editing the code? How are you currently making the AI harvest any amount of gold/lumber?

here is the JASS of what GUI AI Editor generates

JASS:
//===========================================================================
// Specifies harvesting priorities for workers
//===========================================================================
function HarvestPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    local integer allGold = GetUnitCountDone(PEASANT)
    local integer allWood = GetUnitCountDone(PEASANT)
    local integer numWorkers
    set numWorkers = 1
    call HarvestGold( 0, numWorkers ) /// has 1 workers mine gold at first town "town 0"
    set numWorkers = 1
    call HarvestWood( mine, numWorkers )  /// has 1 worker harvest lumber, the "mine" parameter seems to make it harvest gold at any town. not an expert on this but this should have the same effect as SlowChopping?
endfunction

//===========================================================================
// Determines all building and harvesting assignments for workers
//===========================================================================
function WorkerAssignment takes nothing returns nothing
    loop
        call UpdateConditions(  )

        // Harvesting
        call ClearHarvestAI(  )
        call HarvestPriorities(  )

        // Building
        call InitBuildArray(  )
        call BuildPriorities(  )

        call Sleep( 2 )
    endloop
endfunction

...
    call StartThread( function WorkerAssignment )
...

So this is a thread which I understand to mean it keeps running over and over again.
Sorry for late reply.
I'm using the GUI editor. These are my worker assignment and harvest priorities
JASS:
//===========================================================================
// Specifies harvesting priorities for workers
//===========================================================================
function HarvestPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    local integer allGold = GetUnitCountDone('uaco')
    local integer allWood = GetUnitCountDone('ugho')
    local integer numWorkers
    set numWorkers = 5
    call HarvestGold( 0, numWorkers )
    set numWorkers = 4
    call HarvestWood( 0, numWorkers )
endfunction

//===========================================================================
// Determines all building and harvesting assignments for workers
//===========================================================================
function WorkerAssignment takes nothing returns nothing
    loop
        call UpdateConditions(  )

        // Harvesting
        call ClearHarvestAI(  )
        call HarvestPriorities(  )

        // Building
        call InitBuildArray(  )
        call BuildPriorities(  )

        call Sleep( 2 )
    endloop
endfunction
 
Level 18
Joined
Mar 16, 2008
Messages
721
so you want only 1 of each on gold and lumber? just set the number of workers to 1 in GUI or the script text.
JASS:
...
    set numWorkers = 5 /// 5 is how many workers you will have on gold
    call HarvestGold( 0, numWorkers ) /// 0 reffers to your main/starting town
    set numWorkers = 4 /// 4 is how many workers you will have on lumber
    call HarvestWood( 0, numWorkers ) /// again, 0 reffers to your main/starting town
...

call HarvestGold ( town number , how many workers)
call HarvestWood ( town number , how many workers)
 
Level 3
Joined
Jul 5, 2022
Messages
16
so you want only 1 of each on gold and lumber? just set the number of workers to 1 in GUI or the script text.
JASS:
...
    set numWorkers = 5 /// 5 is how many workers you will have on gold
    call HarvestGold( 0, numWorkers ) /// 0 reffers to your main/starting town
    set numWorkers = 4 /// 4 is how many workers you will have on lumber
    call HarvestWood( 0, numWorkers ) /// again, 0 reffers to your main/starting town
...

call HarvestGold ( town number , how many workers)
call HarvestWood ( town number , how many workers)
I understand that but I think you don't understand what I want or perhaps my apologies I didn't express myself right. I don't want one worker on gold and one worker on lumber. I want 5 workers (acolytes) on the gold mine and 4 workers (ghouls) on lumber. I want them to harvest 1 gold mine per second and 1 lumber from trees. I know I can achieve that by using SetSlowChopping to true. But the problem is, when this option is se to true the ghouls won't harvest any lumber (like at all, they are not working, they're just sitting in the base), the acolytes however work with this option and are mining 1 gold per second from a gold mine. When this option is set to false, the ghouls will normally harvest trees. I want them to work even though the option is se to true. Here's a code on how the option is enabled

JASS:
...
//***************************************************************************
//*
//*  Basic Options
//*
//***************************************************************************

//===========================================================================
function InitOptions takes nothing returns nothing
    call SetCampaignAI(  )
    call SetDefendPlayer( true )
    call SetRandomPaths( true )
    call SetTargetHeroes( true )
    call SetPeonsRepair( true )
    call SetHeroesFlee( false )
    call SetHeroesBuyItems( false )
    call SetUnitsFlee( false )
    call SetGroupsFlee( false )
    call SetWatchMegaTargets( true )
    call SetIgnoreInjured( true )
    call SetHeroesTakeItems( false )
    call SetSlowChopping( true ) // <- This is the option I'm talking about
    call SetCaptainChanges( false )
    call SetSmartArtillery( false )
endfunction
...
...
function main takes nothing returns nothing
    ...
    call InitOptions(  )
    ...
endfunction

Perhaps I'm attaching a screenshot from GUI where this option is ticked
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    7.7 KB · Views: 5
Level 18
Joined
Mar 16, 2008
Messages
721
so you one each following mine to have 1 on gold? you can do that in GUI

1657472459180.png

or
JASS:
...
    set numWorkers = 5
    call HarvestGold( 0, numWorkers )
    set numWorkers = 4
    call HarvestWood( 0, numWorkers )
    set numWorkers = 1
    call HarvestGold( 1, numWorkers )
    set numWorkers = 1
    call HarvestWood( 1, numWorkers )
...
 
Status
Not open for further replies.
Top