Announcement

Collapse
No announcement yet.

Help with Unit.txt

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

  • Help with Unit.txt

    I'm sure these questions have been asked before but I didnt see it in the mod resources. A lot of these came from Martin's flaglist, but it doesnt have much details. Can anyone explain what these unit fuctions do or where to find info on them?


    IsTrader
    NeedsNoSupport
    AssistedDrops
    SettlerSlaveRaids
    CreateParks
    CanInjoin
    IsSpecialForces
    NotAffectedByLandMines
    BonusFood
    CanRustle
    GovernmentType
    CreateRift
    CanCloak
    TransformPartial

    SettleBuilding - does this build time imp? and can you do it AI civs

    ShieldHunger - does this mean we can make it cost shields per turn?
    FoodHunger - does this mean we can make it cost food per turn?


    BRange - IS this bombard Range? Doe sthis mean we can do ranged artillery bombardment like civ3?

    CantMove - Is this like the immobile flag Solver was working on? can it still attack?


    thanks
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    Ill just answer the ones im sure of.

    IsTrader
    Used for Caravans and Freights. This basically adds them to the available trade caravan count once theyre built i think. I think the move points for these units specified how many are added to the count, freight has 3 movement so 3 added to the available trade pool. That part is a guess though, i havent tested it.

    NeedsNoSupport
    Well its just used for cities.

    CreateParks
    This is used to specify which units can use the nanite cleansing attack on a city, which destroys the whole city. Only the eco-ranger has it in the unmodded game.

    CanInjoin
    This is used for units that can file injunctions (stop production for 1 turn), only the lawyer can do it in the unmodded game.

    IsSpecialForces
    Its used for special forces units, Samurai, Knights, Marines etc, when you lower military readiness the special forces units stay "at war" and cost full support all the time. If its used under other units like stealth etc then its so they always take full support cost all the time too.

    GovernmentType
    This says which government the unit can only be built under. Fascist under Fascism, Televangelist under Theocracy etc.

    SettleBuilding - does this build time imp? and can you do it AI civs
    This just allows when you use that unit with this flag (only the urban planner has it in unmodded game) when they found a new city the specified building is auto-built in that city.

    Code:
       SettleBuilding IMPROVE_ACADEMY
       SettleBuilding IMPROVE_COURTHOUSE
       SettleBuilding IMPROVE_GRANARY
       SettleBuilding IMPROVE_SHRINE
       SettleBuilding IMPROVE_THEATER
    ShieldHunger - does this mean we can make it cost shields per turn?
    Yeah it does.
    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
    CtP2 AE Wiki & Modding Reference
    One way to compile the CtP2 Source Code.

    Comment


    • #3
      Re: Help with Unit.txt

      A lot of the unused ones are hangovers from C:CtP, and probably don't work, if indeed they ever did.

      AssistedDrops
      Used by the Swarm unit in C:CtP. Offhand I can't think of any ability that was unique to the Swarm that would count as an Assisted Drop. Although it presumably relates to the space layer and is now redundant.

      SettlerSlaveRaids
      CtP2 flag that lets a slaver pick off unescorted settlers.

      NotAffectedByLandMines
      Somewhere in the early stages of C:CtP's programming they apparently toyed with the idea of landmines. Presumably they'd work in the same way as the Cow unit did, except with explosions rather than food. I would *guess* that the unaffected unit(s) would the Sweeper unit (unused sprite #37 in CtP1) and maybe some future-age tanks or something. Either way, the whole lot got scrapped, presumably since landmines were too easy to exploit, or too hard to program the AI around.

      BonusFood
      CanRustle
      Cow-unit hangers-on from C:CtP. The intention being that cow units in a city radius would provide the city's food, and the rustler unit would come along and snaffle them, much in the same way a slaver would take a settler, although hypothetically the cow unit would just switch to the rustler's civ's ownership rather than being disbanded. This concept was also scrapped, probably due to similar reasons as the landmines.

      CreateRift
      The C:CtP DEFAULT_SPRITE for a city is apparently a RIFT_GATE in units.txt, but of course this is superceded by the citysprite.txt so isn't used. There may be other references elsewhere, I forget. Either it's something to do with the wormhole probe victory, or another scrapped concept with space teleportation or something. We still don't know what the unit in Martin's avatar was meant to do/be. (Note the game one has blue stripes not red)

      CanCloak
      The "Phantom" spaceship in C:CtP could cloak- basically it became a stealth unit, but could still attack. I can't remember how it affected zones of control (if at all). Doubt if it works in CtP2.

      TransformPartial
      Appears to be completely unused. No idea.

      ShieldHunger
      FoodHunger
      SheildHunger is the flag the game uses to calculate upkeep as far as I know. The FoodHunger flag is pretty hard to test, but I don't think anyone has had any success making it work.

      BRange - IS this bombard Range? Doe sthis mean we can do ranged artillery bombardment like civ3?
      Unfortunately not.

      CantMove - Is this like the immobile flag Solver was working on? can it still attack?
      I'm pretty sure Locutus tried this while making the militia code without success. It would be pretty cool to have a working one though.
      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


      • #4
        Thanks IM and Maq

        Just hope maybe some coders get them worker and maybe add some new ones...

        another question though
        quote:
        "CanCloak

        The "Phantom" spaceship in C:CtP could cloak- basically it became a stealth unit, but could still attack. I can't remember how it affected zones of control (if at all). Doubt if it works in CtP2."

        I guess that means a spy unit with an attack value cant attack. I'd test if I had my computer, but I thought somewhere that it could and you wouldnt know who did it.
        Formerly known as "E" on Apolyton

        See me at Civfanatics.com

        Comment


        • #5
          I think it's the IsCivilian flag that prevents attacking (though the CantCaptureCity flag is probably a good one to disable as well if you want it to be a stealthy military unit). If you're attacked by a stealthy unit (EcoWarriors for example have attack values and stealth), it will show up anyway in the battle view, surely? I don't know what would happen if it attacked in a situation where the battle view was off.
          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
            Here is some information we have in the "Modding Knowledgebase" until now. It's incomplete - please feel free to improve the information by adding your comments:
            IsTrader
            NeedsNoSupport
            IsSpecialForces
            BonusFood
            GovernmentType
            CreateRiftOrder
            ShieldHunger
            FoodHunger
            IsCivilian
            The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

            Comment


            • #7
              Re: Help with Unit.txt

              Originally posted by E
              BonusFood
              It is from the CTP1 cow unit, in CTP1 the cow gave a food bonus of five to the underlying terrain.

              Originally posted by E
              CanRustle
              Whether this unit can steal foreign cows. Probably doesn't work in CTP2 and in CTP1 either

              Originally posted by E
              CreateRift
              Probably the ability of a unit to turn a oiece of land into a rift. But is probably unimplemented as well.

              Originally posted by E
              ShieldHunger - does this mean we can make it cost shields per turn?
              The production support costs for this unit per turn.

              Originally posted by E
              FoodHunger - does this mean we can make it cost food per turn?
              Probably the same but for food, possibly unimplemented.

              Originally posted by E
              BRange - IS this bombard Range? Doe sthis mean we can do ranged artillery bombardment like civ3?
              Maybe this is the purpose, but I doubt that this is implemented.

              -Martin
              Civ2 military advisor: "No complaints, Sir!"

              Comment


              • #8
                Originally posted by Immortal Wombat
                SheildHunger is the flag the game uses to calculate upkeep as far as I know. The FoodHunger flag is pretty hard to test, but I don't think anyone has had any success making it work.
                FoodHunger is never used in the source, so I think it's safe to assume it does nothing.

                Comment


                • #9
                  has anyone looked in the code for these abilities? are there any more there than can be fixed/finished?
                  Formerly known as "E" on Apolyton

                  See me at Civfanatics.com

                  Comment


                  • #10
                    Well, in theory, of course, all of them can be made to do something. I have looked at a couple and seen no half-finished chunks of code or anything like that, but there might well be in some.

                    I'm happy to go investigating some in particular if there are any you're especially curious about, but investigating the whole list seems a little daunting .

                    Comment


                    • #11
                      Thanks J,

                      Actually I'm just curious about a few "maybe simple" things like:

                      making hungerfood work

                      seeing if its possible to copy/edit hungershield into a hungergood function

                      looking at the settlecity code and see if it can be made into a settleimprov code so a unit when it settles builds a specified improvement

                      So most are seeing if original code can be copied and then modified to do a few new things


                      For an original one I was wonering if there is a way to take the POW SLIC used in conquests that creates captured units and make it into a unit function but with a 33% or 50% chance of success and the possibility of typing after the function POW in unit.txt what kind of unit is created i.e.
                      POW Unit_Fascist so 33% or 50% of the time when this unit wins a battle it would create a fascist. the other option would be that when POW is not followed by a specified unit, then it just changes the ownership of the unit captured i.e.
                      POW
                      If an infantry captures another infantry it stays an infantry instead of becoming a facsist or something.

                      Hope that doesnt blow you away J. I've been goin through SLIC but I'm no programmer but if I think I see the unit files in:

                      ctp2_code\gs\gameobj

                      But I couldnt make sense out of it. But I did see the "include" part in the beginning and I'm also wonder if we include tileimp and wonder files then we might be able to apply abilities/functions associated with tile imps and wonders to units?

                      thanks
                      Last edited by Ekmek; September 27, 2004, 18:26.
                      Formerly known as "E" on Apolyton

                      See me at Civfanatics.com

                      Comment


                      • #12
                        Originally posted by E
                        Actually I'm just curious about a few "maybe simple" things like:

                        making hungerfood work

                        seeing if its possible to copy/edit hungershield into a hungergood function
                        It wouldn't be as simple as that, no. Although FoodHunger shouldn't be so hard to implement as ShieldHunger, it's surprisingly different, and it would have to be pretty much written from scratch. I might have a go, if I feel in the mood to, but no promises .

                        looking at the settlecity code and see if it can be made into a settleimprov code so a unit when it settles builds a specified improvement


                        You mean tile improvements? I'm not really sure how that would work. Do you mean improvements on the city square or around it? If the latter, how would you decide where to put them, and which ones to use?

                        For an original one I was wonering if there is a way to take the POW SLIC used in conquests that creates captured units and make it into a unit function but with a 33% or 50% chance of success and the possibility of typing after the function POW in unit.txt what kind of unit is created i.e.
                        POW Unit_Fascist so 33% or 50% of the time when this unit wins a battle it would create a fascist. the other option would be that when POW is not followed by a specified unit, then it just changes the ownership of the unit captured i.e.
                        POW
                        If an infantry captures another infantry it stays an infantry instead of becoming a facsist or something.


                        Is there anything in particular wrong with the existing SLIC, or are you just wanting it to go a little bit faster, or be easier to implement?

                        Comment


                        • #13
                          rfom gs/readiness.cpp
                          Code:
                          void MilitaryReadiness::SupportUnit(const Unit &u, sint32 gov)
                          
                          {
                          	double unitCost = GetSupportCost(u);
                          
                          	m_cost += unitCost;
                          
                          	g_network.Block(m_owner);
                          	ENQUEUE();
                          	g_network.Unblock(m_owner);
                          }
                          
                          double MilitaryReadiness::GetSupportCost(const Unit &u)
                          {
                          	if(u.GetIsProfessional())
                          		return 0;
                          
                          	if(u.GetNeedsNoSupport())
                          		return 0;
                          
                          	double unitCost;
                          	if(u.GetDBRec()->GetIsSpecialForces()) {
                          		unitCost = u.GetShieldHunger() * GetSpecialForcesSupportModifier(g_player[m_owner]->GetGovernmentType());
                          	} else {
                          		unitCost = u.GetShieldHunger() * GetSupportModifier(g_player[m_owner]->GetGovernmentType());
                          	}
                          	unitCost -= unitCost * 
                          		double((double)wonderutil_GetReadinessCostReduction(
                          			g_player[m_owner]->GetBuiltWonders()) / 100.0);
                          
                          	unitCost *= g_theGovernmentDB->Get(g_player[m_owner]->m_government_type)->GetSupportCoef();
                          
                          	return unitCost;
                          other instances of shield hunger are in unit.cpp and unit.h but nothing other than this.
                          I wonder if its just looking for the flag and value after it?
                          Formerly known as "E" on Apolyton

                          See me at Civfanatics.com

                          Comment


                          • #14
                            Originally posted by E
                            I wonder if its just looking for the flag and value after it?
                            Sorry, I don't understand you...

                            Comment


                            • #15
                              It looks like this code looks to see if a unit has the hungershield flag and then looks for the value after it and then subtracts that value from the players PW.

                              So it looks like that in order to fix hungerfood or add hungergold, we'd have to create the flag and then look for the number value after the flag...

                              Also the unit support code I listed previously doesnt mention hungerfood which may be why the flag appears unimplemented

                              Code:
                              sint32 Unit::GetShieldHunger() const
                              
                              {
                                  return GetDBRec()->GetShieldHunger(); 
                              }
                              
                              sint32 Unit::GetFoodHunger() const
                              
                              {
                                  return GetDBRec()->GetFoodHunger();

                              I may have to start a new thread on re-implementing it in the source code area
                              Last edited by Ekmek; October 5, 2004, 20:10.
                              Formerly known as "E" on Apolyton

                              See me at Civfanatics.com

                              Comment

                              Working...
                              X