Results 1 to 26 of 26

Thread: I've got a few q's about modding

  1. #1
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19

    I've got a few q's about modding

    1. Is it possible to change the tile improvement thing, to be cheaper when upgrading an improvement? I mean, when having a mine, but you want to upgrade the mine to an advanced mine instead. But because it's upgrading, the price should be slightly lower than the original price (Like having a 25% price cut...) Of course, if the tile is empty (Or has something else, than a mine), the price should be normal...

    2. Is it possible to change how slow/fast the time goes by?
    This space is empty... or is it?

  2. #2
    Dale
    Emperor Dale's Avatar
    Join Date
    27 Dec 2000
    Posts
    3,962
    Country
    This is Dale's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 20, 2013
    Local Time
    06:19
    2. Change all the TIME_SCALE values in DiffDB.txt for each difficulty level.

  3. #3
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Thx
    This space is empty... or is it?

  4. #4
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    DP. and if you copied the code that was in here try the next post one
    Last edited by Pedrunn; September 13, 2002 at 08:37.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  5. #5
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    1) You can add PW to the player who isto simulate the bonus. Here is a code that adds 50 PW to the player if his is building advanced mine over mine and 25 if building a advanced farm over a farm. the temolate for new imrprovent is written there ( // means comment and do not make part of the code
    Code:
    HandleEvent(CreateImprovement) 'PWBonunWhenBuildingOneSameType' pre {
    int_t i;
    int_t InitialPw
    int_t FinalPW;
    int_t OLD_TILEIMP[];
    int_t NEW_TILEIMP[];
    int_t PW_BONUS[];
    
    OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINE); 
    NEW_TILEIMP[0] =  TerrainImprovementDB(TILEIMP_ADVANCED_MINE);
    PW_BONUS[0] = 50;
    
    OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_FARM); 
    NEW_TILEIMP[1] =  TerrainImprovementDB(TILEIMP_ADVANCED_FARM);
    PW_BONUS[1] = 30;
    
    // TEMPLATE obs: * need to be filled
    
    //OLD_TILEIMP[*] = TerrainImprovementDB(TILEIMP_*); 
    //NEW_TILEIMP[*] =  TerrainImprovementDB(TILEIMP_*);
    //PW_BONUS[*] = *;
    
    	for(i = 0; i < OLD_TILEIMP.#; i = i + 1) {			// Search for all numbers
    		if(TileHasImprovement(location[0], OLD_TILEIMP[i]) {	// if tile has tile imp in the data 
    			if(value[0] == NEW_TILEIMP[i]) {		// and new improvement has the same number	
    				InitialPw = player[0].publicworkslevel;	// Search for previous amout of PW
    				FinalPW = InitialPw + PW_BONUS[i];		// Give a 50 PW bonus
    				setPW(player[0], FinalPW);		// and set the new player's PW amount
    			}
    		}
    	}
    }
    Obs: UNTESTED, UNTRIED and MAY GIVE SLIC SYNTAX ERRORS.
    any question i am here.

    Copy this code in any included .slc of the folder \default\gamedata\ I recommend the script.slc wich is included for sure for the original game (The included files are in the end of this file and you can include new one you created by writting the line:
    Code:
    #include "AnyFile.slc"
    This means the AnyFile.slc is included. if this file doesnt exist you get slic errors.

    2) The building time is in the TI data in the tileimp.txt just change for the improvement you want the value of its entry:
    Code:
    ProdutionTime
    and there you go

    PS: did you fixed the errors you were getting from your last modding attept?
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  6. #6
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Thx for the help... and yes, I got the last error fixed (I haven't finished my first game yet, so I can't be sure, but I haven't had any problem yet...)

    I now get an slic error when starting the game...
    Last edited by Adagio; September 13, 2002 at 10:18.
    This space is empty... or is it?

  7. #7
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    But you still get errors when loading CTP2?
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  8. #8
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    I only get the new slic error... The other error got fixed

    OLD_TILEIMP[0]
    NEW_TILEIMP[0]
    PW_BONUS[0]

    OLD_TILEIMP[1]
    NEW_TILEIMP[1]
    What does the number in [] mean? this might be what causes the error...
    This space is empty... or is it?

  9. #9
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Hmmm... how come it says, Pedrunn was the last one to reply... even after tons of refreshing of the browser..?
    This space is empty... or is it?

  10. #10
    mapfi
    Prince
    Join Date
    30 Jul 2002
    Location
    San Francisco, CA
    Posts
    857
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    20:19
    Those are arrays Pedrunn uses - when you define a variabel like the following int_t number[]; you'll have a dynamically growing array. Now if you want to write an integer into that array you have to say which index it shall have. They start at 0.
    If you want to get into SLICing start reading Locutus' and IW's documentations, mavbe even the activision one...

  11. #11
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Ok, let's see if I understud it. If I make more of those in Pedrunns example, I have to do like this: (?)

    OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINE);
    NEW_TILEIMP[0] = TerrainImprovementDB(TILEIMP_ADVANCED_MINE);
    PW_BONUS[0] = 50;

    OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_FARM);
    NEW_TILEIMP[1] = TerrainImprovementDB(TILEIMP_ADVANCED_FARM);
    PW_BONUS[1] = 30;

    OLD_TILEIMP[2] = TerrainImprovementDB(TILEIMP_FARM);
    NEW_TILEIMP[2] = TerrainImprovementDB(TILEIMP_Hydronic_FARM);
    PW_BONUS[2] = 30;
    Ok, I didn't check if I spelled right... But is it something like that?
    This space is empty... or is it?

  12. #12
    mapfi
    Prince
    Join Date
    30 Jul 2002
    Location
    San Francisco, CA
    Posts
    857
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    20:19
    That's what you want, yes.

  13. #13
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Ok, thx for the help
    This space is empty... or is it?

  14. #14
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    DP
    Last edited by Pedrunn; September 13, 2002 at 14:28.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  15. #15
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    There are actually three errors:
    1) A missing ';' after
    Code:
    int_t InitialPw
    2) A missing ')' ater the line (you can see that i open two '(' but i dont get one of them closed
    Code:
    if(TileHasImprovement(location[0], OLD_TILEIMP[i]) {
    3) The names of the improvements. In the tileimp.txt you will find that they are in plural not in singular form as i wrote.


    The number is just something to relate the OLD_TILEIMP[] with the NEW_TILEIMP[] and the PW_BONUS[]. Since the code works like that. (A slic lesson here).
    Try this code it is esier to understand and has new improvements:
    Code:
    HandleEvent(CreateImprovement) 'PWBonunWhenBuildingOneSameType' pre {
    int_t i;
    int_t InitialPw;
    int_t FinalPW;
    int_t OLD_TILEIMP[];
    int_t NEW_TILEIMP[];
    int_t PW_BONUS[];
    
    OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINES); 
    NEW_TILEIMP[0] =  TerrainImprovementDB(TILEIMP_ADVANCED_MINES);
    PW_BONUS[0] = 30;
    
    OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_ADVANCED_MINES); 
    NEW_TILEIMP[1] =  TerrainImprovementDB(TILEIMP_MEGA_MINES);
    PW_BONUS[1] = 50;
    
    OLD_TILEIMP[2] = TerrainImprovementDB(TILEIMP_FARMS); 
    NEW_TILEIMP[2] =  TerrainImprovementDB(TILEIMP_ADVANCED_FARMS);
    PW_BONUS[2] = 40;
    
    OLD_TILEIMP[3] = TerrainImprovementDB(TILEIMP_ADVANCED_FARMS); 
    NEW_TILEIMP[3] =  TerrainImprovementDB(TILEIMP_MEGA_FARMS);
    PW_BONUS[3] = 60;
    
    // TEMPLATE obs: * need to be filled
    
    //OLD_TILEIMP[*] = TerrainImprovementDB(TILEIMP_*); 
    //NEW_TILEIMP[*] =  TerrainImprovementDB(TILEIMP_*);
    //PW_BONUS[*] = *;
    
    	i = 0;								// 'i' is zero for the last loop
    	while(i < OLD_TILEIMP.#) {					// if 'i' is smaller then the biggest number inside OLD_TILEIMP[]
    		if(TileHasImprovement(location[0], OLD_TILEIMP[i])) {	// if tile has tile imp equal to OLD_TILEIMP[i] 
    			if(value[0] == NEW_TILEIMP[i]) {		// if new improvement has the same number	
    				InitialPw = player[0].publicworkslevel;	// Search for previous amout of PW
    				FinalPW = InitialPw + PW_BONUS[i];		// Give a 50 PW bonus
    				setPW(player[0], FinalPW);		// and set the new player's PW amount
    			}
    		}
    		i = i + 1;
    	}
    }
    Last edited by Pedrunn; September 14, 2002 at 08:21.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  16. #16
    Martin Gühmann
    Administrator Martin Gühmann's Avatar
    Join Date
    02 Mar 2001
    Location
    Tübingen, Germany
    Posts
    7,248
    Country
    This is Martin Gühmann's Country Flag
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19

    Post

    Originally posted by ADG
    Ok, I didn't check if I spelled right... But is it something like that?
    Just use copy (mark a line and press Ctrl and c on the same time), then go to the target document and press Ctrl + v.

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

  17. #17
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Originally posted by Martin Gühmann
    Just use copy (mark a line and press Ctrl and c on the same time), then go to the target document and press Ctrl + v.

    -Martin
    Yeah, I know, but I was just too tired at that moment to open all the documents again, and try to fix around with them... but thx anyway
    This space is empty... or is it?

  18. #18
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    It says there's a syntax error on this line:

    Code:
    if(TileHasImprovement(location[0], OLD_TILEIMP[i])) {
    This space is empty... or is it?

  19. #19
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    That is why i hate slic. one small typo and frustation comes to you.
    It is a missing '{' in the line before. I edited the code from its post it should work now.
    Sorry.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  20. #20
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Ok, thx, it works now (Well...it starts without complaining, haven't tested if the code works

    Can't wait til the day, were I might be able to see what the errors mean (Just started learning java last week, so there's still a long way )...
    This space is empty... or is it?

  21. #21
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    I just loaded a savegame to test if it works, but I don't get the bonus...
    This space is empty... or is it?

  22. #22
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Originally posted by ADG
    I just loaded a savegame to test if it works, but I don't get the bonus...
    EDIT: Woops, I ment to edit instead of reply...

    Is it because in this line, you sets the number of the player. Shouldn't it be something like the i in PW_BONUS[i]? Otherwise the player who gets the bonus is always the same player... or am I mistaking here?

    Code:
    setPW(player[0], FinalPW);
    This space is empty... or is it?

  23. #23
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    When you load a saved game. the slic codes are the same as the ones you saved. So my slic code is not part of.
    To tell the PC that you have a new code in your game data you must press ' and the chatbox will open.
    Then type
    Code:
    /reloadslic
    And press enter. The game will search for new codes and changes in the code in your game data.
    New games dont need this procedure.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  24. #24
    Adagio
    Deity Adagio's Avatar
    Join Date
    29 Jun 2001
    Posts
    11,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19
    Ah, ok, thx for the help, it now works fine, now I only need to finish the code, so it works for the other TI's too
    This space is empty... or is it?

  25. #25
    Martin Gühmann
    Administrator Martin Gühmann's Avatar
    Join Date
    02 Mar 2001
    Location
    Tübingen, Germany
    Posts
    7,248
    Country
    This is Martin Gühmann's Country Flag
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Local Date
    June 19, 2013
    Local Time
    21:19

    Post

    Originally posted by ADG
    I just loaded a savegame to test if it works, but I don't get the bonus...
    You just loaded a save game? In that case this is to less. You have also to reloadslic to do it just open the chat window by typing the apostrophe key (') and enter /reloadslic. Alternatively you can also open the cheat editor and press the reloadslic button. BTW the cheat editor is a great tool to test such code, but don't expect if you place a tile improvement with the cheat that you get the bonus you have to do it regulary. But you can first place a tile improvement and then close the cheat editor and place then the upgrate improvement.

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

  26. #26
    Pedrunn
    King Pedrunn's Avatar
    Join Date
    06 Jul 2001
    Location
    of Natal, Brazil
    Posts
    2,555
    Country
    This is Pedrunn's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    June 19, 2013
    Local Time
    16:19
    Originally posted by ADG

    Is it because in this line, you sets the number of the player. Shouldn't it be something like the i in PW_BONUS[i]? Otherwise the player who gets the bonus is always the same player... or am I mistaking here?

    Code:
    setPW(player[0], FinalPW);
    Hey you are already commenting codes. Big step in slic learning.
    Let me aswer you:
    Check this part:
    Code:
    InitialPw = player[0].publicworkslevel;	
    FinalPW = InitialPw + PW_BONUS[i];		
    SetPW(player[0], FinalPW);
    The SetPW(int_t, int_t) function works not adding the value of the second argument (int_t) to the player PW amount but replacing.
    So in this piece of code:
    line1: i get the player PW (InitialPW)
    line2: make a new value(FinalPW) adding to the InitialPW value the PW_BONUS[i]
    line3: Change the PW reserve of the player[0] to be equal to FinalPW

    Remember: the TI entry names can be foun in the tileimp.txt

    PS: I learnt slic in less than two days reading the info in this thread and locutus slic manual:
    http://apolyton.net/forums/showthrea...threadid=33181

    Of course. Make codes that actually worked took me a little while

    EDIT: I never had experience in any coding language. Slic was the first.
    Last edited by Pedrunn; September 14, 2002 at 09:33.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

Similar Threads

  1. Civ IV Modding... DOA?
    By Zen in forum Civilization IV Creation
    Replies: 15
    Last Post: February 12, 2007, 08:29
  2. Modding/TC
    By fruitfly in forum Alpha Centauri
    Replies: 5
    Last Post: October 19, 2006, 21:58
  3. Help Modding a Map
    By Patine in forum Civilization I and Civilization II
    Replies: 6
    Last Post: July 21, 2006, 13:36
  4. Help with modding
    By Fenix Night in forum Master of Orion
    Replies: 3
    Last Post: March 22, 2003, 01:12
  5. Is modding enough?
    By Dinner in forum CtP2-General/Help/Strategy/Multiplaying-Archive
    Replies: 4
    Last Post: April 23, 2002, 06:38

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!

Bookmarks

Posting Permissions