Announcement

Collapse
No announcement yet.

Mod Idea

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

  • #46
    Made some progress.

    CreateWonder will create a wonder even without the enable advance.
    CreateWonder will not work in a city if it was built on that turn (I should have realised this as CreateBuilding did not work in the same circumstances).
    CreateWonder allows you to create the same wonder for more than one person.
    Wonders over number 64 do not extend an effect. They show up in rankings/wonder but have no home city and extend no effect.
    Code:
    	if(IsHumanPlayer(player[0])) {
    		
    	CTC_PLAYER_COUNT= preference("NumPlayers");
     	for (i=0; i <= CTC_PLAYER_COUNT; i = i + 1){
     	if (IsPlayerAlive(i)){ 
    		tmpPlayer = i;
    		 if (PlayerCivilization(i)==CivilizationIndex("ROMAN")){
     		for(j = 0; j < PlayerCityCount(tmpPlayer); j = j + 1){ 
    		GetCitybyIndex(tmpPlayer,j, tmpCity);
     			if(CityHasBuilding(tmpCity,"IMPROVE_CAPITOL")){
    			 Event:CreateWonder(tmpCity, WonderDB(WONDER_COMMERCE_A ));
    				}
     			}
     		} elseif (PlayerCivilization(i)==CivilizationIndex("JAPANESE")){
     		for(j = 0; j < PlayerCityCount(tmpPlayer); j = j + 1){ 
    		GetCitybyIndex(tmpPlayer,j, tmpCity); 
    			if(CityHasBuilding(tmpCity,"IMPROVE_CAPITOL")){ 
    			Event:CreateWonder(tmpCity, WonderDB(WONDER_COMMERCE_A )); 
    							}
    						}
    				 	} 
    				}
    			 } 
    		}
    	 }
    This code works except, both wonders appear as Rome home city, but one is player Roman and the other Japanese. However, they each only get the effect once, so even though Rome is shown as home city for both, the Romans and the Japanese get the benefit once each (in this case +100 boat movement). I cant see why they both end up as home city ROME.
    Code:
    if (AOM_TRAITS_GIVEN[tmpPlayer] == 0) 
    ................................................................
    AOM_TRAITS_GIVEN[tmpPlayer] = 1;
    If I changed the above 2 lines from Locutus' last example to
    Code:
    if (AOM_TRAITS_GIVEN[tmpPlayer] == 1) 
    ................................
    AOM_TRAITS_GIVEN[tmpPlayer] = AOM_TRAITS_GIVEN[tmpPlayer] +1;
    Would this mean it fires on the building of the second city for a player? Meaning I simply use the getcitybyindex/has building capital bits to place the wonder in city 1.

    Comment


    • #47
      A curious development. I have checked it twice with different games and the outcome was the same.

      1) Wonders created using CreateWonder extend their effect in the normal way.
      2) Wonders created using CreateWonder do not appear to extend their effect to a new owner.

      This is the weird bit.

      I checked number (2 twice in different games. Set up a game with 2 players that would get the civtrait wonder on turn 5. In each case it was the Commerce one which allowed +100 boat movement so its easy to check. Each player got the increased movement after their wonder was created. I then capture the home city of the other player. The City name changed colour to blue in the wonder list, the wonder appeared in the inventory of the captured enemy capital, but the benefit did not extend to me as the conquering player. That is, my coracle still only moved 300, not 400, an extra 100 for the second civtrait wonder I acquired.

      As a further check, I waited several turns, I then let the other play rush buy Lighthouse of Alex, then capture it off them. Hey presto, my coracle now moves 4. 2 plus 1 for my civtrait wonder and 1 for the Lighthouse.

      So a wonder created by CreateWonder appears to be non transferrable, maybe something to do with the wrong city appearing in the wonder list.

      So therefore, at this satge I do not need a code to get rid of the wonder out of a newly captured enemy capital.

      Weird but handy in this case.

      Comment


      • #48
        Originally posted by stankarp
        Code:
        if (AOM_TRAITS_GIVEN[tmpPlayer] == 0) 
        ................................................................
        AOM_TRAITS_GIVEN[tmpPlayer] = 1;
        If I changed the above 2 lines from Locutus' last example to
        Code:
        if (AOM_TRAITS_GIVEN[tmpPlayer] == 1) 
        ................................
        AOM_TRAITS_GIVEN[tmpPlayer] = AOM_TRAITS_GIVEN[tmpPlayer] +1;
        Would this mean it fires on the building of the second city for a player? Meaning I simply use the getcitybyindex/has building capital bits to place the wonder in city 1.
        That would only work if you move the line

        AOM_TRAITS_GIVEN[tmpPlayer] = AOM_TRAITS_GIVEN[tmpPlayer] +1;

        outside the 'outer' if-statement. After all, as you're proposing it, that line is only run if AOM_TRAITS_GIVEN is 1 and it can only become 1 if the code is run. Catch22
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #49
          Its a bit a pity but I have run into a snag with the CreateWonder Code. Initially it was working, now I get a CTD on the turn the wonders appear. It appears to be crashing when the message about the wonder appears, because if I reload autosave, the wonders are there and I can continue the game. Bit weird.

          I thought I had made an error in wonders.txt but I went back to an old copy and tried to create an existing wonder(Stonehenge), and it still crashes. Tried it just creating one wonder with the humanplayer and it still crashes. It is as if the game had just decided to crash when I use the CreateWonder code. I even loaded an older copy of the game which had never seen the CreateWonder code in a slic file and it still does it.

          So I am out of ideas.

          Hex suggested trying a feat for each player with a fixed time limit. However, I cannot find a code to give a player a feat. I tried AccomplishFeat, tmpPlayer,Feat(name) but nothing happened and if I reversed it as per the slic mod list (AccomplishFeat(int_t,t)), I got a syntax error.

          Has anyone used a code to give a feat?

          Thanks.

          Comment


          • #50
            That should have been AccomplishFeat(int_t,), stupid bandaged thumb:-)))

            Comment


            • #51
              Argh!!!

              HTML tages dont appear, so take it the AccomplishFeat bit is correct.

              Comment


              • #52
                OK, managed to find the syntax error, now have the feat working. Now to see how far I can push feats.

                Comment

                Working...
                X