One More XML Question

Topics that are not maps. Discuss general map making concepts, techniques, contests, etc, here.

Moderator: Cartographers

Forum rules
Please read the Community Guidelines before posting.
Post Reply
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

One More XML Question

Post by dolomite13 »

I am working on the Jamaica map XML and have a situation where there are two sets of resources that I need to create a bonus from. You need one of each resource to get the bonus and I am not sure what the easiest way to do that XML is.

Do I need to create a series of continents for every possible combination and set the overrides to override all previous combination's, the combination matrix seems rather complicated and I was hoping there was an easier way.

Something like this wouldn't work would it?

Code: Select all

<continent>
  <name>Resource A</name> 
  <bonus>0</bonus> 
  <components>
  <territory>Resource A1</territory> 
  <territory>Resource A2</territory> 
  <territory>Resource A3</territory> 
  <territory>Resource A4</territory> 
  <territory>Resource A5</territory> 
  </components>
  <required>1</required> 
</continent>

<continent>
  <name>Resource B</name> 
  <bonus>0</bonus> 
  <components>
  <territory>Resource B1</territory> 
  <territory>Resource B2</territory> 
  <territory>Resource B3</territory> 
  <territory>Resource B4</territory> 
  <territory>Resource B5</territory> 
  <territory>Resource B6</territory> 
  <territory>Resource B7</territory> 
  <territory>Resource B8</territory> 
  </components>
  <required>1</required> 
</continent>

<continent>
  <name>Resource A and B</name> 
  <bonus>1</bonus> 
  <components>
      <continent>Resource A</continent>
      <continent>Resource B</continent>
  </components>
  <required>1</required> 
</continent>
If theer is a map that does this already please point me to it, I haven't been able to find a good xml example.

==D==
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
thenobodies80
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Gender: Male
Location: Milan

Re: One More XML Question

Post by thenobodies80 »

User avatar
MrBenn
Posts: 6880
Joined: Wed Nov 21, 2007 9:32 am
Location: Off Duty

Re: One More XML Question

Post by MrBenn »

If you take out the <required> from your "Resource A and B" continent, then it should work - although I'm not 100% au fait with nested continents etc... :-k
Image
PB: 2661 | He's blue... If he were green he would die | No mod would be stupid enough to do that
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

Re: One More XML Question

Post by dolomite13 »

hope this works... I added it to the current xml =)

Code: Select all

<continent>
  <name>Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savanah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
</continent>

<continent>
  <name>Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stoney Hill</territory>
  </components>
</continent>

<continent>
  <name>Sugar and Slaves</name>
  <bonus>1</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>1</required>
</continent>
http://www.conquerclub.com/forum/viewto ... 10&t=75919
==D==
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
cairnswk
Posts: 11510
Joined: Sat Feb 03, 2007 8:32 pm
Gender: Male
Location: Australia

Re: One More XML Question

Post by cairnswk »

Mmmmm. i noticed on the Poker map that there is a huge list of overrides to clean up the xml.
Perhaps this would be helpful :)
Image
* Pearl Harbour * Waterloo * Forbidden City * Jamaica * Pot Mosbi
User avatar
thenobodies80
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Gender: Male
Location: Milan

Re: One More XML Question

Post by thenobodies80 »

With this code
dolomite13 wrote:

Code: Select all

<continent>
  <name>Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savanah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
</continent>

<continent>
  <name>Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stoney Hill</territory>
  </components>
</continent>

<continent>
  <name>Sugar and Slaves</name>
  <bonus>1</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>1</required>
</continent>
You give a 0 bonus if a player holds all slaves
You give a 0 bonus if a player holds all sugar
You give a 1 bonus if a player holds at least 1 of these two bonuses (1 required)

So to gain +1 of bonus a player needs to hold completely or all slaves or all sugar with that code.

i think that what you need to code is:

Code: Select all

<continent>
  <name>Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savanah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
<required>1</required>
</continent>

<continent>
  <name>Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stoney Hill</territory>
  </components>
<required>1</required>
</continent>

<continent>
  <name>Sugar and Slaves</name>
  <bonus>1</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
</continent>
in this way a player will have a +1 troop bonus if he holds at least 1 sugar and 1 slave, but he will not need to hold all the sugar or all the slaves.

;) Nobodies
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Re: One More XML Question

Post by yeti_c »

Then in the "super" continent - you overide your child continents to keeo the log clean.

C.
Image
Highest score : 2297
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

Re: One More XML Question

Post by dolomite13 »

How would I code it to give me 2 bonus for 2 slaves and 2 sugar, 3 bonus for 3 of each and so on?
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
thenobodies80
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Gender: Male
Location: Milan

Re: One More XML Question

Post by thenobodies80 »

the easier way is to code some smaller continents and combine them.

You have to code A Slave , 2 slaves, 3 slaves :

Code: Select all

<continent>
  <name>A Slave</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savanah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
<required>1</required>
</continent>
<continent>
  <name> 2 Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savanah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
<required>2</required>
</continent>
in the same way code the resources A sugar, 2 sugar, etc etc:

Code: Select all

<continent>
  <name>A Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stoney Hill</territory>
  </components>
<required>1</required>
</continent>
<continent>
  <name>2 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stoney Hill</territory>
  </components>
<required>2</required>
</continent>


And then larger continents sugar & slaves, 2 sugar & 2 Slaves, etc etc:

Code: Select all

<continent>
  <name>Sugar and Slave</name>
  <bonus>1</bonus>
  <components>
      <continent>A Slaves</continent>
      <continent>A Sugar</continent>
  </components>
</continent>
<continent>
  <name>2 Sugar and 2 Slaves</name>
  <bonus>2</bonus>
  <components>
      <continent>2 Slaves</continent>
      <continent>2 Sugar</continent>
  </components>
</continent>
When it's done remember to override the continents, as previously suggested ;)
yeti_c wrote:Then in the "super" continent - you overide your child continents to keeo the log clean.

C.
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

Re: One More XML Question

Post by dolomite13 »

Ah thanx a bunch C that makes total sense =)
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

Re: One More XML Question

Post by dolomite13 »

OK so I think it should look like this

Code: Select all

<!--  Any 1 slave & Any 1 sugar +1 --> 

<continent>
  <name>A Slave</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savannah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
  <required>1</required>
</continent>

<continent>
  <name>2 Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savannah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
  <required>2</required>
</continent>

<continent>
  <name>3 Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savannah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
  <required>3</required>
</continent>

<continent>
  <name>4 Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savannah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
  <required>4</required>
</continent>

<continent>
  <name>5 Slaves</name>
  <bonus>0</bonus>
  <components>
  <territory>Falmouth</territory>
  <territory>Newtown</territory>
  <territory>Savannah Le Mar</territory>
  <territory>Spanish Town</territory>
  <territory>St Albans</territory>
  </components>
  <required>5</required>
</continent>




<continent>
  <name>A Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>1</required>
</continent>

<continent>
  <name>2 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>2</required>
</continent>

<continent>
  <name>3 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>3</required>
</continent>

<continent>
  <name>4 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>4</required>
</continent>

<continent>
  <name>5 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>5</required>
</continent>

<continent>
  <name>6 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>6</required>
</continent>

<continent>
  <name>7 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>7</required>
</continent>

<continent>
  <name>8 Sugar</name>
  <bonus>0</bonus>
  <components>
  <territory>Annotta Bay</territory>
  <territory>Bluefields</territory>
  <territory>Chapelton</territory>
  <territory>Hanover</territory>
  <territory>Morant</territory>
  <territory>Pedro</territory>
  <territory>Rio Bueno</territory>
  <territory>Stony Hill</territory>
  </components>
  <required>8</required>
</continent>


<continent>
  <name>A Slave and A Sugar</name>
  <bonus>1</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>1</required>
</continent>

<continent>
  <name>2 Slaves and 2 Sugar</name>
  <bonus>2</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>2</required>
</continent>

<continent>
  <name>3 Slaves and 3 Sugar</name>
  <bonus>3</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>3</required>
</continent>

<continent>
  <name>4 Slaves and 4 Sugar</name>
  <bonus>4</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>4</required>
</continent>

<continent>
  <name>5 Slaves and 5 Sugar</name>
  <bonus>5</bonus>
  <components>
      <continent>Slaves</continent>
      <continent>Sugar</continent>
  </components>
  <required>5</required>

<overrides>
  <override>A Slave and A Sugar</override>
  <override>2 Slaves and 2 Sugar</override>
  <override>3 Slaves and 3 Sugar</override>
  <override>4 Slaves and 4 Sugar</override>
</overrides>

</continent>
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Re: One More XML Question

Post by yeti_c »

No...

Like this...

C.

Code: Select all

<continent>
  <name>A Slave and A Sugar</name>
  <bonus>1</bonus>
  <components>
      <continent>A Slave</continent>
      <continent>A Sugar</continent>
  </components>
  <required>1</required>
  <overrides>
    <override>A Slave</override>
    <override>A Sugar</override>
  </overrides>
</continent>

<continent>
  <name>2 Slaves and 2 Sugar</name>
  <bonus>2</bonus>
  <components>
      <continent>2 Slaves</continent>
      <continent>2 Sugar</continent>
  </components>
  <required>1</required>
  <overrides>
    <override>2 Slaves</override>
    <override>2 Sugar</override>
    <override>A Slave and A Sugar</override>
  </overrides>
</continent>

<continent>
  <name>3 Slaves and 3 Sugar</name>
  <bonus>3</bonus>
  <components>
      <continent>3 Slaves</continent>
      <continent>3 Sugar</continent>
  </components>
  <required>1</required>
  <overrides>
    <override>3 Slaves</override>
    <override>3 Sugar</override>
    <override>A Slave and A Sugar</override>
    <override>2 Slaves and 2 Sugar</override>
  </overrides>
</continent>

<continent>
  <name>4 Slaves and 4 Sugar</name>
  <bonus>4</bonus>
  <components>
      <continent>4 Slaves</continent>
      <continent>4 Sugar</continent>
  </components>
  <required>1</required>
  <overrides>
    <override>4 Slaves</override>
    <override>4 Sugar</override>
    <override>A Slave and A Sugar</override>
    <override>2 Slaves and 2 Sugar</override>
    <override>3 Slaves and 3 Sugar</override>
  </overrides>
</continent>

<continent>
  <name>5 Slaves and 5 Sugar</name>
  <bonus>5</bonus>
  <components>
      <continent>5 Slaves</continent>
      <continent>5 Sugar</continent>
  </components>
  <required>1</required>
  <overrides>
    <override>5 Slaves</override>
    <override>5 Sugar</override>
    <override>A Slave and A Sugar</override>
    <override>2 Slaves and 2 Sugar</override>
    <override>3 Slaves and 3 Sugar</override>
    <override>4 Slaves and 4 Sugar</override>
  </overrides>
</continent>
Image
Highest score : 2297
User avatar
dolomite13
Posts: 1379
Joined: Mon Aug 18, 2008 5:54 pm

Re: One More XML Question

Post by dolomite13 »

Awsome thanx much
Where Have I Been? ... Testing a prototype board game that I co-designed called Alien Overrun!
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Re: One More XML Question

Post by yeti_c »

NP

C>
Image
Highest score : 2297
Post Reply

Return to “Foundry Discussions”