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

Oil Harvest System for WC2 Campaign

Status
Not open for further replies.
I wrote an oil harvest system for LordPerenoldeII's WC2 Remake campaign.
I think I got it as close to the standard resource systems as is possible.

Before putting the script in each map, I'd like to have the script tested to make sure any bugs are fixed first.
In the test map, the Human Frigate in the shipyard costs 100 oil, and the Farm also costs 100 oil.

Thanks for any help/feedback! :)
 

Attachments

  • OilTest.w3x
    131 KB · Views: 32

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,847
The Peasant spams a Must Target an Oil Platform message/notification when it gets the gold to the Town Hall.
Frigates don't say how much Oil they require.
You've replaced/mixed the gold icon from the mine with one having an Oil drop on the gold coin.
I'm assuming you've used a custom gold mine and change the gold the tankers gather to oil.

It doesn't really work like in Warcraft II since the boats should get inside and out of both the platform and shipyard like workers do with gold.
At least you made it work for more platforms at a time.

I tried something but I don't know how to make the tankers get to more than one platform at a time and don't know how to detect when they are built or destroyed so that proper variables are set to those which are alive.
Oil Sys | HIVE
 
The Peasant spams a Must Target an Oil Platform message/notification when it gets the gold to the Town Hall.
Damn it, I've fixed this and removed the fix so many times now, I keep forgetting why I put that check in there xD

Frigates don't say how much Oil they require.
I haven't bothered with tooltips and such in the test map.

You've replaced/mixed the gold icon from the mine with one having an Oil drop on the gold coin.
I'm assuming you've used a custom gold mine and change the gold the tankers gather to oil.
Yeah, the oil patch/platforms are basically custom gold mines, so they use the same infocard/text as gold mines. So it's necessary to change the Gold mine text and icons to something that can be used for oil as well.
The platforms have Entangled Goldmine ability.

It doesn't really work like in Warcraft II since the boats should get inside and out of both the platform and shipyard like workers do with gold.
Ah, I didn't know/remember that. I'll ask perenolde if he wants it like that in his campaign.

I tried something but I don't know how to make the tankers get to more than one platform at a time and don't know how to detect when they are built or destroyed so that proper variables are set to those which are alive.
Oil Sys | HIVE
Sorry, I don't understand this part?
As for the tankers, the script doesn't really know about them. It only detects the harvest/return abilities and goes from there.
Edit: for the patches & platforms, I save the oil amounts in a hashtable by their location (key = R2I(X*Y*1000)), so when a platform is destroyed/built, I can look it up in the hashtable and set the amount accordingly.

edit: updated the attached map in OP.
 
Last edited:

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,847
The platforms have Entangled Goldmine ability.
Really!? I thought you based it on Haunted Gold Mine.

Yeah, I know hashtables would help but I'm too stupid for that.
What I meant was that my tankers (which have an inventory) go inside the platform (basically they're hidden), then out (get an item) and to the shipyard (where again they are temporarily hidden and they lose the item) and the process goes on and on. However I couldn't make it so that the tankers would come to the closest shipyard. Also couldn't make it so that the tankers would harvest more than one at a time.
 
Really!? I thought you based it on Haunted Gold Mine.
Maybe I should double check (I have terrible memory) but I think entangled :p But in the test map it's not based on entangled (or haunted) gold mine unit, just any building (in this case the human shop) with the ability.

However I couldn't make it so that the tankers would come to the closest shipyard.
In the script I just loop through all the player's shipyards (and refineries), get the distance between each and the tanker, and use the one that has the smallest distance.


Also couldn't make it so that the tankers would harvest more than one at a time.
You mean harvest multiple platforms at the same time? Or harvest one, then another before returning?

I save the amount of oil each tanker is carrying in the hashtable. The return ability can also be used on platforms. If a tanker "returns" on a platform, the script checks if the tanker is full. If it is, it gets sent back to the closest return point, if it isn't, it starts harvesting the platform.
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,847
You mean harvest multiple platforms at the same time? Or harvest one, then another before returning?
The same one. I can do it but I'll have to spam triggers with a array unit variable like every time a tanker is trained to be set to tanker[tanker integer+1] and if it dies to be excluded.

Anyways, it's great that you made it work. What I want is an oil harvest system like in Warcraft II where the tanker disappears and reappears when going to the platform and the shipyard respectively.
I mean, that would stay true to the original. Besides, like now, tankers are too vulnerable.
 
Status
Not open for further replies.
Top