Page 1 of 1

One More XML Question

PostPosted: Tue Sep 08, 2009 1:02 pm
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==

Re: One More XML Question

PostPosted: Tue Sep 08, 2009 3:08 pm
by thenobodies80

Re: One More XML Question

PostPosted: Wed Sep 09, 2009 3:03 am
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

Re: One More XML Question

PostPosted: Wed Sep 09, 2009 9:01 pm
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>


viewtopic.php?f=10&t=75919
==D==

Re: One More XML Question

PostPosted: Thu Sep 10, 2009 2:30 am
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 :)

Re: One More XML Question

PostPosted: Thu Sep 10, 2009 2:31 am
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

Re: One More XML Question

PostPosted: Thu Sep 10, 2009 2:48 am
by yeti_c
Then in the "super" continent - you overide your child continents to keeo the log clean.

C.

Re: One More XML Question

PostPosted: Thu Sep 10, 2009 10:45 pm
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?

Re: One More XML Question

PostPosted: Fri Sep 11, 2009 2:37 am
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.

Re: One More XML Question

PostPosted: Fri Sep 11, 2009 10:21 am
by dolomite13
Ah thanx a bunch C that makes total sense =)

Re: One More XML Question

PostPosted: Sun Sep 13, 2009 5:22 pm
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>

Re: One More XML Question

PostPosted: Mon Sep 14, 2009 2:12 pm
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>

Re: One More XML Question

PostPosted: Mon Sep 14, 2009 3:49 pm
by dolomite13
Awsome thanx much

Re: One More XML Question

PostPosted: Tue Sep 15, 2009 12:00 pm
by yeti_c
NP

C>