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

[Trigger] Warcraft 2 Oil System

Status
Not open for further replies.
Level 11
Joined
May 11, 2008
Messages
830
Hello folks I know this question has been asked many times and I've seen many links within those posts and couldn't figure out how to create a Oil System like Warcraft 2.

For those who never played Warcraft 2, oil can only be found in the ocean, where you build a oil rig... a oil tanker comes in takes the oil back to the shipyard, kinda like gold mines....

It's for a campaign so, only 1 player trigger, I don't want a JASS trigger because JASS is confusing to me.

The campaign is probably obvious what it's gonna be on.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
I think this can be done using Object Editor not much trigger would be involved.

If you change the Mine pathing and allowed it to be in water then add to a shipyard the ability return gold and lumber then create a ship with the ability Harvest so it can mine in the water mine, though that would need a suitable model but I am not sure if such model can be found here, if not try to request for a model.
 
Level 11
Joined
May 11, 2008
Messages
830
Well I need a trigger cause it will be a 3rd ressource cause Warcraft 2 had 3 ressources +food I know I need to create a multiboard or leaderboard for the oil but it's how to make it work, and how would the spending thing work. Like say I get 20 Oil per cycle.

A battleship costs 500 oil and gold and lumber, if he doesn't have enough oil how do I make sure he doesn't get produced?
 
Level 11
Joined
May 11, 2008
Messages
830
3 resources, ok triggers then must be involved. I shall think of it then.

Alright thanks all you need to know is that it's for 1 player, I'm helping someone doing a WC2 campaign and I needed the oil system.

I'm not sure if you understand a single thing with the other topics, when you type in the search bar: Oil, cause all I've been seeing is multiboards, leaderboards and JASS. Sure it helps to display oil but how about making it work?
 
Level 8
Joined
Aug 13, 2009
Messages
466
TL;DR POST INC

There are a few options I can think of. The first one is just using gold/lumber, which you can't, so that's out.

The next option is some kind of region-based marker. When the ship enters a region around an oil mine, it gets marked in some way (mana amount, custom value, item added to inventory) which will be recognized when it goes back to the port / wherever it will deliver the oil. Alternatively, if you want the oil to be automagically transferred, you can do that pretty easily.

Another alternative would be a solution using mana drain spells. The mine would be a unit with a certain amount of mana = how much oil it has. The oil tanker would then use a mana drain spell on this, which would increase it's own mana (which would be cool to use in other ways - let out some oil to mess with the waterways - but I digress).

In any case here, there is the problem of automating the process. This can be done quite easily by saving some information in a hashtable.
Create a hashtable at map start and set that hash table to a global variable.
Then, do this:

Make a dummy spell for the oil tanker called "Select port". When this ability triggers, save the Port unit as a 1 of your hashtable name with the key(triggering unit). This will make it so that if you load "value 1" of the hashtable with your unit as a keyword, you get that port unit right there.

Next, add another spell called "Start harvesting" or similar. When cast, save the oil mine as a 2 of your hashtable, again with the key triggering unit. The actual ability should be a modified Drain Mana ability, apart from its trigger functions.

When your periodic trigger detects that an oil tanker has full mana, order it to use a third dummy spell on the port. When this is detected by your trigger, set the tanker's mana to 0 and add the boat's current amount of mana to a global variable somewhere which you can check against later.
After that in the trigger, order the unit to once again use the second dummy spell (the mana drain) on the gold mine which you stored earlier in the hashtable, and the cycle should close itself.

If you need help understanding any of this, please say, and don't be afraid of using that hashtable - it's pretty easy, really.
 
Level 11
Joined
May 11, 2008
Messages
830
Nope don't need to register I can see perfectly.

I get the basics now but how is this gonna help me do a oil system?

(I sound stupid but I seriously still don't get the picture lol.)

All I got right now is a custom ability based on Harvest (Gold & Lumber) for the oil, next I created a trigger like this:

Event
Map Initilization
Condition
Actions
Harshtable- Create a Harshtable
Set Mytable = Last Created Harshtable

That was it lol.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
If you made a channel based spell with no target so that you order an issue for this spell when the collecting vessel enters a region that represents the oil rig then we start a timer that represents the mining time then apply an integer that represents the amount of mineral that the ship is carrying and when the ship enters another region placed on the shipyard we add this integer to a universal integer that represents the amount of oil collected by the player. All what I said may be vague but I am just giving an outline on how this may be done.
 
Level 11
Joined
May 11, 2008
Messages
830
If you made a channel based spell with no target so that you order an issue for this spell when the collecting vessel enters a region that represents the oil rig then we start a timer that represents the mining time then apply an integer that represents the amount of mineral that the ship is carrying and when the ship enters another region placed on the shipyard we add this integer to a universal integer that represents the amount of oil collected by the player. All what I said may be vague but I am just giving an outline on how this may be done.

So let me get the straight? I need a channel base spell (Oil Harvest) that has no targets so when it enters a region (around the oil rig), a invisible timer, is made for how long it will mine there. (Placed in 1.1 second for the ability, so I need 1.1 second string or something?) Then I create a interger variable for how much oil there is (25) , so another trigger will be when the ship enters the region where the shipyard or oil refinery is built. Then another trigger to add that 25 to the multiboard saying I have +25 oil etc... Wouldn't it be better if I decided to say a unit is within range of oil rig and shipyard/oil. refinery?
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Ok make it range so it become circular not square. Also what I meant by enters region means that the mining ship enters the mine domain thats it.

I can't deny it won't be easy to make but may prove interesting. When making 3 resources but will you be able to make another system for using that resource for building and training ?

<< EDIT >>

The reason I told you of a channel spell is to make the unit busy and make the idle button not to appear
 
Status
Not open for further replies.
Top