• 🏆 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!

Custom Harvest System for Multiple Resources

Status
Not open for further replies.
Level 11
Joined
Mar 31, 2016
Messages
657
My medieval map needs multiple custom resources similar to Age of Empires.

Gold will be swapped out with food, lumber is default, and food is now population

In addition to the standard 3 wc3 resources are Clay, Stone, Ore, and Gold.
Each of these would be mine-able units/destructible similar to how trees are harvested except with the harvest gold animation so that it carries a bag instead.

Food would also be harvested with a bag using the gold animations however they would work on berry bushes, animal corpses and farms (or crops that grow on farms). Also want to add some functionality to replant crops/farms from the granary/windmill.

The new mined resources would be displayed via multiboard or (if possible) custom ui.

Appreciate any advice or help on getting this done. Thanks.
 
Level 18
Joined
Nov 21, 2012
Messages
835
Generally what you asking for is not easy but I think I am able to write a system for you based on like Peasant harvest trees.

Do you want Miner should be able to gather Clay, Stone, Ore, and Gold etc *or*
you planing to make diffrent Miners for diffrent resources.

All resource type will be based on destructable-tree (diffrent models, no limit)
Will be neccesary to configure in OE: separate abilities for each resource-type,
making a list of structures where Miners brings back the resources, as well as making list of Miners

I think it would be good for public use, maybe Ill write it and upload to the spell section.
This will be much simpler then [GUI] Custom Resource Harvest System 1.05

The only issue I cannot get rid of is:
when Miner can harvest multiple resources:
he's harvesting a Stone which are over; and then if Miner has free space he auto-harvest to nearby Ore (for example), then all stones he had in his hands will vanish. If this is not a problem then I start work on this
 
Level 11
Joined
Mar 31, 2016
Messages
657
Generally what you asking for is not easy but I think I am able to write a system for you based on like Peasant harvest trees.

Do you want Miner should be able to gather Clay, Stone, Ore, and Gold etc *or*
you planing to make diffrent Miners for diffrent resources.

All resource type will be based on destructable-tree (diffrent models, no limit)
Will be neccesary to configure in OE: separate abilities for each resource-type,
making a list of structures where Miners brings back the resources, as well as making list of Miners

I think it would be good for public use, maybe Ill write it and upload to the spell section.
This will be much simpler then [GUI] Custom Resource Harvest System 1.05

The only issue I cannot get rid of is:
when Miner can harvest multiple resources:
he's harvesting a Stone which are over; and then if Miner has free space he auto-harvest to nearby Ore (for example), then all stones he had in his hands will vanish. If this is not a problem then I start work on this

Hey thanks a bunch for offering your help.

I have ~15 types of workers and I want them all to be able to harvest all resources.
Hmm, I would prefer one ability to harvest any of resource because there wouldn't be enough room for all the buttons (6 harvest-able resources in total).
Maybe we can use a dummy harvest ability to trigger the specific resource harvest ability?
Clay, Stone, Ore, and Gold all return to the Stone Mill (The Stone Mill has 4 upgrade-able tiers though), so Stone Mill (1), Stone Mill (2), etc.
Food should be returned to the Granary (this one has 3 upgrade-able tiers).
Worker (1)-(4) x2 (one is male, other female), Architect (1)-(3), Engineer (1)-(2)

Hmm, not sure how to get around that... that is a problem. Is there a way to cancel auto-harvest if a resource node runs out and there is no more of that resource nearby?
I currently have a stone gathering system based off of units which works well after a resource node runs out - however its based off of unit resource sources, so idk if it'll be helpful for this trigger. Still, if you want I'll send it to you (or the map).

Great! Hopefully this harvest system is the best ones yet and helps many people.
Awesome, I'm hyped - you sound like you know what you're doing mate. Credits in the map will be given.
 
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
Hmm, I would prefer one ability to harvest any of resource because there wouldn't be enough room for all the buttons (6 harvest-able resources in total).
dont worry, harvest abilities will be changed in-run-time, it will still occupied 1 slot in unit's interface, moreover it offers diffrent settings (how much resource per worker hit and how much can he carry)
Is there a way to cancel auto-harvest if a resource node runs out and there is no more of that resource nearby?
well, I thought not, but now there's light at the end of the tunnel :)
just thought we can catch "harvest" order with target destructable,and if it is not at "return resources time" we can cancel it. Let me make few test.
I currently have a stone gathering system based off of units
thats a diffrent story, maybe you will be able to abandom this one if I succeed
 
Level 11
Joined
Mar 31, 2016
Messages
657
dont worry, harvest abilities will be changed in-run-time, it will still occupied 1 slot in unit's interface, moreover it offers diffrent settings (how much resource per worker hit and how much can he carry)

well, I thought not, but now there's light at the end of the tunnel :)
just thought we can catch "harvest" order with target destructable,and if it is not at "return resources time" we can cancel it. Let me make few test.
thats a diffrent story, maybe you will be able to abandom this one if I succeed

Perfect - will carry amounts be upgrade-able ?

Alright! Hopefully we can get that worked out somehow.

Of course I would, the current system is slightly bugged even after several fixes. Also I always preferred destructibles to be uniform with trees in terms of selection/interface. I'm currently working to upgrade my map from Alpha to Beta with some new systems - so far I implemented walk-able walls, stairs, & ladders and a new construction system that requires multiple workers and worker types to build and upgrade. With the addition of custom resources, this medieval project is approaching next level RTS and could be a major hit.
 
Level 18
Joined
Nov 21, 2012
Messages
835
Basically we have 2 types of structures, workers can return resources to.
First can recive gold. (ability 'Argd')
Second can recive lumber (ability 'Arlm') and all custom lumber-based resources.
Im working on lumber-based custom resources only, so you have unlimited custom resources but harvested like lumber.
Clay, Stone, Ore, and Gold all return to the Stone Mill
Food should be returned to the Granary
This is hard to perform.

But if you gather food (like gold, gold-based) and
Clay, Stone, Ore, and Gold (like lumber-based) then we can easy divide returning structures.

Or maybe consider to use meat wagon based solution to get a food (corpse based)?

Again: new system will be lumber harvest based. Structures with 'Arlm' will be able to recive all custom resources as well as original wood.
 
Level 11
Joined
Mar 31, 2016
Messages
657
Basically we have 2 types of structures, workers can return resources to.
First can recive gold. (ability 'Argd')
Second can recive lumber (ability 'Arlm') and all custom lumber-based resources.
Im working on lumber-based custom resources only, so you have unlimited custom resources but harvested like lumber.


This is hard to perform.

But if you gather food (like gold, gold-based) and
Clay, Stone, Ore, and Gold (like lumber-based) then we can easy divide returning structures.

Or maybe consider to use meat wagon based solution to get a food (corpse based)?

Again: new system will be lumber harvest based. Structures with 'Arlm' will be able to recive all custom resources as well as original wood.

Nice - looks legit. Perfect - however will the gold animations play?

Awesome - that is the plan. Indeed, food is replacing the default gold. Those four are all mine-able so might as well have them in all custom.

Well, the goal is to have food work like in Age of Empires II - harvested from animal corpses, berry bushes, and farms (or destructible crops that grow on farm).
I'm not exactly sure how it would work, however if you think that's what should do done, then by all means go ahead.

Hmm - that's a bit of an issue. Because lumber is supposed to go to lumber mill (1)-(4) and all the mine-able resources go to the stone mill (1)-(4).
Is there a way to restrict returning custom resources to lumber mill? Or any other ways of solving this?
OR maybe if lumber was gold based would it work? Then food would be lumber based - might not have the same issue since harvesting is a bit different?
 
Level 18
Joined
Nov 21, 2012
Messages
835
ok, today found a solution for returning structures
I think if system going to be for a public use, it should be configurable as follow
For each custom lumber-based resource you have to:
  • define list of workers who are able to harvest this resource
  • define list of destructables that gives this resource (must be "tree" based)
  • define list of structures able to recieve this resource (must have 'Arlm' or 'Argl')
  • make 1 ability for harvest/return (I based them on 'Ahrl' in tests)
hope it will meet your requirements ;)
about animations: workers will use "Lumber" animation for all those custom resources
 
Level 11
Joined
Mar 31, 2016
Messages
657
ok, today found a solution for returning structures
I think if system going to be for a public use, it should be configurable as follow
For each custom lumber-based resource you have to:
  • define list of workers who are able to harvest this resource
  • define list of destructables that gives this resource (must be "tree" based)
  • define list of structures able to recieve this resource (must have 'Arlm' or 'Argl')
  • make 1 ability for harvest/return (I based them on 'Ahrl' in tests)
hope it will meet your requirements ;)
about animations: workers will use "Lumber" animation for all those custom resources

Awesome - you are a pro mate.

Sounds easy enough. If everything works this will be a break through harvest system - and the best one yet.
It will be more than satisfactory if everything works. Also I think the rest of Hive will really enjoy this - also many other projects can use this.
Hmm - is there a way I can do an if/then/else thing to trigger the animation? or put gold animation tags in the harvest ability?

Also I was wondering - do you have any sense of when you'll be done with the system?
 
Level 18
Joined
Nov 21, 2012
Messages
835
I am doing this once: call AddUnitAnimationProperties(u, "Lumber", false) for worker who is holding some resourceA but player orders to gather resourceB,
so worker "drops" what he has and walks to new resource

however manipulating animations is very hard, (I dont know a method) cause:
  • no order is issued when worker start harvesting
  • there's no such thing as "destructable takes damage"
so I'm unable to get a moment when harvest begins, sorry
basicly it already works but code is a mess :)
have to clean, check etc,
what you think: keeping resources values in hashtable is ok for you? (how many resourceA/B/.. gather each player)
Im using hash and can use it for keeping these values
 
Level 11
Joined
Mar 31, 2016
Messages
657
I am doing this once: call AddUnitAnimationProperties(u, "Lumber", false) for worker who is holding some resourceA but player orders to gather resourceB,
so worker "drops" what he has and walks to new resource

however manipulating animations is very hard, (I dont know a method) cause:
  • no order is issued when worker start harvesting
  • there's no such thing as "destructable takes damage"
so I'm unable to get a moment when harvest begins, sorry
basicly it already works but code is a mess :)
have to clean, check etc,
what you think: keeping resources values in hashtable is ok for you? (how many resourceA/B/.. gather each player)
Im using hash and can use it for keeping these values

Alright - that command looks like it could work. Nice, ok.

Aw, hmm - what about switch animations when a specific resource's harvest ability is used?

Its ok- we can fix that issue later. In the mean time, I'll ask on chat if another knows how to trigger than in jass.

Oh hot dang ! That was quick mate. Alright, sounds great.

Yeah, hashtables are fine - my current stone gathering system uses hash. As long as it works, I'm okay with it.

Keep up the good work.
 
Level 18
Joined
Nov 21, 2012
Messages
835
what about switch animations when a specific resource's harvest ability is used?
Possible. But imagine you right-click on resource and worker which is far - start walking, animation is played at this moment. And it is played until we reset animation. To reset we have to periodicaly check for worker's current order I think, and reset when order==0. And it will not auto-reset when worker brings back resources to Lumber Mill or whatever structure.
In normal game animation starts playing when worker first time hits a tree for example but I cannot catch this event as I said before.
Do you have unit models as workers with multiple animations? So you want to play resource-defined animation on worker (with above side effect)?
And thanks for visiting some of spells I uploaded on Hive ;)
 
Level 11
Joined
Mar 31, 2016
Messages
657
Possible. But imagine you right-click on resource and worker which is far - start walking, animation is played at this moment. And it is played until we reset animation. To reset we have to periodicaly check for worker's current order I think, and reset when order==0. And it will not auto-reset when worker brings back resources to Lumber Mill or whatever structure.
In normal game animation starts playing when worker first time hits a tree for example but I cannot catch this event as I said before.
Do you have unit models as workers with multiple animations? So you want to play resource-defined animation on worker (with above side effect)?
And thanks for visiting some of spells I uploaded on Hive ;)

I see - so instead of triggering a specific animation, we would switch animation tags from lumber to gold so that all the animations still work: carry, work, etc.
Alright - perhaps somebody knows what that specific event is - I'll ask on chat later.
Yup, I have custom models based off of the peasant and its animations.
That's correct. My pleasure, thanks for posting them - I'll let you know how it goes when I implement them.
 
Level 18
Joined
Nov 21, 2012
Messages
835
we would switch animation tags from lumber to gold
yeah, thats the easiest way

almost finished tests and found something strange, I thought it was my mistake but seems that is the game engine: example
lets assume that Town Hall has ability 'Argl' and Keep has not this ability (edited in OE)
during upgrade peasants can normally deliver wood (works as always)
after upgrade is completed: auto-resumeharvesting doesnt work, left-click on icon "return resources" doesnt work also, but right-click on Town Hall (smart order) works and Peasant will deliver wood. Although Town Hall has no ability "return gold/lumber" 'Argl' (!)

It can mess the system a little bit, I think to add warning for users to keep "return gold/lumber" for upgraded structures - if basic structure has it, did you notice this bug maybe?
 
Level 11
Joined
Mar 31, 2016
Messages
657
yeah, thats the easiest way

almost finished tests and found something strange, I thought it was my mistake but seems that is the game engine: example
lets assume that Town Hall has ability 'Argl' and Keep has not this ability (edited in OE)
during upgrade peasants can normally deliver wood (works as always)
after upgrade is completed: auto-resumeharvesting doesnt work, left-click on icon "return resources" doesnt work also, but right-click on Town Hall (smart order) works and Peasant will deliver wood. Although Town Hall has no ability "return gold/lumber" 'Argl' (!)

It can mess the system a little bit, I think to add warning for users to keep "return gold/lumber" for upgraded structures - if basic structure has it, did you notice this bug maybe?

Alright.

Aww dang. I've never encountered that bug since I've yet to use custom resources aside from the default three.
Hmm, so its only broken after upgrading if there's no 'return gold/lumber' ability? Strange indeed, another thing I gotta ask about on Hive chat - or you could.
And when you give the buildings 'return gold/lumber' it works fine? If so, then that's ok we can work around it- and yeah include that note in the trigger.
Maybe there's a loose end where if a structure upgrades its not being accounted for in the trigger? possibly id/reference related - idk tho I'm no pro with triggers.

I'll also ask a couple coder friends that helped me in the past about this if the problem persists.
 
Level 18
Joined
Nov 21, 2012
Messages
835
Do not worry about it, I fixed this inside the system (using system will fix this war3 bug)
Im thinking now about API ..
for now got something like this (not very elegant, hehe)
function GetPlayerCustomResource takes integer playerId, integer resourceNumber returns integer
function AdjustPlayerCustomResource takes integer playerId, integer resourceNumber, integer value returns nothing
where resource number is simple integer 1,2,3,4,5etc
configuration :
JASS:
  //-------cutom resources----------------------------------------------------
    // number "3" for resource (MUSHROOMS)
    set g_harvestAbility[3] = 'A00A' // ability to harvest: mushrooms
    call HashSaveWorkers(g_harvestAbility[3], 'hpea', 0, 0, 0, 0, 0, 0, 0, 0)
    call HashSaveDestructables(g_harvestAbility[3], 'KTtw', 0, 0, 0, 0, 0, 0, 0, 0)
    call HashSaveStructures(g_harvestAbility[3], 'hcas', 0, 0, 0, 0, 0, 0, 0, 0)
so, it allows to set up to 9:
  • workers who can harves mushrooms
  • destructables that gives mushroom resource
  • structures (including upgraded if any) that can recieve mushrooms
and repeat this for all custom resources

cons:
user has to define also all workers/destructables/structures for normal lumber harvesting
I already reserved up to 18 (number 1 and 2) workers/destr/structures for normal wood
what you think about API any suggestion maybe
 
Level 11
Joined
Mar 31, 2016
Messages
657
MATE! You are the best!!!

This looks legit. wait - can it be more than 9 variables? i have 15 worker units - destructibles/structures will be less than 9, do I delete the other integers or leave as 0?
Also is this everything? Does this include the upgrade-able carry amounts?

Thanks for writing this up - appreciate this very much and will credit in my map's quests (maybe loading screen too)
 
Level 18
Joined
Nov 21, 2012
Messages
835
I hope that this could be useful: Chaosy has already thought about strategies to catch a harvest event some time ago in harvest detection it works as long as the number of harvesters remains reasonable.
thanks for the link, but it does not bring anything new for me. I went the other way. Chaosy tried to detect harvest event which is indeed difficult (maybe impossible). I found a simple trick to detect an event "worker brings resource". Plus binded to this specific worker custom resource number and all other required data.

Today I did tests if this work for multiple workers deliver resources at the excactly same time. It works. Few small things left like IsBuildingUnderCostruction, but already have idea (thanks for IcemanBo's BuilderTrack library) just have to test it.
And I decided to change configurations for user to GUI format: seperate triggers for each resource-type. Worker/destructables/structures per resource configurable up to 99.

For now I noticed 1 small bug. Scenario: worker harvesting --> he is full and start walking to delivery building --> while he's walking buildings gets destroyed --> worker is auto (internally) re-directed to closest structure with 'Arlm' or 'Argl'. (no order is issued, so I cannot catch this moment, so we have to live with this-Im unable to fix this one). Resource will be added properly. Just may be delivered to wrong building.
 
Level 11
Joined
Mar 31, 2016
Messages
657
thanks for the link, but it does not bring anything new for me. I went the other way. Chaosy tried to detect harvest event which is indeed difficult (maybe impossible). I found a simple trick to detect an event "worker brings resource". Plus binded to this specific worker custom resource number and all other required data.

Today I did tests if this work for multiple workers deliver resources at the excactly same time. It works. Few small things left like IsBuildingUnderCostruction, but already have idea (thanks for IcemanBo's BuilderTrack library) just have to test it.
And I decided to change configurations for user to GUI format: seperate triggers for each resource-type. Worker/destructables/structures per resource configurable up to 99.

For now I noticed 1 small bug. Scenario: worker harvesting --> he is full and start walking to delivery building --> while he's walking buildings gets destroyed --> worker is auto (internally) re-directed to closest structure with 'Arlm' or 'Argl'. (no order is issued, so I cannot catch this moment, so we have to live with this-Im unable to fix this one). Resource will be added properly. Just may be delivered to wrong building.

You are too good mate. Glad you found your own solution (again).

Very nice. Alright. Oh, I thought it was gonna be JASS - idc though as long as it works. Perfect.

Ah, that's no biggie. It's a rare instance and isn't game breaking so you can ignore that for now.

Any other bugs? Hope this system is almost ready. ^_^
 
Level 18
Joined
Nov 21, 2012
Messages
835
no , its not included, it is map specific, but not hard to do
write all costs, when building/training use
GetPlayerCustomResource(integer playerId, integer resourceNumber) returns integer
and if is not enough - stop unit, or let him build/train, and use this
(use negative "value" to subtract or positive to add resource):
AdjustPlayerCustomResource(integer playerId, integer resourceNumber, integer value) returns nothing
 
Level 11
Joined
Mar 31, 2016
Messages
657
WOOT! Alright - can't wait to implement this.

Aw, ok. Not sure how to code all of that... sorry I'm noob to JASS. Are those the only lines I have to add?

EDIT: Alright just tested it - works very well except that I couldn't figure out how to return mushrooms.
I'm digging it mate! Job well done, however it needs some a bit of tweaking.

-Add icon of resource next to name in multiboard.
-Can you change the size of the multiboard?
-Remove exclusive worker types, all workers should be able to gather all resources - however keep returning resources to different buildings.
-Remove all announcements.
-All resource amounts harvested should be the same starting off: 10 - then increase by 5 with an upgrade.
-Change color of harvest amount floating text to match each resource's color on the multiboard.
-Can you change the color of resource amounts on the multiboard to a custom color?

Also, can you add that code for unit cost for me or be more descriptive on what and where to add lines?

And what lines do I edit to add more workers and resource types?
 
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
@ZiBitheWand3r3r , just finished implementing to my map and it not only didn't work - it broke one of my other triggers.

Lumber harvesting worked however it failed to return even after constructing a new building and changing distances.
All other harvesting didn't work, worker attacks destructible repeatedly without harvesting.
Harvest ability swap didn't work - worker kept standard harvest ability.
Broke my construction trigger - upon disabling the harvest system it was fixed. Might be something in JASS code because the construction trigger is vJASS.

Any idea what's going on or should just I send you my map?
 
Level 18
Joined
Nov 21, 2012
Messages
835
my friend, you did configuration in rush
  • Resource_destructable[x] in setting triggers must be harvestable - tree based (you may try to change targeted as debris --> tree, I didnt check if it will work, I based all destructables on tree). Thats why workers atacks instead of harvest- its a debris.
  • you gave workers "harvest dummy" ability in OE. And you did not register this ability. Why? Use "Harvest - Lumber", clay or food or any other registered
  • Granary structure is supposed to receive food, so you should add in OE ability return lumber Or return gold/lumber
from ReadMe ;)
All registered Buildings should have ability "Return Lumber" (Arlm) or "Return Gold and Lumber" (Argl)
abilities in OE looks fine
aa, and where is dummy unit DUMMY_TREE_CHECKER = 'h001' // used to check if destructable is a tree
in Library you should type correct id's od dummy unit and dummyTree (dummy tree is ok)
import dummy tree checkerfrom demo map, set his id im library

last thing I spot: do not enable lines in "Unit Event Config" trigger where Bribe told us to not enabe them.
 
Level 11
Joined
Mar 31, 2016
Messages
657
lol - sorry i screenshotted all the triggers and variables and tried to get everything right.

Oh, right. Ok, I'll change that.
Wait - so I have to give all the workers all the harvest abilities or just the lumber one?
Huh? OE ability? I based the Harvest - Food ability off the other ones, Food isnt implemented yet though.

Ok, will add those.
o0o0o thought i had to change that id. Will do.
Alright - I'll let you know how it goes after changes are made.
 
Level 11
Joined
Mar 31, 2016
Messages
657
my friend, you did configuration in rush
  • Resource_destructable[x] in setting triggers must be harvestable - tree based (you may try to change targeted as debris --> tree, I didnt check if it will work, I based all destructables on tree). Thats why workers atacks instead of harvest- its a debris.
  • you gave workers "harvest dummy" ability in OE. And you did not register this ability. Why? Use "Harvest - Lumber", clay or food or any other registered
  • Granary structure is supposed to receive food, so you should add in OE ability return lumber Or return gold/lumber
from ReadMe ;)

abilities in OE looks fine
aa, and where is dummy unit DUMMY_TREE_CHECKER = 'h001' // used to check if destructable is a tree
in Library you should type correct id's od dummy unit and dummyTree (dummy tree is ok)
import dummy tree checkerfrom demo map, set his id im library

last thing I spot: do not enable lines in "Unit Event Config" trigger where Bribe told us to not enabe them.

Fixed (almost). Everything works except I can't get the 4th resource on the leader board to work.
Also the construction system is still broken when running with the harvest system.
 
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
What do you mean by "link to systems" - well they all come from @MassiveMaster 's Castle Defense map.
I did some editing on the IDsystem and BuildingSite System though so the systems are in the map I sent you.

Right... I feel you. The specific trigger that is broken is the BuildingSiteSystem.

Thanks, appreciate the help!

EDIT: Your announcement system also works for the BuildingSiteSystem - perhaps its causing some interference.
 
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
do you know what private function LeaveBuildingSite takes nothing returns nothing does?
However try following steps. Please be carrefull, make backup.

WallSystemOLD trigger
comment line 3118 :
private function SmartOrderOnWalkableBuilding_Conditions takes nothing returns boolean
and add this line instead:
public function SmartOrderOnWalkableBuilding_Conditions takes nothing returns boolean

BuildingSiteSystem trigger
comment line 1514 :
private function SmartOrderOnBuildingSite_Conditions takes nothing returns boolean
and add this line instead:
public function SmartOrderOnBuildingSite_Conditions takes nothing returns boolean

CustomResources trigger
comment line 1 :
library CustomResources initializer Init
and add this line instead:
library CustomResources initializer Init uses libBuilSite, libWal

find this function at line 465 and comment it:
JASS:
private function Trig_ReturnSmartRestrictions_Cond takes nothing returns boolean
    if GetIssuedOrderId() == ORDER_smart then
        if GetOrderTargetUnit() != null and IsWorkerRegistered(GetUnitTypeId(GetOrderedUnit())) then
            return GetOwningPlayer(GetOrderedUnit()) == GetOwningPlayer(GetOrderTargetUnit())
        endif
    endif
    return false
endfunction
paste this funtion instead (at line 465)
JASS:
private function Trig_ReturnSmartRestrictions_Cond takes nothing returns boolean
    if libWal_SmartOrderOnWalkableBuilding_Conditions() then // WallSystemOLD , line 3118
        return false
    elseif libBuilSite_SmartOrderOnBuildingSite_Conditions() then // BuildingSiteSystem , line 1514
        return false
    elseif GetIssuedOrderId() == ORDER_smart then
        if GetOrderTargetUnit() != null and IsWorkerRegistered(GetUnitTypeId(GetOrderedUnit())) then
            return GetOwningPlayer(GetOrderedUnit()) == GetOwningPlayer(GetOrderTargetUnit())
        endif
    endif
    return false
endfunction

it may help or may not I am not sure
do every step with caution, double check ;)
 
Level 11
Joined
Mar 31, 2016
Messages
657
do you know what private function LeaveBuildingSite takes nothing returns nothing does?
However try following steps. Please be carrefull, make backup.

WallSystemOLD trigger
comment line 3118 :
private function SmartOrderOnWalkableBuilding_Conditions takes nothing returns boolean
and add this line instead:
public function SmartOrderOnWalkableBuilding_Conditions takes nothing returns boolean

BuildingSiteSystem trigger
comment line 1514 :
private function SmartOrderOnBuildingSite_Conditions takes nothing returns boolean
and add this line instead:
public function SmartOrderOnBuildingSite_Conditions takes nothing returns boolean

CustomResources trigger
comment line 1 :
library CustomResources initializer Init
and add this line instead:
library CustomResources initializer Init uses libBuilSite, libWal

find this function at line 465 and comment it:
JASS:
private function Trig_ReturnSmartRestrictions_Cond takes nothing returns boolean
    if GetIssuedOrderId() == ORDER_smart then
        if GetOrderTargetUnit() != null and IsWorkerRegistered(GetUnitTypeId(GetOrderedUnit())) then
            return GetOwningPlayer(GetOrderedUnit()) == GetOwningPlayer(GetOrderTargetUnit())
        endif
    endif
    return false
endfunction
paste this funtion instead (at line 465)
JASS:
private function Trig_ReturnSmartRestrictions_Cond takes nothing returns boolean
    if libWal_SmartOrderOnWalkableBuilding_Conditions() then // WallSystemOLD , line 3118
        return false
    elseif libBuilSite_SmartOrderOnBuildingSite_Conditions() then // BuildingSiteSystem , line 1514
        return false
    elseif GetIssuedOrderId() == ORDER_smart then
        if GetOrderTargetUnit() != null and IsWorkerRegistered(GetUnitTypeId(GetOrderedUnit())) then
            return GetOwningPlayer(GetOrderedUnit()) == GetOwningPlayer(GetOrderTargetUnit())
        endif
    endif
    return false
endfunction

it may help or may not I am not sure
do every step with caution, double check ;)

This broke the map. Doesn't load in the game menu. Any other ideas?
 
Level 11
Joined
Mar 31, 2016
Messages
657
maybe you saved map with new name, using "save as"
if so after 1st save map may be not visible or does not load in game. solution : close/open/save then test

when saving map compiles without errors?

Well, tried that however it still won't load in game menu. If you'd be so kind, please take a look and hopefully you can fix it.

https://www.hiveworkshop.com/pastebin/4aab2a2ae43b738dc3fca992f482752c11423/

This map also has the changes you told me to do - I'm sure I implemented them correctly however just in case you should double check.

Thanks - appreciate all your help.
 
Level 18
Joined
Nov 21, 2012
Messages
835
really I dont know, it looks for me you made good job with editing, and map is visible in game, also it loads.
Only thing I susspect is proper path on your pc. check maybe where you saved new version whether it is in "C:\Users\Public\Documents" or C:\Users\YourName\Documents, since blizzard changed location for local files like maps its possible to make misake during save
 
Level 11
Joined
Mar 31, 2016
Messages
657
Ok I fixed the loading issue - basically I only changed one line from private to public, however there were a couple of other private lines that needed to be changed to public as well.


Construction system is still broken though...
However, one of the persistent error messages went away at least: error says too many workers on this building site
Also gold (custom resource, not default) doesn't work. It works in the trigger announcement however the leaderboard fails to register it.

I'm going to try disabling parts of the harvest system and pinpoint exactly what's causing the issue...
EDIT - didn't work because JASS errors kept incurring. It's definitely something with the JASS code though.
 
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
Also gold (custom resource, not default) doesn't work. It works in the trigger announcement however the leaderboard fails to register it.
3.jpg
 
Level 11
Joined
Mar 31, 2016
Messages
657
Nice catch mate. Alright, will fix that. EDIT: perfect, harvest system works 100% now. tyvm!

So your fixes half way fixed the errors with the construction system however its still bugged. All that it fixed was a persistent error message every second of the game saying there are too many workers of this type (this error is from BuildingSiteSystem). Still, after the fixes no functions of the construction system (from BuildingSiteSystem trigger) work 100% and its multiboard # is bugged as a result - I can with certainty say all these errors are related to the BuildingSiteSystem trigger's code interfering with your Harvest system. The wall system is fine though.

Any other ideas or should I ask some people for help?

Also please test the map a try to build stuff to see if it works. If the building upgrades from a building site automatically then its broken. It should work by upgrading then pausing at 0% - upon clicking on it, multiboard appears and it should list required worker types and minimum/maximum worker #s - once you right click on the building with workers selected ability construction is used - then building begins to be constructed and if you select building the multiboard will display worker types + #'s as well as remaining type for construction to finish. Currently the multiboard fails to display workers at all and is stuck on time remaining: 750000000.

Hope this info helps you pinpoint what the issue is. Otherwise let me know what we should do to find a way to fix it.
 
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
in library CustomResources you can change line7
DEVELOPING_MODE = true to false
and line8
PRINT_WARNINGS = true to false
to not pring any messages in game (I suggest to left PRINT_WARNINGS=true as it prings usefull info for player, but its up to you)

and please test attached map
 

Attachments

  • MRv01h.w3x
    15.7 MB · Views: 63
Level 11
Joined
Mar 31, 2016
Messages
657
in library CustomResources you can change line7
DEVELOPING_MODE = true to false
and line8
PRINT_WARNINGS = true to false
to not pring any messages in game (I suggest to left PRINT_WARNINGS=true as it prings usefull info for player, but its up to you)

and please test attached map

WOOT! ZiBi you are the jedi master of JASS. Thank you for everything.
 
Status
Not open for further replies.
Top