Jump to content

Upgrade Entities Feature


Recommended Posts

http://trac.wildfiregames.com/changeset/18467

 

Hi guy. So, the Upgrade feature is in! It is a very nice feature thanks to wraitii. I have already experiment and make upgradable tower. Wood -> Stone. Works brilliant.

 

A few things:
 

  1. Would be good for to upgrade multiple buildings at once in selection.
  2. Costs do not show up in the tooltip. Maybe is something I screw up.
  3. I think the Upgrade icon when turn green (when in midst of upgrade) should slowly change green like when training a troop.
  4. How do I make RequiredTechnology? It gives me error when I try to do it.

 

Here is my tower (sorry for bad indentations) :)

 

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_defense">
  <Attack>
    <Ranged>
      <Hack>0.0</Hack>
      <Pierce>15.0</Pierce>
      <Crush>0.0</Crush>
      <MaxRange>40.0</MaxRange>
      <MinRange>12.0</MinRange>
      <ElevationBonus>15</ElevationBonus>
      <ProjectileSpeed>50.0</ProjectileSpeed>
      <PrepareTime>1200</PrepareTime>
      <RepeatTime>4000</RepeatTime>
      <Spread>1.5</Spread>
      <PreferredClasses datatype="tokens">Organic</PreferredClasses>
      <Bonuses>
        <NerfSiege>
          <Classes>Siege</Classes>
          <Multiplier>0.75</Multiplier>
        </NerfSiege>
      </Bonuses>
    </Ranged>
  </Attack>
  <BuildingAI>
    <DefaultArrowCount>1</DefaultArrowCount>
    <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
    <MaxArrowCount>3</MaxArrowCount>
	<GarrisonArrowClasses>Infantry Ranged</GarrisonArrowClasses>
  </BuildingAI>
  <BuildRestrictions>
    <Category>DefenseTower</Category>
	<Territory>own ally</Territory>
    <Distance>
      <FromClass>DefenseTower</FromClass>
      <MinDistance>25</MinDistance>
    </Distance>
  </BuildRestrictions>
  <Cost>
    <BuildTime>100</BuildTime>
    <Resources>
      <wood>100</wood>
      <stone>0</stone>
    </Resources>
  </Cost>
  <Footprint>
    <Square width="10.0" depth="10.0"/>
    <Height>15.0</Height>
  </Footprint>
  <GarrisonHolder>
    <Max>5</Max>
    <EjectHealth>0.1</EjectHealth>
    <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
    <List datatype="tokens">Support Infantry</List>
    <BuffHeal>0</BuffHeal>
    <LoadingRange>2</LoadingRange>
  </GarrisonHolder>
  <Health>
    <Max>500</Max>
    <SpawnEntityOnDeath>rubble/rubble_stone_2x2</SpawnEntityOnDeath>
  </Health>
  <Identity>
    <GenericName>Wooden Defense Tower</GenericName>
    <Tooltip>Shoots arrows. Garrison to provide extra defense. Can be built in allied territory for mutual defense.</Tooltip>
    <Classes datatype="tokens">GarrisonTower -ConquestCritical</Classes>
    <VisibleClasses datatype="tokens">Village Wood Tower DefenseTower Ranged</VisibleClasses>
    <Icon>structures/defense_tower.png</Icon>
	<RequiredTechnology>phase_village</RequiredTechnology>
  </Identity>
  <Loot>
    <xp>100</xp>
    <food>0</food>
    <wood>10</wood>
    <stone>10</stone>
    <metal>0</metal>
  </Loot>
  <Obstruction>
    <Static width="7.0" depth="7.0"/>
  </Obstruction>
  <ProductionQueue>
    <BatchTimeModifier>0.7</BatchTimeModifier>
    <Technologies datatype="tokens">
      pair_tower_01
	  pair_defensive_01
	  vision_defense_tower
    </Technologies>
  </ProductionQueue>
  <Sound>
    <SoundGroups>
      <select>interface/select/building/sel_tower.xml</select>
      <constructed>interface/complete/building/complete_tower.xml</constructed>
      <attack>attack/weapon/arrowfly.xml</attack>
      <death>attack/destruction/building_collapse_large.xml</death>
    </SoundGroups>
  </Sound>
  <StatusBars>
    <BarWidth>6.0</BarWidth>
    <BarHeight>0.6</BarHeight>
    <HeightOffset>21.0</HeightOffset>
  </StatusBars>
  <TerritoryInfluence>
    <Root>false</Root>
    <Radius>20</Radius>
    <Weight>20000</Weight>
  </TerritoryInfluence>
  <Upgrade>
    <Tower>
      <Entity>structures/{civ}_defense_tower_stone</Entity>
      <Tooltip>Upgrade this wooden tower into a stone tower, with +100% health.</Tooltip>
	  <RequiredTechnology>phase_town</RequiredTechnology>
      <Cost>
        <stone>100</stone>
        <wood>0</wood>
      </Cost>
      <Time>10000</Time>
    </Tower>
  </Upgrade>
  <Vision>
    <Range>60</Range>
  </Vision>
  <VisualActor>
    <FoundationActor>structures/fndn_2x2.xml</FoundationActor>
  </VisualActor>
</Entity>

 

The base, wooden Seleucid tower (sele_defense_tower) obviously have the above attributes by parent.

And then here is the stone Seleucid defense tower:

 

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="structures/sele_defense_tower">
  <Health>
    <Max>1000</Max>
  </Health>
  <Identity>
    <GenericName>Stone Defense Tower</GenericName>
    <VisibleClasses datatype="tokens">-Wood Stone</VisibleClasses>
  </Identity>
  <ProductionQueue>
    <Technologies datatype="tokens">
      successors/unlock_oxybeles_towers_seleucids
    </Technologies>
  </ProductionQueue>
  <Upgrade disable=""/>
  <VisualActor>
    <Actor>structures/seleucids/defense_tower_stone.xml</Actor>
  </VisualActor>
</Entity>

 

If I leave out <RequiredTechnology> then it works perfectly, but I can upgrade it in Village Phase, which I do not want. Here is the error:

 

Spoiler

ERROR: JavaScript error: gui/session/selection_panels.js line 1062 ReferenceError: requiredTechnology is not defined g_SelectionPanels.Upgrade.setupButton@gui/session/selection_panels.js:1062:5 setupUnitPanel@gui/session/unit_commands.js:110:8 updateUnitCommands@gui/session/unit_commands.js:166:4 updateSelectionDetails@gui/session/selection_details.js:442:2 updateGUIObjects@gui/session/session.js:721:2 onTick@gui/session/session.js:612:3 __eventhandler0 (tick)@sn tick:0:1

ERROR: JavaScript error: gui/session/selection_panels.js line 1062 ReferenceError: requiredTechnology is not defined g_SelectionPanels.Upgrade.setupButton@gui/session/selection_panels.js:1062:5 setupUnitPanel@gui/session/unit_commands.js:110:8 updateUnitCommands@gui/session/unit_commands.js:166:4 updateSelectionDetails@gui/session/selection_details.js:442:2 updateGUIObjects@gui/session/session.js:721:2 onSimulationUpdate@gui/session/session.js:669:2 __eventhandler1 (simulationupdate)@sn simulationupdate:0:1

 

 

Again, good job with the feature. It is nice to see and opens many many possibility.

Edited by wowgetoffyourcellphone
  • Like 1
Link to comment
Share on other sites

22 minutes ago, niektb said:

You already had some sort of upgrading mechanism, right? In what does this differ from the previous implementation (what are the benefits)?

Before, the upgrade of towers was with 1 tech and upgraded all tower at the same time by swap the actor (from wooden to stone).

 

In this new implementation in the core game thanks to wraitii game can upgrade indicvidual structures and units. So, let's say you want to upgrade some of your legionaires to centurions*. Now the game can have this feature. Mods can have, say, Level 1 barracks, Level 2 barracks, etc. with this feature too (though, I have not try to see where the button would show up if at all if there is entities in productionqueue).

 

So, now in my mod, you build the wooden towers and then can upgrade each tower individually to stone. Don't have to bank up a lot of stone to research one tech to change them all at once (though I can still keep this tech modified). I can perhaps make the Military Colonies of the Ptolemies and Seleucids able to upgrade to full Civic Centers individually.

 

*

Spoiler

Imagine in this example if experience was a resource, called Honor or Glory or something, and you can spend it on upgrades like this, promoting some legionaire to centurions. Or imagine in the future if there are battalions, you can upgrade one battalion of pike infantry to super elite Agema level (instead of having to upgrade all pike infantry with a tech).

 

Edited by wowgetoffyourcellphone
  • Like 1
Link to comment
Share on other sites

Hey wow, thanks for the notice, points 2, 3 and 4 should be fixed now. Point 1 is actually much more difficult to do than you'd expect, so I let it out for now.

Very interested to see what you can do with this, personally I think we should use this feature quite a bit. It sounds like it could lead to pretty good stuff.

Link to comment
Share on other sites

26 minutes ago, wraitii said:

Hey wow, thanks for the notice, points 2, 3 and 4 should be fixed now. Point 1 is actually much more difficult to do than you'd expect, so I let it out for now.

Very interested to see what you can do with this, personally I think we should use this feature quite a bit. It sounds like it could lead to pretty good stuff.

Yeah, points 2, 3, and 4 are fix! Cool. Point 1 would be important if for example the player wanted to upgrade a bunch of pikemen to champion level or something like this (in my example, upgrade more than one wooden tower at a time).

 

I seem to be having a problem with capturing now. Unit can't capture Gaia merc camps in my mod. Maybe ther was change to capture code or attack code? Or was there some decision to not make Gaia things capturable? I don't know if it related to your patch.

 

 

commands.txt

  • Like 1
Link to comment
Share on other sites

Hi wraitii. Could you do this for enhancement of patch? I think, for an example if I upgrade a wooden tower to stone tower it should make the tower complete sound when done upgrade. So, when object switch to new entity, the training complete or building complete sound can be heard. Either that or have a new sound group for "Upgrade."

 

Another enhancement I just think of would be to have a "Upgrade" animation type. For many units, can use the same anim as promotion, but can be 2 different types in the actor just in case.

Edited by wowgetoffyourcellphone
  • Like 2
Link to comment
Share on other sites

Another extension of this patch can be Structure Tree compatibility. For instance in my mod I see the Wooden Tower in Village phase in Struct Tree, but I do not see the Stone Tower upgraded tower anywhere. The Carrier Pigeons tech is in the Wooden Tower and when upgrade to Stone Tower you get more tech. These are all missing. Good opportunity for enhancement.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...