Author Topic: Unique buildings  (Read 1312 times)

lokana

  • Guest
Unique buildings
« on: 20 May 2010, 06:10:29 »
I have a question.  Is it possible to set a building so that it's requirement to be built is that there isn't that building already build?  For instance, take the library.  It requires...

      <unit-requirements>
         <unit name="mage_tower"/>
         <unit name="summoner_guild"/>
      </unit-requirements>

Is there some kind of "anti requirement" code?  If not, how hard would it be to mod Glest to include such a condition?

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Unique buildings
« Reply #1 on: 20 May 2010, 08:46:06 »
So far the easiest work-around we have for this is to give your faction a static resource that is only required by that particular building or unit.  For example, let's say your faction has a starting resource of 1 Soap, and its Bath House building requires 1 Soap.  When that building is built, the faction's Soap value goes to 0, and when the building gets destroyed it will go back to 1, so another Bath House can be built.  Static resources work like library books, basically.  When you build a unit that requires that resource, it "checks it out", and then when it dies it "checks it in", and the resource becomes available again.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Unique buildings
« Reply #2 on: 20 May 2010, 15:53:10 »
Or mabey we could code it so you can say:

      <unit-requirements>
         <no unit name="mage_tower"/>
         <no unit name="summoner_guild"/>
      </unit-requirements>
Get the Vbros': Packs 1, 2, 3, 4, and 5!

lokana

  • Guest
Re: Unique buildings
« Reply #3 on: 20 May 2010, 16:22:02 »
So far the easiest work-around we have for this is to give your faction a static resource that is only required by that particular building or unit.  For example, let's say your faction has a starting resource of 1 Soap, and its Bath House building requires 1 Soap.  When that building is built, the faction's Soap value goes to 0, and when the building gets destroyed it will go back to 1, so another Bath House can be built.  Static resources work like library books, basically.  When you build a unit that requires that resource, it "checks it out", and then when it dies it "checks it in", and the resource becomes available again.

Right.  I know about that.  That's fine if you only want a couple unique things.  But it can get a bit much if you want have a dozen unique heroes or units, then several more unique buildings, etc.

The <no unit name="bath_house"/> seems like it would be a lot easier.  But I wasn't sure if the current code supports something like that or how hard it would be to reprogram it so it does.

This would also be useful if you had an upgrade that allowed you to build better buildings.  So if the upgrade existed, the CPU player could no longer build the old crappy buildings.

wyvern

  • Guest
Re: Unique buildings
« Reply #4 on: 20 May 2010, 16:29:57 »
I've also thought about this problem, though more in the hero unit sense, and thought of something similar to Eliminators solution, say the hero is named Googoo you could write <unit requirements="-Googoo"/> I'm don't think it would work but its an idea

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Unique buildings
« Reply #5 on: 20 May 2010, 19:39:42 »
It's not currently supported, but if you're handy with C++ then have at it.

wyvern

  • Guest
Re: Unique buildings
« Reply #6 on: 20 May 2010, 19:45:23 »
My dad is able to program a bit, I'll ask him for help.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Unique buildings
« Reply #7 on: 20 May 2010, 23:02:37 »
<unit requirements="-Googoo"/> Won't work because it will think -Googoo is the name of the unit not just Googoo.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

 

anything