Announcement

Collapse
No announcement yet.

Unit Updater

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

  • Unit Updater

    Hi Grandpa Troll,

    Some time ago, we spoke about a Unit Updater for Civilization : Call to Power on this forum. Though there was some advance on this ground the system designed was a bit cumbersome and could be improved. Did you design something else or is a "CtP : Unit Updater" a dead and well burried project ?
    "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

  • #2
    Re: Unit Updater

    Originally posted by Tamerlin
    Hi Grandpa Troll,

    Some time ago, we spoke about a Unit Updater for Civilization : Call to Power on this forum. Though there was some advance on this ground the system designed was a bit cumbersome and could be improved. Did you design something else or is a "CtP : Unit Updater" a dead and well burried project ?
    I was in a bad car wreck 6-7 weeks ago and am having Spinal Surgery tommorrow, but pretty sure this is a dead point, unfortunately.

    The best I came up with was to make a unit available all game once it is researched (The advancement that is)

    Sorry

    Gramps
    Hi, I'm RAH and I'm a Benaholic.-rah

    Comment


    • #3
      Thank you for your reply Grandpa.

      I am sorry for your accident and I hope you will quickly recover your health.
      "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

      Comment


      • #4
        What was this "Unit Updater" supposed to do exactly?

        Comment


        • #5
          Originally posted by Keygen
          What was this "Unit Updater" supposed to do exactly?
          Keygen, sometime back (maybe a year and a half ago) several of us talked about a CIVII sort of updater where you didnt have a useless phalanx during modern day Marine combat.

          But after many hours of talk and exploring possibilities,I realized it was beyon what I want to exlore possibilityies of.

          Gramps
          Hi, I'm RAH and I'm a Benaholic.-rah

          Comment


          • #6
            Originally posted by Keygen
            What was this "Unit Updater" supposed to do exactly?
            Hi Keygen and Grandpa Troll,

            First of all Grandpa, I hope you are doing well and that you are recovering well.

            A "Unit Updater" is already working for CtP2 and allows you to update a unit (though you have to spend some gold to do so) to a newer version when it is available (e.g: a Musketeer can be updated to a Machine Gunner when the second is available).

            The problem is that though Grandpa Troll managed to design an updating system for CtP1 it is still a bit cumbersome and could be improved in order to be easier to use.
            "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

            Comment


            • #7
              I see, a pretty good idea

              How can this be done in CTP1? SLIC and an external program? Or is it possible to use existing code from CTP2 source code and integrate it, with some reverse engineering, into CTP1?

              Comment


              • #8
                This should be possible with (quite) a bit of SLIC code. Could be working as follows: In a "unit.selected" or "clicked.unit" trigger function a message (icon on the left) is displayed, offering an upgrade, if available ("HasAdvance"; upgrade paths must be defined) and if the player has enough gold (variable "player.gold"; amounts for every upgrade possible must be defined). If the player selects to upgrade the unit, the gold is subtracted (function "AddGold" with a negative amount), the selected unit is removed ("KillUnit") and the new unit is added ("CreateUnit") on the same tile ("unit.location"; must be stored before killing the old unit using "ExtractLocation") and the message (icon) is removed. The messages should be of a specific class, so they can be removed when some other trigger fires (especially "unit.deselected"), e.g. if the player doesn't use the upgrade option.

                And who of you is willing to implement it ? I'm afraid that I won't have enough time to do it in the near future...

                Comment


                • #9
                  Originally posted by hatschy
                  This should be possible with (quite) a bit of SLIC code. Could be working as follows: In a "unit.selected" or "clicked.unit" trigger function a message (icon on the left) is displayed, offering an upgrade, if available ("HasAdvance"; upgrade paths must be defined) and if the player has enough gold (variable "player.gold"; amounts for every upgrade possible must be defined). If the player selects to upgrade the unit, the gold is subtracted (function "AddGold" with a negative amount), the selected unit is removed ("KillUnit") and the new unit is added ("CreateUnit") on the same tile ("unit.location"; must be stored before killing the old unit using "ExtractLocation") and the message (icon) is removed. The messages should be of a specific class, so they can be removed when some other trigger fires (especially "unit.deselected"), e.g. if the player doesn't use the upgrade option.

                  And who of you is willing to implement it ? I'm afraid that I won't have enough time to do it in the near future...
                  Thanks Hatschy which is where I ended up about a year and a half ago..

                  Peace

                  Gramps
                  Hi, I'm RAH and I'm a Benaholic.-rah

                  Comment


                  • #10
                    Originally posted by hatschy
                    And who of you is willing to implement it ? I'm afraid that I won't have enough time to do it in the near future...
                    As Grandpa wrote it, this is the heart of the problem, many things to do and not much time to do them. A good deal of work as already been done by Grandpa Troll himself though. If someone want to keep the flame, here are the files.

                    What would be good is a CtP1_UnitUpdater that would work like the CtP2_UnitUpdater.

                    When you get the appropriate advance, the game asks you whether you want to upgrade your units or not. If the answer is yes, the game then asks if you want to upgrade them all or only a part of them. This is the point reached by Grandpa Troll.

                    After the initial Update (in the turn you get the advance) prompted by the game, the CtP2_UnitUpdater is used when the player ask for it through the "sleep button". When you want to upgrade a unit (you just have to seperate them when they are in a stack with different units), you select the unit and click on the "sleep button". If the unit is an older one and you have enough money you are asked whether you want to upgrade the unit or not. If the unit is a newer one and does not need any update, the "sleep button" gives the usual order and the unit goes to sleep.

                    IMO, this is the way the CtP1_UnitUpdater should work, through a button in the interface, if we want it to be easy to use in a game.

                    The problem is that I don't have any programming skill.
                    Attached Files
                    Last edited by Tamerlin; May 12, 2006, 04:03.
                    "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                    Comment


                    • #11
                      Originally posted by Tamerlin


                      As Grandpa wrote it, this is the heart of the problem, many things to do and not much time to do them. A good deal of work as already been done by Grandpa Troll himself though. If someone want to keep the flame, here are the files.
                      I wish I could take ownership but that was done by another fellow, and it slips my mind whom
                      Hi, I'm RAH and I'm a Benaholic.-rah

                      Comment


                      • #12
                        Thanks for the files There is some considerable work done in this mod.

                        I haven't touched SLIC for some years now, since I implemented the PBEM mod

                        Comment


                        • #13
                          Ok folks, here is a test version of a newly developed "Unit Upgrade" scenario. It has the following features:
                          - Reminder at the beginning of each turn, if upgrading units is possible,
                          - iterate over upgradable units (forward and backward),
                          - iterate over all available upgrade options for the selected unit,
                          - respects the technological and government type specific needs,
                          - definition of upgrade paths made easy (even for non-programmers).

                          This is a "test version" in the sense that it is fully functional, but there are almost no upgrade paths defined (except for unit types "Warrior" and "Phalanx"). And there is also some code included in the scenario initialization trigger, that grants the first human player the advances "Bronze Working" and "Iron Working" as well as 10000 pieces of gold. The reason for this is to shorten the time until you see something happen during the test phase. This means, when starting a game with the scenario enabled, you just have to build a warrior and you'll see the scenario working as soon as it is finished.

                          "Test version" also means "Testers very welcome!". So if you are interested in this scenario, please post bug reports and/or suggestions in this thread.

                          As for the upgrade paths: I didn't want to decide, which upgrade options make sense and which don't. I'll leave that to a discussion here in this thread. I just tried to make changing them as easy as possible. Adding an upgrade option for a unit type is as easy as adding one line to the "scenario.slc" file. This is best shown by an example. Here is part of the "scenario.slc" file:

                          messagebox 'UU_M_UpgradeWarrior' {
                            Abort();
                            uu_unitFromType = UnitType("UNIT_WARRIOR");
                            // Phalanx
                            Message(g.player, 'UU_M_UpgradeOptionPhalanx');
                            // Legion
                            Message(g.player, 'UU_M_UpgradeOptionLegion');
                            // Pikeman
                            Message(g.player, 'UU_M_UpgradeOptionPikeman');
                            // Musketeer
                            Message(g.player, 'UU_M_UpgradeOptionMusketeer');
                            // Machine Gunner
                            Message(g.player, 'UU_M_UpgradeOptionMachineGunner');
                            // Marine
                            Message(g.player, 'UU_M_UpgradeOptionMarine');
                          }

                          This is the function that defines the upgrade options for unit type "Warrior" (in the test version; this might change in future versions). As you can see, there is only one line needed (not counting the optional comment lines that start with a double slash) to define an upgrade option from warrior to phalanx or to musketeer or to whatever. So if you want to allow upgrading a diplomat to a fusion tank , what you do is:
                          - Open the "scenario.slc" file with Notepad (or your favorite text editor),
                          - search for the function named 'UU_M_UpgradeDiplomat',
                          - change the function by adding a line (plus optionally a comment line) like this:

                          Before editing "scenario.slc":

                          messagebox 'UU_M_UpgradeDiplomat' {
                          Abort();
                          uu_unitFromType = UnitType("UNIT_DIPLOMAT");
                          }

                          After editing "scenario.slc":

                          messagebox 'UU_M_UpgradeDiplomat' {
                            Abort();
                            uu_unitFromType = UnitType("UNIT_DIPLOMAT");
                            // Fusion Tank
                            Message(g.player, 'UU_M_UpgradeOptionFusionTank');
                          }

                          The names of the upgrade path functions always follow this schema:
                          'UU_M_UpgradeUnitType', where UnitType is the name of the unit type in the English version of CtP with all blanks eliminated and first letters of all words capitalized e.g. "MachineGunner", "FusionTank", "ShipOfTheLine", etc.).

                          The names of the upgrade options are similar to this, they only start with "UU_M_UpgradeOption" instead of "UU_M_Upgrade".

                          There are some unit types, which I don't provide upgrade functions for, like nukes or wormhole probes. I think that it doesn't make sense to offer upgrades of/to these kind of units.

                          As for the price you have to pay for an upgrade: Currently it is implemented such, that the price is the same as when moving a unit to a city with an empty build queue and disbanding the old unit followed by rush buying the new unit. If you want to try a different computation method, you can change the function 'UU_M_CalculatePrice'. This function gets the variables "uu_unitFromType" and "uu_unitToType" as input and must set the variable "uu_price" as output. The current implementation calculates the price based on the values from the original files "Units.txt" and "Govern.txt". If you have tampered with these files, the upgrade price may differ from what you have to pay in a city.

                          As for the technological and government type specific needs, these are also taken from the original "Units.txt" file and contained in the various upgrade option functions (one for each unit type). This also means that you cannot upgrade to obsolete unit types.

                          Thanks for reading that far and please remember to post here, if you have any bug reports or suggestions for improvements or specifically for unit upgrade paths that should be implemented.
                          Attached Files

                          Comment


                          • #14
                            Oh, maybe you'll need an explanation of the user interface. It consists mainly of an alert box (these are the message boxes, that appear in the upper right corner). I have attached an image of this alert box.

                            The alert box will be activated, if you press the "Start upgrading" button in the upgrade reminder message (the red arrow icon, that appears at the beginning of your turn, if you could upgrade at least one unit). It will be activated also, if you press the "." (period) key on your keyboard at any time.

                            The alert box informs you about the upgrade options for the selected unit (there will always be a unit selected, if you see the alert box). The buttons in the alert box give you the following options:
                            - "Yes": Upgrade the selected unit using the upgrade option shown in the alert box, then close the alert box.
                            - "Yes + >": Upgrade the selected unit, then select the next upgradable unit.
                            - "Options": Cycle through the upgrade options currently available for the selected unit.
                            - " < ": Select the previous upgradable unit.
                            - " > ": Select the next upgradable unit.
                            - "Close": Close the alert box without upgrading (you can open it again with the "." (period) key).
                            Attached Files

                            Comment


                            • #15
                              Thank you hatschy, I will try to test your updater as soon as possible.

                              "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                              Comment

                              Working...
                              X