Announcement

Collapse
No announcement yet.

[CREATION] Help Needed on a couple SLIC Scripts for Grandpa Troll

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

  • [CREATION] Help Needed on a couple SLIC Scripts for Grandpa Troll

    I would be very grateful and offer a map exchange if anyone could write this up for me:

    1) Is it possible to say have a random event, say every "X" turns where you would get either a lump sum gold or more preferably "X" gold per city as in say you have 38 Cities and got maybe 3 gold for eaach city or even say for any cities above size 10 you get 10 gold.

    On the reverse you could have a random event penalizing cities above size 10 say 5 gold, call it riot damage or something opposite of the celebration your get sometimes.

    2) Seaport cities, say every 12 turns spawn best Naval Attack Vessel available

    I need to check but I do believe I have one from years ago that gave me a specific unit every so many turns, but all that medication last three years has fogged my memory up, sorry

    By the way, this is strictly for me, single player, not PBEM

    Thanks in advance!

    Gramps
    Hi, I'm RAH and I'm a Benaholic.-rah

  • #2
    Both of those are doable I believe.
    "

    Comment


    • #3
      Do you want the AI to get the goodies too?
      "

      Comment


      • #4
        Here's the 1st one. I made it so it gives or takes away 1 pw and 1 gold per population. There's a 10% chance the good event will occur and a 5% the bad event will occur. Add it to scenario.slc in \Civilization-Call To Power\ctp_data\default\gamedata\.

        Spoiler:
        Code:
        trigger 'GoldPWevent' when (g.player) {
        	cityPop = 0;
        	aCity = 0;
        	if(Random(100) < 10) {
        		//Loops through Cities and gets total population of civ
        		while(aCity < Cities(g.player)) {
        			SetCityByIndex(1, g.player, aCity);			
        			cityPop = cityPop + city.population;
        			aCity = aCity + 1;
        		}
        	//Gives player 1 gold and 1 pw per pop	
        	AddGold(g.player, cityPop);
        	SetPW(g.player, player.publicworkslevel + cityPop);
        	} elseif(Random(100) > 94) {
        		//Loops through Cities and gets total population of civ
        		while(aCity < Cities(g.player)) {
        			SetCityByIndex(1, g.player, aCity);			
        			cityPop = cityPop + city.population;
        			aCity = aCity + 1;
        		}
        	//Subtracts player 1 gold and 1 pw per pop	
        	AddGold(g.player, -cityPop);
        	SetPW(g.player, player.publicworkslevel - cityPop);
        	}
        }


        Your second request is a much more time consuming one. I won't do it myself but i'll help you write it if you are still interested.
        "

        Comment


        • #5
          Originally posted by EPW View Post
          Here's the 1st one. I made it so it gives or takes away 1 pw and 1 gold per population. There's a 10% chance the good event will occur and a 5% the bad event will occur. Add it to scenario.slc in \Civilization-Call To Power\ctp_data\default\gamedata\.

          Spoiler:
          Code:
          trigger 'GoldPWevent' when (g.player) {
          	cityPop = 0;
          	aCity = 0;
          	if(Random(100) < 10) {
          		//Loops through Cities and gets total population of civ
          		while(aCity < Cities(g.player)) {
          			SetCityByIndex(1, g.player, aCity);			
          			cityPop = cityPop + city.population;
          			aCity = aCity + 1;
          		}
          	//Gives player 1 gold and 1 pw per pop	
          	AddGold(g.player, cityPop);
          	SetPW(g.player, player.publicworkslevel + cityPop);
          	} elseif(Random(100) > 94) {
          		//Loops through Cities and gets total population of civ
          		while(aCity < Cities(g.player)) {
          			SetCityByIndex(1, g.player, aCity);			
          			cityPop = cityPop + city.population;
          			aCity = aCity + 1;
          		}
          	//Subtracts player 1 gold and 1 pw per pop	
          	AddGold(g.player, -cityPop);
          	SetPW(g.player, player.publicworkslevel - cityPop);
          	}
          }


          Your second request is a much more time consuming one. I won't do it myself but i'll help you write it if you are still interested.

          Thanks so much EPW

          I tweak codes and such and give full credit to authors, but writing code is something I have not done though!

          I thank you for this, I will add it for a single players scenario in future!

          On this the 10 number could be changed by me as well as the amount of gold and pw, but the negative..I see a "94", so that number is 100-5 (95?) so how did the number 94 come to be?

          Thanks so much my friend!

          Grandpa Troll
          Hi, I'm RAH and I'm a Benaholic.-rah

          Comment


          • #6
            Random(100) returns a random number between 0-99 rather than 1-100. So Random(100) > 94 means 95,96,97,98,99 will cause it to trigger. Thats 5 numbers out of 100, or 5%.


            This effects the computer too, change g.player to IsHumanPlayer(g.player) to only effect the human.
            Last edited by EPW; March 2, 2009, 13:47.
            "

            Comment


            • #7
              Originally posted by EPW View Post
              Random(100) returns a random number between 0-99 rather than 1-100. So Random(100) > 94 means 95,96,97,98,99 will cause it to trigger. Thats 5 numbers out of 100, or 5%.


              This effects the computer too, change g.player to IsHumanPlayer(g.player) to only effect the human.
              Thanks

              I shall add this to my collection of SLIC Codes for future reference and selection choices!


              I do appreciate your provision of these codes, they mean a lot, helps me continue to get additional replay value out of an already awesome game!!!
              Hi, I'm RAH and I'm a Benaholic.-rah

              Comment


              • #8
                Chad, check here for some SLIC for your enjoyment!

                Bumping for Chad...........................
                Hi, I'm RAH and I'm a Benaholic.-rah

                Comment

                Working...
                X