XML Question

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

XML Question

miccal99
Hello all...it's been a long time since I have fiddled with TripleA, and since the old board is gone, I need to ask...

How can I change production costs of units per nation? For example, I want to make Chinese infantry cost 2 instead of 3.

Thanks in advance for any help!

Chris
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

wrigleyfield
go into the Games folder, find the version your playing and right click Edit
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
I have an XML editor already, I need to know what code do I have to add/remove to change the cost of units.
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

ComradeKev
Administrator
You would need multiple changes to limit the cost change to a single player.  Here are some examples.

<unitList>
     <unit name="infantry"/>
     <unit name="chineseInfantry"/>
.
.
.
</unitList>


<attatchment name="unitAttatchment" attatchTo="chineseInfantry" javaClass="games.strategy.triplea.attatchments.UnitAttachment" type="unitType">
     <option name="movement" value="1"/>
     <option name="isInfantry" value="true"/>
     <option name="attack" value="1"/>
     <option name="defense" value="2"/>
     <option name="artillerySupportable" value="true"/>
</attatchment>


<productionRule name="buyInfantry">
     <cost resource="IPCs" quantity="3" />
     <result resourceOrUnit="infantry" quantity="1"/>
</productionRule>


<productionFrontier name="productionChinese">
     <frontierRules name="buychineseInfantry"/>
.
.
.
</productionFrontier>

Hope that helps some.
Kev
If emailing me at ComradeKev at yahoo.com , please add TripleA to the subject line
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
I did all of that...but now I am getting an massive Java error: (I have also attached the XML file to see is anyone can help)Ultimate+Pants+1.4.xml

Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
set, which is probably not what is desired.  Parser will use a default
ErrorHandler to print the first 10 errors.  Please call
the 'setErrorHandler' method to fix this.
Error: URI=jar:file:/C:/Program%20Files/TripleA102/triplea_1_0_2_0/bin/triplea.jar!/games/strategy/engine/xml/ Line=4562: An element with the identifier "productionRussians" must appear in the document.
games.strategy.engine.data.GameParseException: Could not find production frontier. name:productionRussians
        at games.strategy.engine.data.GameParser.getProductionFrontier(GameParser.java:250)
        at games.strategy.engine.data.GameParser.parsePlayerProduction(GameParser.java:1020)
        at games.strategy.engine.data.GameParser.parseProduction(GameParser.java:878)
        at games.strategy.engine.data.GameParser.parse(GameParser.java:121)
        at games.strategy.engine.framework.ui.NewGameChooserEntry.<init>(NewGameChooserEntry.java:27)
        at games.strategy.engine.framework.ui.NewGameChooserModel.createEntry(NewGameChooserModel.java:128)
        at games.strategy.engine.framework.ui.NewGameChooserModel.populateFromDirectory(NewGameChooserModel.java:154)
        at games.strategy.engine.framework.ui.NewGameChooserModel.populate(NewGameChooserModel.java:46)
        at games.strategy.engine.framework.ui.NewGameChooserModel.<init>(NewGameChooserModel.java:30)
        at games.strategy.engine.framework.startup.mc.GameSelectorModel.loadDefaultGame(GameSelectorModel.java:217)
        at games.strategy.engine.framework.startup.ui.MainFrame.<init>(MainFrame.java:60)
        at games.strategy.engine.framework.GameRunner2$1.run(GameRunner2.java:55)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
set, which is probably not what is desired.  Parser will use a default
ErrorHandler to print the first 10 errors.  Please call
the 'setErrorHandler' method to fix this.
Error: URI=jar:file:/C:/Program%20Files/TripleA102/triplea_1_0_2_0/bin/triplea.jar!/games/strategy/engine/xml/ Line=4562: An element with the identifier "productionRussians" must appear in the document.
games.strategy.engine.data.GameParseException: Could not find production frontier. name:productionRussians
        at games.strategy.engine.data.GameParser.getProductionFrontier(GameParser.java:250)
        at games.strategy.engine.data.GameParser.parsePlayerProduction(GameParser.java:1020)
        at games.strategy.engine.data.GameParser.parseProduction(GameParser.java:878)
        at games.strategy.engine.data.GameParser.parse(GameParser.java:121)
        at games.strategy.engine.framework.ui.NewGameChooserEntry.<init>(NewGameChooserEntry.java:27)
        at games.strategy.engine.framework.ui.NewGameChooserModel.createEntry(NewGameChooserModel.java:128)
        at games.strategy.engine.framework.ui.NewGameChooserModel.populateFromDirectory(NewGameChooserModel.java:154)
        at games.strategy.engine.framework.ui.NewGameChooserModel.populate(NewGameChooserModel.java:46)
        at games.strategy.engine.framework.ui.NewGameChooserModel.<init>(NewGameChooserModel.java:30)
        at games.strategy.engine.framework.ui.NewGameChooser.createComponents(NewGameChooser.java:56)
        at games.strategy.engine.framework.ui.NewGameChooser.<init>(NewGameChooser.java:45)
        at games.strategy.engine.framework.ui.NewGameChooser.chooseGame(NewGameChooser.java:123)
        at games.strategy.engine.framework.startup.ui.GameSelectorPanel.selectGameFile(GameSelectorPanel.java:250)
        at games.strategy.engine.framework.startup.ui.GameSelectorPanel.access$100(GameSelectorPanel.java:16)
        at games.strategy.engine.framework.startup.ui.GameSelectorPanel$2.actionPerformed(GameSelectorPanel.java:137)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Thanks in advance!

Chris
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

ComradeKev
Administrator
miccal99 wrote
games.strategy.engine.data.GameParseException: Could not find production frontier. name:productionRussians
There's your problem.  Instead of 'productionRussians', your XML has 'productionRussian'

Fix that and you'll at least make it to the next step.

Kev
If emailing me at ComradeKev at yahoo.com , please add TripleA to the subject line
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
She rides! Thank you for noticing my error.

Chris
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
OK...I am getting a different problem in the same scenario.

Playing an all-AI game to see how the engine handles the cheaper chinese and russian units. As soon as the Germans take Paris, the French capital, this comes up:

Exception in thread "Triplea start local thread" java.lang.IllegalArgumentException: No resource named:techTokens
        at games.strategy.engine.data.ResourceCollection.getQuantity(ResourceCollection.java:80)
        at games.strategy.triplea.delegate.BattleTracker.takeOver(BattleTracker.java:429)
        at games.strategy.triplea.delegate.MustFightBattle.attackerWins(MustFightBattle.java:2738)
        at games.strategy.triplea.delegate.MustFightBattle.access$3100(MustFightBattle.java:69)
        at games.strategy.triplea.delegate.MustFightBattle$18.execute(MustFightBattle.java:1084)
        at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:52)
        at games.strategy.triplea.delegate.MustFightBattle.fight(MustFightBattle.java:476)
        at games.strategy.triplea.delegate.BattleDelegate.fightBattle(BattleDelegate.java:120)
        at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.delegate.DelegateExecutionManager$2.invoke(DelegateExecutionManager.java:172)
        at $Proxy1.fightBattle(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.message.EndPoint.invokeSingle(UnifiedMessenger.java:728)
        at games.strategy.engine.message.EndPoint.invokeMultiple(UnifiedMessenger.java:697)
        at games.strategy.engine.message.EndPoint.invokeLocal(UnifiedMessenger.java:671)
        at games.strategy.engine.message.UnifiedMessenger.invokeAndWait(UnifiedMessenger.java:148)
        at games.strategy.engine.message.UnifiedInvocationHandler.invoke(UnifiedInvocationHandler.java:70)
        at $Proxy1.fightBattle(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.gamePlayer.GameOverInvocationHandler.invoke(DefaultPlayerBridge.java:176)
        at $Proxy1.fightBattle(Unknown Source)
        at games.strategy.triplea.baseAI.AbstractAI.battle(AbstractAI.java:193)
        at games.strategy.triplea.baseAI.AbstractAI.start(AbstractAI.java:287)
        at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:623)
        at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:487)
        at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:299)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher$2.run(LocalLauncher.java:125)
        at java.lang.Thread.run(Unknown Source)
Exception in thread "Triplea start local thread" java.lang.IllegalArgumentException: No resource named:techTokens
        at games.strategy.engine.data.ResourceCollection.getQuantity(ResourceCollection.java:80)
        at games.strategy.triplea.delegate.BattleTracker.takeOver(BattleTracker.java:429)
        at games.strategy.triplea.delegate.MustFightBattle.attackerWins(MustFightBattle.java:2738)
        at games.strategy.triplea.delegate.MustFightBattle.access$3100(MustFightBattle.java:69)
        at games.strategy.triplea.delegate.MustFightBattle$18.execute(MustFightBattle.java:1084)
        at games.strategy.triplea.delegate.ExecutionStack.execute(ExecutionStack.java:52)
        at games.strategy.triplea.delegate.MustFightBattle.fight(MustFightBattle.java:476)
        at games.strategy.triplea.delegate.BattleDelegate.fightBattle(BattleDelegate.java:120)
        at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.delegate.DelegateExecutionManager$2.invoke(DelegateExecutionManager.java:172)
        at $Proxy1.fightBattle(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.message.EndPoint.invokeSingle(UnifiedMessenger.java:728)
        at games.strategy.engine.message.EndPoint.invokeMultiple(UnifiedMessenger.java:697)
        at games.strategy.engine.message.EndPoint.invokeLocal(UnifiedMessenger.java:671)
        at games.strategy.engine.message.UnifiedMessenger.invokeAndWait(UnifiedMessenger.java:148)
        at games.strategy.engine.message.UnifiedInvocationHandler.invoke(UnifiedInvocationHandler.java:70)
        at $Proxy1.fightBattle(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at games.strategy.engine.gamePlayer.GameOverInvocationHandler.invoke(DefaultPlayerBridge.java:176)
        at $Proxy1.fightBattle(Unknown Source)
        at games.strategy.triplea.baseAI.AbstractAI.battle(AbstractAI.java:193)
        at games.strategy.triplea.baseAI.AbstractAI.start(AbstractAI.java:287)
        at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:623)
        at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:487)
        at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:299)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher$2.run(LocalLauncher.java:125)
        at java.lang.Thread.run(Unknown Source)

The game then freezes up.

Any ideas?

Chris
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
OK...the above is in the newest unstable, 1.0.2. In version 1.0.1.4, afdter I coped and pasted the xml over from 1.02, and try to load up, I get this:

No setter for attachment option. Setter:isInfantry Class:games.strategy.triplea.attachments.UnitAttachment

What does that mean?

Thanks (yet once again)

Chris
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

ComradeKev
Administrator
The isInfantry is a new parameter for version 1.0.2 and won't work in previous versions.  A simple fix is to search your xml and remove all occurrances of <option name="isInfantry" value="true"/>

The other exception above is a known issue in version 1.0.2.  I'm working on a fix.

Kev
If emailing me at ComradeKev at yahoo.com , please add TripleA to the subject line
Reply | Threaded
Open this post in threaded view
|

Re: XML Question

miccal99
Thanks...I got it to work in 1.0.1.4.

Chris