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

Storing the following information?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
My map is based on each city having local tech-trees. Meaning building a barrack in one city doesn’t improve the tech of another city. Because of this I use dummy units that are created/removed when it’s time to build something. Now to the problem, these dummy units have arbitrary requirments. Here is a example:

Building: Estate
Requirments:
- 1 Granary
- 1 Well
- 1 Agora
- 1 Temple
- 1 Stables
Building: Temple of Ares
Requirments:
- 3 Houses
- 1 Barrack

So the requirment descriptions here are units, for example ”3 houses” is a dummy. I was wondering how could one store this information effectivly? Currently I have to make a if-statement for each tech unit. But if i instead could loop through a unit list of TechType and make those requirments accessable somehow...

Task: Store one or more UnitType(s) and a integer (amount required) to another UnitType (dummy tech unit).
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I'd combine the information into a string, and compare this string with a "requirement" string.

Each building would have a unique location in the string, and if available would be indicated on the check string with the number of those buildings, or a 0 if you don't have any.

So if we have:
1 - House
2 - Granary
3 - Barrack
4 - Well
5 - Agora
6 - Temple
7 - Stables

(save these pairs to an array so that you can quickly compare all of them to generate the string)

E.g. 1: Estate would be:
0101111

E.g. 2: Temple of Area would be:
3010000

EDIT: Forgot to add, you need to check using "greater than or equal to".
 
Last edited:
Status
Not open for further replies.
Top