Announcement

Collapse
No announcement yet.

Unit names

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unit names

    Is it possible to change the name of a unit during a game? For example if I've got 2 archers and during the game I want to change ones name from Archer to Dave and the other to Bob.
    Shores Of Valinor.com - The Premier Tolkien Community -

  • #2
    Only by amking an army of one and then naming the army. But then it means you cannot stack Dave and Bob together without losing their identities.
    Concrete, Abstract, or Squoingy?
    "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

    Comment


    • #3
      thats tight

      Comment


      • #4
        yes you can kill the arches and reincarnate as freed, bob ,Dave, and or sue. ( by turning them into special units with different name from archer).


        It works well in the Samaria scenario. Only deferens in that is skill upgrade but look into it, it is possible
        "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
        The BIG MC making ctp2 a much unsafer place.
        Visit the big mc’s website

        Comment


        • #5
          You'd need an extra unit for every name of every normal unit. I think that option is a little unfeasable.
          Concrete, Abstract, or Squoingy?
          "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

          Comment


          • #6
            Just saw this page http://apolyton.net/ctp2/modificatio...cbuiltin.shtml which contains:

            UnitRecord array
            unitrecord.name - the unit type's name
            unitrecord.attack - the unit type's attack value
            unitrecord.defense - the unit type's defense value
            unitrecord.cost - the production cost of the unit type
            unitrecord.ranged - the unit type's ranged attack value
            unitrecord.movement - the unit type's move points
            Is it then possible to change unitrecord.name to call a unit Bob? Or unitrecord.attack etc to change a units stats during the game?
            Shores Of Valinor.com - The Premier Tolkien Community -

            Comment


            • #7
              They're read-only.

              The unitrecord.name just accesses its name in gl_str.txt, for example:
              UNIT_WAR_CHIEF "War Chief"

              The unit stats should theoretically be able to be changed using the mod_UnitAttack() function, but its a weird function that probably does not work properly (ie. returns 1 - normal attack, or 0 - no attack)

              So really, there is no way to alter any unitrecord array members, sorry.
              Concrete, Abstract, or Squoingy?
              "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

              Comment


              • #8
                Actually, unitrecord.name is only a string, not an int or anything. So technically, what IW said is not 100% correct. The stored element in unitrecord.name = "Archer" for an archer, not ID_UNIT_ARCHER, and so forth.

                This is the same for player.name, city.name and many other permanent array members.

                Comment

                Working...
                X