Announcement

Collapse
No announcement yet.

SLIC and Obsolete Units

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

  • #16
    Great work, guys!
    Now, we need to combine these new functions to do some really great things. Here is my plan, which I want to implement for the Modern mod.

    Each of the six ages in my mod has a unit progression.
    1)I want for cities founded in each age to have a special version of that age's defensive unit automatically created in them. This special unit will be identical to the regular unit, except that it will have zero movement. (I *think* that the AI will fortify the unit like it does other units, so a fortification trigger will not be needed.)
    I believe that I can simply add these units to the units text, and have them use the graphics and sounds of the regular units, so that nothing extra will have to be added to the mod from this standpoint.
    Also, since these units will have slightly different names from the regular units, there will be no need to add them to the aips. They should not interfere with the gather aip, nor will they be counted in the aip build queues.

    2)Since the units created within the cities will be increasingly more powerful, I will create separate settler units for each age, which will be progressively more costly. The new versions *will* have to be added to the aips, but will use the same graphics and so-forth as the original.

    3)The trigger to have sea cities start at size three will be very useful, especially when paired with the new unit creation trigger.

    That's all I can think of right now.

    Comment


    • #17
      Well well, there is much people requesting for the Obsolete Units Functions thru mails, so I have decided to post it here.

      Note:
      When modifying the following codes to add more units, advances should go in the if-elseif functions with the later discovery first and earliest discovery last, else you'll always get the Warriors appearing even when you have discovered Space Colonies.

      Updated on 8th Jan 2000.
      Code:
      // Create a unit type depend on the advances discovered upon building of new city
      
      Trigger 'NewCityUnit' when (city.built && IsHumanPlayer(g.player)) {
        If (HasAdvance(g.player, ID_ADVANCE_SPACE_COLONIES)) {
          If (TerrainType(city.location) == 13 ) {
            CreateUnit(g.player, UnitType("UNIT_STEALTH_FIGHTER"), city.location, 0);
          }
          Else {
            CreateUnit(g.player, UnitType("UNIT_SPACE_MARINES"), city.location, 0);
          }
        }
        ElseIf (HasAdvance(g.player, ID_ADVANCE_EXPLOSIVES)) {
          CreateUnit(g.player, UnitType("UNIT_MACHINE_GUNNER"), city.location, 0);
        }
        ElseIf (HasAdvance(g.player, ID_ADVANCE_GUNPOWDER)) {
          CreateUnit(g.player, UnitType("UNIT_MUSKETEERS"), city.location, 0);
        }
        ElseIf (HasAdvance(g.player, ID_ADVANCE_AGRICULTURAL_REVOLUTION)) {
          CreateUnit(g.player, UnitType("UNIT_PIKEMEN"), city.location, 0);
        }
        ElseIf (HasAdvance(g.player, ID_ADVANCE_BRONZE_WORKING)) {
          CreateUnit(g.player, UnitType("UNIT_HOPLITE"), city.location, 0);
        }
        Else {
          CreateUnit(g.player, UnitType("UNIT_WARRIOR"), city.location, 0);
        }
      }
      [This message has been edited by Dreamer (edited January 08, 2000).]

      Comment


      • #18
        Dreamer,

        For a unit to be built in a space city (even via the cheat menu), it has to have the SPACE_CITY_CAN_BUILD variable. The following are some of the units which have this set; space marine, machine gunner, tank, Mobile Sam and paratrooper. If they also have MOVEMENT_TYPE_SPACE, they can freely move around space. If they don't have it, they will automatically be put in pods when they are moved.


        Wes,
        You realize that units with zero movement can move don't you? As long as you have a movement type (land, sea, air, space), the unit can be moved in that type environment. If you don't set a movement type, you can't build the unit at all. If you don't fortify the unit, it will show up at your city every round.

        Don
        Don,
        CtPMaps (Hosted by Apolyton)

        Comment


        • #19
          Dreamer, Locutus,

          To fix the new space city problem you need to add a few lines of code. I'm not an SLIC geru so there might be an easier way to do this.

          First, make sure the unit you are using once space is available is able to launch (has 'IS_SPACE_LAUNCHER' in units.txt)

          Second, add this code;
          TypeUnit MyNewUnit; (Outside the trigger)
          SetOrder(1, 15); (This launches the unit into space)
          AddOrder(MyNewUnit, city.location);
          SetOrder(1, 4); (This fortifies the unit once it is in the city)
          AddOrder(MyNewUnit, city.location);

          Thats it. Your new code would look something like:

          // Create a new unit code blah blah blah
          TypeUnit MyNewUnit;

          trigger 'NewCityBuilt' when (city.built) {
          (If (HasAdvance(player, ID_ADVANCE_SPACE_COLONIES)) {
          AddPops(city,2);
          CreateUnit(player, UnitType("UNIT_SPACE_MARINES"), city.location, 0, MyNewUnit);
          SetOrder(1, 15);
          AddOrder(MyNewUnit, city.location);
          SetOrder(1, 4);
          AddOrder(MyNewUnit, city.location);
          }
          ELSE
          blah blah blah

          Update: Boy that came out awful ugly. Email me if you can't read it and I will send you the code.

          Don

          [This message has been edited by skorpion59 (edited January 03, 2000).]
          Don,
          CtPMaps (Hosted by Apolyton)

          Comment


          • #20
            Skorpion59,

            Cheers...that is very thoughful of you, but I don't remember Space Marines can do Space launching?

            Locutus and I were trying on these without modifying the units.txt file. Are you thinking of the same as me Locutus?

            Comment


            • #21
              Don (and everyone else):
              You can make your trigger (and any other code) look less ugly by using the UBB-tag "code". This allows you to insert spaces and use all kinds of code (which then won't be executed if that should be possible).

              I also have a question to you: where did those numbers for fortifying and launching come from? Until now I thought these were based on the order.txt file, but launch is number 2 there and I couldn't even find fortify.

              Thanks for all the advise, it is much appreciated, but you were too late: I solved the problem without your help already (just didn't post it yet, because it saves me money to wait 'til 20.00u ). It does involve changing unit.txt though, I think this is inevitable.
              I made a new unit based on the MACHINE_GUNNER entry: I called the new unit GARISSON and changed the MAX_MOVEMENT value to 0 (so it can't move). I added the special flags MOVEMENT_TYPE_SPACE, MOVEMENT_TYPE_WATER and MOVEMENT_TYPE_SHALLOW_WATER so it doesn't matter over what terrain the space-city is created (until now my machine-gunners disappeared if a spacecity was created above a watertile). Also I created the special flag IS_SPACE_LAUNCHER to make it possible for this unit to launch into space. For the rest the GARRISON unit is identical to the machine-gunner. Finally I wrote this trigger:

              Code:
              TypeUnit machine1;
              // TypeUnit machine2; - Originally I wanted 2 machinegunners in my city, 
              //but since I believe Wes wants only one, I remarked all the code for the second unit.
              TypeLocation newcity;
              
              trigger 'CreateSpace/UnderseaCities' when (city.built) {
              	newcity = city.location;
              	if ( IsUnderseaCity(city) ) {
              		AddPops(city, 2);
              		CreateUnit(g.player, UnitType("UNIT_MACHINE_GUNNER"), newcity, 0, machine1);
              		// CreateUnit(g.player, UnitType("UNIT_MACHINE_GUNNER"), newcity, 0, machine2);
              	}
              	// if the city is a spacecity: (IsSpaceCity doesn't work with patch 1.2)
              	if ( TerrainType(newcity) == 13 ) {
              		AddPops(city, 2);
              		CreateUnit(g.player, UnitType("GARRISON"), newcity, 0, machine1);
              		// CreateUnit(g.player, UnitType("GARRISON"), newcity, 0, machine2);
              		// Adding one movement-point, since movement is actually 
              // zero and hence it can't launch - I think)
                              AddMovement(machine1, 1);
              		// AddMovement(machine2, 1);
              		SetOrder(1, Launch);
              		AddOrder(machine1, newcity);
              		// AddOrder(machine2, newcity);
              	}	
              }
              This doesn't really look good, let me clean it up:

              Code:
              TypeUnit machine1;
              TypeLocation newcity;
              
              trigger 'CreateSpace/UnderseaCities' when (city.built) {
                    newcity = city.location;
                    if ( IsUnderseaCity(city) ) {
                          AddPops(city, 2);
                          CreateUnit(g.player, UnitType("UNIT_MACHINE_GUNNER"), newcity, 0, machine1);
                    }
                    if ( TerrainType(newcity) == 13 ) {
                          AddPops(city, 2);
                          CreateUnit(g.player, UnitType("GARRISON"), newcity, 0, machine1);
                          AddMovement(machine1, 1);
                          SetOrder(1, Launch);
                          AddOrder(machine1, newcity);
                    }	
              }
              I didn't knew at the time Wes wanted to add garrison units for every age, so I will have to adapt the trigger to fit each age, but that's a small thing. I tested all this and it all works fine. Thanks to your advise, Don, I can now also make the units fortify, this I couldn't do yet.

              [This message has been edited by Locutus (edited January 04, 2000).]
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #22
                Wes,

                I'm don't think it's possible to make a Great Wall wonder create city-walls, but would it be an acceptable alternative to make it create more "garrison"-units (an ancient version of it, of course), this can be done with SLIC.

                BTW I'll expand my above trigger tonight to include fortifying (just in case and to take some work out of the hands of human players) and other ages. Saves you some work (although you'll still have to make the new units yourself).

                Locutus
                [This message has been edited by Locutus (edited January 03, 2000).]
                Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                Comment


                • #23
                  Dreamer, Locutus,

                  No, I have not been working on this but I have been following the thread since I would like to see this implemented.

                  I was looking at the map code last night and thought I might be able to make the unit be built in the space city. Wrong, didn't work. (There is so much code which is not implemented). But I got to thinking it can't be that hard to make a unit launch and fortify on its own. So I did a little testing and then posted my response. (Little, try more like 6 hours worth.)

                  I knew more would have to be done, (you wouldn't want to launch a new unit for a land city for instance) but I also knew you guys had the rest of it under control.

                  Anyway, as long as we get code that works, that is what counts. I didn't mean to step on any toes, I was just trying to help.

                  Thanks for the UBB code info, I will look into that.


                  Now, for the orders info. The order.txt is incomplete and apparently wrong. I have the complete orders available and their index number. I will post it as a new thread so it doesn't get lost in this one.

                  Don
                  Don,
                  CtPMaps (Hosted by Apolyton)

                  Comment


                  • #24
                    Dreamer and Locutus, could you two get together and combine your functions, and e-mail me a script.slc containing it? I have copied and pasted these triggers as you two have posted them, but these files are so fickle, I would rather get one that you guys have tested yourselves.

                    1)I need a trigger to have sea and space cities start at size 3, and with a machine gunner. (I believe Locutus' last trigger does this.)

                    2)A trigger to have land cities start with different units depending upon the advances the civ has. (This is Dreamer's trigger.)

                    Once I have this, I should be able to insert the names of the exact units into the triggers once I decide upon that.

                    Btw, is Don right, can these units move if their movement is set to zero?

                    Also, Locutus, could you clean up those early posts of your triggers so that this thread fits the screen again?
                    [This message has been edited by WesW (edited January 03, 2000).]

                    Comment


                    • #25
                      Wes,

                      Thanks, I was wondering why this thread was so wide. It has been driving me up the wall. I can't stand it when I have to scroll sideways.

                      For the movement of zero movement units, test it yourself. Simply change one of the units to 0 movement and start a new game. When the unit is built and selected, move it. I have moved units all the way across a continent that have zero movement.

                      As long as the units are fortified when they are built, I don't think it will be a big problem. Just keep it in mind in case weird things start happening with the unit later in the game.

                      I have been running into this a lot lately. You do something which looks like it works only to find it causes problems 100 rounds later.

                      Don
                      Don,
                      CtPMaps (Hosted by Apolyton)

                      Comment


                      • #26
                        WesW,

                        I just started this SLIC scripting just 2 weeks ago, so far I only got 2 triggers and tested fully. One is posted here and the other posted in the "shared triggers" thread.

                        Currently I'm working on the following triggers, but due to the limitation of existing SLIC functions I'm stuck.

                        1) To automatically capture enemy's settler upon sighted by Slaver.
                        2) To created some guerrila units upon city capture.
                        3) Able to view on enemy's units in city without spy.

                        [This message has been edited by Dreamer (edited January 08, 2000).]

                        Comment


                        • #27
                          Hey guys,

                          Does this look better? Sorry about that.

                          Wes,

                          Damn, I just posted the complete trigger in another thread ("Settlers later on in the game"), thinking it was finished (foolish me ), after many hours of work and now you want something different than what I had in mind .
                          Oh well, I'll change it once again (don't worry, I don't hate you for it or anything ), to suit your needs. That should be really easy now, what you want is actually easier than what had in mind . Just ignore the other trigger for now, I'll update it later and send it over mail to anyone whose interested. I don't think I can send you any other triggers yet: I'm working on a lot of things at the same time, and as could be expected in such a case, very little actually works the way it should. But I'll post anything that I get to work properly on these forums and I will email that to anyone interested as well.

                          Wes/Don,

                          The problem of zero-mobility-units that can be moved can easily be solved through SLIC. It's so easy it's even described in the SLIC-documentation, sort of anyway. (Wow, that must be really easy ) Here's a trigger from the docs:

                          Code:
                          trigger 'KillAUnit' when(unit.moved && unit == myExampleUnit) {
                          
                              KillUnit(myExampleUnit);
                          
                              DisableTrigger('KillAUnit');
                          
                          }
                          With some slight adaptations it can be used to destroy any garrison-units that move. Instead of unit == myExampleUnit we can use something like unit == "MACHINE_GUNNER_GARRISON" of something like that. I'll work out the details later.

                          Dreamer,

                          If you send me what you've got on those triggers, I might be able to help you (don't count on it though, SLIC is indeed very limited when things get really interesting). I really like to see some of those happening, although I see some (or more ) problems with each of them, together we might solve those. A few short questions/remarks on your triggers:
                          1) Should be possible, but what exactly do you mean with "capture" - enslave, change of owner, what?
                          2) I see one problem: how do you know who owned a city before it was captured. If this can be solved, I think it's possible.
                          3) Don't see how that can be done, but I'm prepared to take a good look at it.

                          Can you tell me what you already have and what you think of my remarks? (either on these forums or with email or even ICQ)

                          Update: Oops, saw you posted about that guerilla-unit elsewhere, Dreamer. Just ignore my remark about that here.

                          Locutus
                          [This message has been edited by Locutus (edited January 04, 2000).]
                          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                          Comment


                          • #28
                            Locutus,

                            Pls refer to the new treads to the questions you mentioned as our topics are getting out of scope in this thread.

                            Hehe ... just noticed I got promoted to Chieftain.

                            [This message has been edited by Dreamer (edited January 05, 2000).]

                            Comment


                            • #29
                              There is no need to rush about those triggers I requested. They can wait until all the other play-balancing is done for the mod, which will probably take a few weeks, since this mod affects the Modern and post-Modern eras.

                              Comment


                              • #30
                                To all,

                                Does anyone know if how to keep those garrison-unit's out of the Great Library? I've managed to get them out of the build queue, but I don't know much about the Great Library. I've created these units in the Units.txt file and added them in gl_str.txt, and now they appear in the Great Library. It should be possible to keep them out, because the cattle-unit isn't in it while it is in the Units.txt file.

                                Locutus
                                Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                                Comment

                                Working...
                                X