Announcement

Collapse
No announcement yet.

Occ Mod

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

  • Occ Mod

    Theres some problems with it. I know IW isnt around and id fix the problems myself if i knew how to fix them both.

    1. You can find cities in ruins, and keep them. (easily fixed)

    2. I keep getting my second military unit disbanded for no reason, im not over unit support at all. I have one city (my capital) and it disbands my second warrior the turn after i build it... or am i missing something? Im guessing it has something to do with the disband starting 2nd settler code?

    Code:
       ////////////////////////////////////////////////////
      //      OCC code			            //
     //   By the Immortal Wombat a.k.a. Ben Weaver.    //
    ////////////////////////////////////////////////////
    
    
      //--------------------------------
     //  No settling units for player 1
    //----------------------------------
    
    int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnit) {
    	int_t	tmpUnit;
    	tmpUnit = theUnit;
    
    	if(tmpUnit == UnitDB(UNIT_SETTLER) || tmpUnit == UnitDB(UNIT_URBAN_PLANNER) || tmpUnit == UnitDB(UNIT_SEA_ENGINEER)){
    		if(IsHumanPlayer(theCity.owner)){
    			return 0;
    		} else {
    			return 1;
    		}
    	}
    	 else {
    		return 1;
    	}
    }
    
       //----------------
      // Make it impossible to win by alliances
     //    and do start scenario stuff
    //------------------
    
    HandleEvent(BeginTurn) 'StartScen' pre {
    	if(IsPlayerAlive(1)) {				
    		ChangeGlobalRegard(1, -1000, ID_HATE, 200);
    	}
    	message(1, 'startscenariomessage');
    	DisableTrigger('StartScen');
    }
    
    messagebox 'startscenariomessage' {
    	Show();
    	Title(ID_BEGIN_TITLE);
    	Text(ID_BEGIN);
    }
    
    
      //--------------
     //  Can't Capture Cities
    //----------------
    
    
    HandleEvent(CaptureCity) 'destroy' post {
    	if(player[0] == 1){
    		Event: KillCity(city[0], 0, 0);
    	}
    }
    
    
      //---------------------------
     //  Can't incite revolutions
    //-----------------------------
    
    HandleEvent(InciteRevolutionUnit) 'Spies' pre {
    	if(unit[0].owner == 1){
    		return STOP;
    	}
    }
    
      //----------------------------
     //    Cant Take Gift Cities
    //------------------------------
    
    HandleEvent(GiveCity) 'Nononocheating' pre {
    	if(player[0] == 1){
    		return STOP;
    	}
    }
    
      //-------------------------------------
     //    Destroy second settler on startup
    //---------------------------------------
    
    HandleEvent(BeginTurn) 'destroy_settler' pre {
    	unit_t	tmpUnit;
    	if(IsHumanPlayer(player[0]) && player[0].units == 2){
    		GetUnitByIndex(player[0], 1, tmpUnit);
    		KillUnit(tmpUnit);
    	}
    }
    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
    CtP2 AE Wiki & Modding Reference
    One way to compile the CtP2 Source Code.

  • #2
    Im guessing it has something to do with the disband starting 2nd settler code?
    You're right; you only want to do this once:

    Code:
      //-------------------------------------
     //    Destroy second settler on startup
    //---------------------------------------
    
    HandleEvent(BeginTurn) 'destroy_settler' pre {
    	unit_t	tmpUnit;
    	if(IsHumanPlayer(player[0]) && player[0].units == 2){
    		GetUnitByIndex(player[0], 1, tmpUnit);
    		KillUnit(tmpUnit);
    		DisableTrigger('destroy_settler');
    	}
    }

    Comment


    • #3
      Now its killing my 2nd warrior produced, but none after that...
      Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
      CtP2 AE Wiki & Modding Reference
      One way to compile the CtP2 Source Code.

      Comment


      • #4
        Might have to do with the fact that you don't always get a 2nd settler.

        Either way, since it should only work in the starting turn, an extra check "g.year == 0" in the if statement should solve the problem.

        Code:
          //-------------------------------------
         //    Destroy second settler on startup
        //---------------------------------------
        
        HandleEvent(BeginTurn) 'destroy_settler' pre {
        	unit_t	tmpUnit;
        	if (IsHumanPlayer(player[0]) && player[0].units == 2 && g.year == 0) {
        		GetUnitByIndex(player[0], 1, tmpUnit);
        		KillUnit(tmpUnit);
        		DisableTrigger('destroy_settler');
        	}
        }
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #5
          Yep, thats done it thanks.

          Heres the updated mod zip.

          1. Fixed disband problem as above.
          2. No settlers from huts.
          3. No cities from huts.
          4. Minimum Gaia Controller Cores reduced to 1, so science end game is possible.

          I suppose for 2 and 3 you could write code to only exclude them for the human, but frankly cities from huts do the AI more harm than good and settlers from huts isnt a great loss to the AI seeing as it doesnt tip huts much.

          I havent played it to the end yet (no surprises) so there may be other bugs yet.
          Attached Files
          Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
          CtP2 AE Wiki & Modding Reference
          One way to compile the CtP2 Source Code.

          Comment


          • #6
            Hm, sorry guys. I dunno how I missed the second unit thing in testing. Shoulda set the check to look for settlers rather than units. It was a long time ago
            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


            • #7


              Wombat sighting!
              'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

              Bush's Republican=Neo-con for all intent and purpose. be afraid.

              Comment

              Working...
              X