Announcement

Collapse
No announcement yet.

D'oh questions

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

  • D'oh questions

    This is my first time writing SLIC so bear with me and my silly questions .

    Q1
    How to add building(s) to a newly founded city? I thought Dale's WAW mod hase this feature, so I browse through the files but so far no luck. Probably I miss it somewhere.

    Anyway, I tried to write my own SLIC (no pain no gain), and it didn't work (the pain).

    Code:
    HandleEvent(CreateCity) 'The_Doh_Function' post {
    int_t		thePlayer;
    location_t	theLocation;
    city_t		theCity;
    
    	thePlayer = player[0];		// <= do I really need this?
    	theLocation = location[0];	//	and this?
    	theCity = city[0];
    
    	Event:CreateBuilding(theCity, BuildingDB(IMPROVE_SHRINE));
    }
    Q2
    The GrantAdvance() event has 3 arguments: GrantAdvance(player, int1, int2), right?. Which int argument is the advance? I wrote "GrantAdvance(player,AdvanceDB(SomeAdvance),0)" and it worked. Can I always leave the third argument or does it do anything?

  • #2
    A1: Take a look into the unit.txt and search the for the the entry of the urban planer. You will notice that this unit has a list of SettleBuilding entries. So whenever an urban planer builds a city (also in the original game) than the specified buildings are added to the city. So actual no slic is here required. But one thing you have to consider is that if you get a city from a ruin than you won't get the extra buildings. For the original game it doesn't matter, because all ruins should be opened in the modern age already. BTW also the starting size of this city is dertermined in this unit entry.

    A2: Actual I don't know, but I guess the first one is the advance and the second one might be the reason of giving the advance. You have to note there is an event called GrantAdvance and a function called GrantAdvance. From the official Activion slic documentation the event has tree arguments and the function has two. BTW did you really wrote:

    "GrantAdvance(player,AdvanceDB(SomeAdvance),0)"

    Or rather:

    "Event:GrantAdvance(player,AdvanceDB(SomeAdvance),0 )"

    If you used the first from then you called the function, if you used the second form then the event. It is interesting if you used the first form, because that would mean the GrandAdvance function has an undocumented optional third argument.

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

    Comment


    • #3
      Well will not give you Slic tips since i am just too green too.

      But as a modder the best is to add this line in the settler data in the unit.txt.
      Code:
         SettleBuilding IMPROVE_SHRINE
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #4
        You beat me for some minutes.
        But now is my time to ak
        How many reasons there are?
        What they are?
        And their respective numbers?
        "Kill a man and you are a murder.
        Kill thousands and you are a conquer.
        Kill all and you are a God!"
        -Jean Rostand

        Comment


        • #5
          Originally posted by Pedrunn
          You beat me for some minutes.
          But now is my time to ak
          How many reasons there are?
          What they are?
          And their respective numbers?
          Hey stop I just guessed.

          What are the possible reasons or better conditions to give a civ an advance.

          The first one is the common one: You got enough science points to pay the advance with it so you gain it.

          Another possibility to gain an advance is to enter a goody hut.

          Next one is stealing it with a spy.

          Then you can gain an advance during diplomacy negotiations.

          And you can steal an advance if you conquered an city. (I think this is broken in CTP2 )

          So that are five conditions to give an advance to an civ. Of course there is also the possebility to give it vea slic.

          I can't you tell anything about the numbers, Presuming the third argument contains something usefull. In most cases these last arguments, especial these undocumented ones, do nothing. And if the third argument would be a reason to give the advance than it would doesn't matter if you use any number, because in the end it doesn't matter how the civ gained the advance, it only matters that the civ gained the advance.

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

          Comment


          • #6
            Originally posted by Martin Gühmann
            Hey stop I just guessed.
            (I hope )

            There is also a reason in AddHappyTime and other slic functions. I thought there could exist some sort of known general list of reasons to use in slic.
            "Kill a man and you are a murder.
            Kill thousands and you are a conquer.
            Kill all and you are a God!"
            -Jean Rostand

            Comment


            • #7
              A1. You don't need the lines you questioned

              And you can steal an advance if you conquered an city.
              It is possible to SLIC this, and I was considering it for a while. But because HasAdvance(...) has to use the advance name (as in ID_ADVANCE_...) then it makes it hugely long code to write, and my patience is not that generous...
              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
                aahhhh

                So, that's the way Thanks a lot guys.

                Martin Gühmann,
                This is the way wrote it: Event:GrantAdvance(thePlayer, AdvanceDB(ADVANCE_STONE_WORKING), 0);
                I'll try the non-event function now, just to see what's the difference.

                Hmm gain an advance when conquering a city. Interesting. Can't we just use integers instead of those constant strings? I mean AdvanceDB is just to convert strings (ADVANCE_SOMETHING) into its integer index (some number), isn't it. I thought it's just to make it easier to read (and write) the SLIC. But we don't really need to know the exact advance, we just want a random advance the enemy has that we don't.

                First Draft:
                Code:
                HandleEvent(CaptureCity) post {
                int_t	currentPlayer;
                int_t	losingPlayer;
                int_t	theAdv;
                	currentPlayer = g.player;
                	losingPlayer = player[0];	// <= Q: refer to which player?
                
                	for (theAdv = 0; theAdv < advance.#; theAdvance = theAdvance + 1) {
                		if ((HasAdvance(losingPlayer,theAdv) && (!HasAdvance(currentPlayer,theAdv))) {
                			GrantAdvance(currentPlayer,theAdv);
                			// Next to do: MSG>"Your scientists managed to salvaged some interesting
                			//	research data after the occupation of the city, advance[theAdv].name".
                		}
                	}
                }
                If we want a random one, we can always create a list of those qualifying advances (ones they have that we don't) and randomly select one from it.

                Anyway, I haven't test the code, so don't sue me .

                Q: Which player does player[0] refer to? The previous owner of the city OR the conquerer?

                Edit: If player[0] refers to current player too, then can we try handling AttackCity event (or some other relevant events) to extract the previous owner?
                Last edited by azalae; June 4, 2002, 22:46.

                Comment


                • #9
                  theAdv cannot be an integer, it doesn't work, otherwise it would be that simple. theAdv does have to be a string in the HasAdvance function.
                  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


                  • #10
                    D'oh

                    Comment


                    • #11
                      Originally posted by Immortal Wombat
                      theAdv does have to be a string in the HasAdvance function.
                      But that's only in the HasAdvance function, right? Not in any of the places where you use AdvanceDB.

                      Comment


                      • #12
                        Q: Which player does player[0] refer to? The previous owner of the city OR the conquerer?
                        player[0] is the player who captures the city. If you run the handler pre- before the in-game code that captures the city - you can get the player who's about to lose the city with city[0].owner. In a post CaptureCity handler, player[0] is city[0].owner.

                        Comment


                        • #13
                          Only in HasAdvance is it neccessary, correct. It might not even work in the other functions, which need the DB index as an integer
                          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

                          Working...
                          X