Custom Tech Givin to All Players ?



  • So when the first player gets it, they all get it. Been trying for a couple days and can't figure it out. When I change the conditions and trigger with another players name, it throws " Could not find rule. name:conditionAttachment xxx..."

    When I leave the condition named after the first player it works, but gives it to everybody. Anyone know why that is ?


  • Admins

    As I understand, if you have a tech that changes unitAttachment / unitProperty, then ALL players with access to this unit (like a unit called “infantry”) will suffer/make use of the unit changes. If you do a tech that does this, like changes the attack value or gives a new property to a unit, then the unit type is changed on the map for everyone.

    If you want only a single player’s units to be affected, then the unit must be unique to this player. For example, all players must have their own kind of infantry unit. Like “Ger_infantry”, “US_Infantry” and so on, so that the individual players can get their units changed. I think Total World War makes use of this system. This XML´s units are named like this: germanTank, russianTank and so on.

    One of the triggers, when germany optains the “ImprovedTanks” tech, is like this. It changes the German Tank´s stats/unitProperty:

    <attatchment name="triggerAttachmentgermanImpTanks2" attatchTo="Germany" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
    <option name="trigger" value="conditionAttachmentgermanImprovedTanks"/>
    <option name="unitType" value="germanTank"/>
    <option name="unitProperty" value="defense" count="5"/>
    <option name="uses" value="1"/>
    </attatchment>

    Another way of making tech triggers, that allows for units to be named the same / be the same for all players but still change the stats of only one player's units, is to give that player bonuses as part of the new tech. I have done this in the Star Trek map. One of the tech in this map is called ”Heavy-Cruiser-Warp-Upgrade” and does the following ... gives 1 bonus movement / changes move stat from 1 to 2:

    <attachment name="techAbilityAttachment" attachTo="Heavy-Cruiser-Warp-Upgrade" javaClass="games.strategy.triplea.attachments.TechAbilityAttachment" type="technology">
    <option name="movementBonus" value="1:Heavy-Cruiser"/>
    </attachment>

    These two types of upgrading / giving tech both have limits. I think some of the limits are described in the Pos2.xml, or at least you can see what possibilities there are.



  • Thanks for the reply Frostion. Yea that makes sense. I remember having to do that when I wanted the same unit to have different maxbuilt for players.

    However one of the techs I have is a new "shipyards". So it's adding and/or subtracting units to players production. Everybody has their own production now, so I'm not quite sure why they'd all be affected. I must be using a condition that somehow is sensed by everybody's trigger. I was pretty sure everything was player specific named though. Perhaps a fresh look will allow me to find it.

    So on your 2nd example, I don't quite follow. Wouldn't all Heavy-Cruisers receive the bonus ? Do you have to have a playerAttachment of some sort as well ?


  • Admins

    Well in the Star Trek map, every player has acces to develop for example this tech:
    <techname name="Light-Cruiser-Offensive-Weapons-Upgrade"/>

    The tech does this (It upgrades the attack value by 1 on two types of ships):
    <attachment name="techAbilityAttachment" attachTo="Light-Cruiser-Offensive-Weapons-Upgrade" javaClass="games.strategy.triplea.attachments.TechAbilityAttachment" type="technology">
    <option name="attackBonus" value="1:Light-Cruiser"/>
    <option name="attackBonus" value="1:Light-Cruiser-C"/>
    </attachment>

    There are no player specified, but I guess it only affects the player who develops the tech. The tech is still available for the other players to also develop. “techAbilityAttachment” techs do have limitations on what stats you can change. I know that you can change/upgade movement, attack, defense and add canBombard. I do this on the Star Trek map. Maybe there are some more things you can change, but you will have to look in the POS2.xml.

    I just tested the Star Trek map, and it works like I describe here. Here is the XML: 0_1489183509813_star_trek_dilithium_war.xml



  • @Frostion
    Right on. I just found my mistake. Didn't have the conditions player specific. I thought I had but must've been to bleary eyed last night : )

    Thanks again for your help Frostion, it's all clicking now. : )


Log in to reply
 

Looks like your connection to TripleA Forum was lost, please wait while we try to reconnect.