Announcement

Collapse
No announcement yet.

Mod to Medieval Mod's Disseminate.slc

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

  • Mod to Medieval Mod's Disseminate.slc

    Playing CTP again with the Med mod and I have realised that the slic code that grants players a possible free advance under certain conditions often gives you one way way ahead of your tech tree ie the leader ai's highest tech

    I think it would work more fairly by simply granting you the current tech advance u are researching.

    That way it gives you the leg up u often need but at the same time doesn't give you an advance too far ahead.

    I would like to adjust this in the code and am guessing I would mainly just need the string value for what the currently researched item for the player/Ai would be called.

    anyone help?

    code attached
    Attached Files
    Last edited by Colwyn; May 13, 2006, 09:48.
    ---------------------------------------------
    Pavlov Zangalis - Hero of the capture of Berlin RFDG.
    ---------------------------------------------

  • #2
    Pls help

    Hi don't think this is a hard one for anyone thats been looking a slic code etc all i think I need is the string name for the tech advance the player/ai is currently researching.
    ---------------------------------------------
    Pavlov Zangalis - Hero of the capture of Berlin RFDG.
    ---------------------------------------------

    Comment


    • #3
      The variable you are searching for is "player.researching". Well, that's only half the truth. "player.researching" gives you a zero-based index for the advances defined in the "Advance.txt" file. If you want to display the text, there is more work to do. Suppose you want to design a scenario for a single player game that shows player one (you) what player two is researching (do NOT use this in multiplayer games, as this will definitely be considered cheating ). Then you could implement it as follows:

      Create a "scen_str.txt" file for your scenario like this:

      RESEARCH_TRACKER "Your opponent is researching [string.1.name]."
      UNKNOWN_RESEARCH "something weird"


      Your SLIC code file "scenario.slc" could look like this:

      Trigger 'TrackResearch' when (g.player == 2) {
        curResearchPlayer2 = player.researching;
      }


      Trigger 'ShowResearch' when (g.player == 1 && g.year > 0) {
        Message(1, 'Research Tracker Message');
      }


      messagebox 'Research Tracker Message' {
        MessageType("CIVILIZATION");
        strDbIndex = GetStringDBIndex(ID_UNKNOWN_RESEARCH);
        if (curResearchPlayer2 == 0) {
          strDbIndex = GetStringDBIndex(ID_ADVANCE_AGRICULTURE);
        }
        elseif (curResearchPlayer2 == 1) {
          strDbIndex = GetStringDBIndex(ID_ADVANCE_TOOLMAKING);
        }

      // Advances 2 to 95 omitted here

        elseif (curResearchPlayer2 == 96) {
          strDbIndex = GetStringDBIndex(ID_ADVANCE_LIFE_EXTENSION);
        }

      // Advances above 96 omitted here

        SetStringByDBIndex(1, strDbIndex);
        Text(ID_RESEARCH_TRACKER);
        Button(ID_BUTTON_OK) {
          Kill();
        }
      }


      Maybe you can give a more useful example. Have fun!

      Comment


      • #4
        Thks but..

        I was sorta hoping u cld look at the small file I attached above as all I want to do is mod it so rather than it currently giving the player/ai the advance that was just learned by another that is would only just give the player/ai the advance they are currently researching which will be different for all the players

        player.researching string snds like its just for the human player??? or is that for all players and aI?
        ---------------------------------------------
        Pavlov Zangalis - Hero of the capture of Berlin RFDG.
        ---------------------------------------------

        Comment


        • #5
          So you want something that works pretty much like Edisons Lab? That definitely was not the intention of whoever wrote the SLIC code you attached some posts above. The idea obviously was, that there should be a little chance every time an advance is discovered or traded (the more players already have it, the higher the chance) that the advance 'spreads' to players who don't have it.

          But ok, here is what you need:


          trigger 'MagicAdvanceGranting' when (discovery.type) {
            if (g.player != 1) {
              grantAdvForPlayer1 = 1;
            }
          }


          Trigger 'EachTimeAPlayerBeginsHisTurn' when (g.player) {
            grant = 0;
            if (g.player == 1 && grantAdvForPlayer1) { grant = 1; grantAdvForPlayer1 = 0; }
            if (g.player == 2 && grantAdvForPlayer2) { grant = 1; grantAdvForPlayer2 = 0; }
            if (g.player == 3 && grantAdvForPlayer3) { grant = 1; grantAdvForPlayer3 = 0; }
            if (g.player == 4 && grantAdvForPlayer4) { grant = 1; grantAdvForPlayer4 = 0; }
            if (g.player == 5 && grantAdvForPlayer5) { grant = 1; grantAdvForPlayer5 = 0; }
            if (g.player == 6 && grantAdvForPlayer6) { grant = 1; grantAdvForPlayer6 = 0; }
            if (g.player == 7 && grantAdvForPlayer7) { grant = 1; grantAdvForPlayer7 = 0; }
            if (g.player == 8 && grantAdvForPlayer8) { grant = 1; grantAdvForPlayer8 = 0; }
            if (grant) {
              GrantAdvance(g.player, player.researching);
              SetScience(g.player, 0);
              Message(g.player, 'You were granted an advance!');
            }
          }


          messagebox 'You were granted an advance!' {
            MessageType("CIVILIZATION");
            Button(ID_BUTTON_OK) {
              Kill();
            }
          }


          The trigger 'EachTimeAPlayerBeginsHisTurn' runs every time a player (human or AI) begins a turn. If the variable 'grantAdvForPlayern' (where n is the index of a player) is different from zero and it is the turn of player n, then n is granted the advance she/he is currently researching. The science level is reset to zero to get the same effect as with Edisons Lab. Then a message is displayed to inform the player.

          What you'll also need is some logic, that sets one of the 'grantAdvForPlayern' variables. In this example the trigger 'MagicAdvanceGranting' does this for the variable belonging to player 1 every time one of the other players finishes researching an advance (not fair, but this is only a coding example ). You can replace this with whatever trigger you like.

          Comment


          • #6
            sounding good

            Even though I prev worked in I.T I've got placenta brain at the moment and just are too sleep deprived (ie i'm a single parent with a 2 yo) to think too much and really get my head around it

            Could you mod the code for me to basically trigger the player.reseaching advance under the same circustances and possibilitity as in the original code! yes i agree The idea originally was, that there should be a little chance every time an advance is discovered or traded (the more players already have it, the higher the chance) that the advance 'spreads' to players who don't have it

            I just want the advance that is 'granted' to be the one the current player/ai is reseaching to be given not the new advance being spread


            Thanks for your help hatschy on this
            ---------------------------------------------
            Pavlov Zangalis - Hero of the capture of Berlin RFDG.
            ---------------------------------------------

            Comment


            • #7
              Ok, this one should do it. I removed all the old GrantAdvance function calls and added the mechanism I described in my last post. I played a game with a scenario consisting of that code to ensure it works, but I had to (temporarily) increase the probability for the advance granting event to see it happen. With the default factor of 6 you'll have to play a long time or you have to be really lucky to get that bonus.

              Oh, one thing to remember: The code is meant for 8 players maximum. If your scenario enables more players somehow, then you'll have to add additional code lines for player 9, player 10 and so on.
              Attached Files

              Comment


              • #8
                Works like a treat thanks

                Thank u very much this in my opinion makes CTP a very very good game
                ---------------------------------------------
                Pavlov Zangalis - Hero of the capture of Berlin RFDG.
                ---------------------------------------------

                Comment


                • #9
                  Until you get his invoice for this work

                  Trust me, I know he charges a flat rate PLUS per SLIC LINE CODE

                  PLUS a service charge if he has to go back and change anything

                  But it is well worth it in the end

                  PalPal or any direct major credit card should suffice
                  Hi, I'm RAH and I'm a Benaholic.-rah

                  Comment


                  • #10
                    Good to see you joking again!

                    Comment


                    • #11
                      Originally posted by hatschy
                      Good to see you joking again!
                      a sign Gramps is nearing being back to normal again
                      Hi, I'm RAH and I'm a Benaholic.-rah

                      Comment

                      Working...
                      X