Announcement

Collapse
No announcement yet.

PBEM code with Goodmod

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

  • PBEM code with Goodmod

    Code:
    HandleEvent(BeginTurn) 'LITE_StartUp' post {
    location_t startLocation;
    unit_t	startUnit;
    unit_t	tmpUnit;
    int_t	i;
    int_t	PBEMPlayer;
    	for(PBEMPlayer = 1; PBEMPlayer < 33; PBEMPlayer = PBEMPlayer + 1) {
    		if(IsPlayerAlive(PBEMPlayer)) {
    			// movement bonus for first turn
    			GetUnitByIndex(PBEMPlayer, 0, startUnit);
    			AddMovement(startUnit, 900);	
    			startLocation = startUnit.location;
    				
    			// free units
    	
    			for (i = 0; i < 2; i = i + 1) {
    				CreateUnit(PBEMPlayer, UnitDB(UNIT_SETTLER_NOMAD), startLocation, 0, tmpUnit);
    				AddMovement(tmpUnit, 900);
    			}
    			// bonus Gold + PW
    			SetPW(PBEMPlayer, 5000);
    			AddGold(PBEMPlayer, 9900);
    	
    			// random extra bonus advance
    			i = Random(6);
    			if (i == 0) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_MASONRY));
    			} elseif (i == 1) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_IRON_WORKING));
    			} elseif (i == 2) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_HULL_MAKING));
    			} elseif (i == 3) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_TRADE));
    			} elseif (i == 4) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_DRAMA));
    			} elseif (i == 5) {
    				GrantAdvance(PBEMPlayer, AdvanceDB(ADVANCE_JURISPRUDENCE));
    			}
    		}
    	}
    	DisableTrigger('LITE_StartUp');
    }
    
    // bonuses for first 3 cities
    HandleEvent(CreateCity) 'LITE_CityBonus' post {
    city_t	tmpCity;
    	tmpCity = city[0];
    
    	if (player[0].cities <= 3) {
    
    		// for all 3 cities
    		CreateUnit(player[0], UnitDB(UNIT_HOPLITE), tmpCity.location, 0);
    		CreateUnit(player[0], UnitDB(UNIT_HOPLITE), tmpCity.location, 0);
    		CreateUnit(player[0], UnitDB(UNIT_WARRIOR), tmpCity.location, 0);
    		CreateUnit(player[0], UnitDB(UNIT_SETTLER_ORIG), tmpCity.location, 0);
    		CreateUnit(player[0], UnitDB(UNIT_CARAVAN), tmpCity.location, 0);
    		// extra for capital
    		if (player[0].cities <= 1) {
    			PlantGood(tmpCity.location);
    			// Has to be event
    			Event: CreateUnit(player[0], tmpCity.location, tmpCity, UnitDB(UNIT_CARAVAN), 0); 
    			Event: CreateUnit(player[0], tmpCity.location, tmpCity, UnitDB(UNIT_CARAVAN), 0); 
    			Event: CreateUnit(player[0], tmpCity.location, tmpCity, UnitDB(UNIT_CARAVAN), 0); 
    		}
    	}
    	if (g.year > 10) {
    		DisableTrigger('LITE_StartUp');
    	}
    }

    Does anyone know why when i try to use this code with SAP+Goodmod, the trigger doesnt work? I think it might have something to do with the goods created with goodmod at the start.

    Its also doesnt create the extra 2 settlers, doesnt give any of the 6 random advances to any players either and doesnt create the free caravans. Basically the whole trigger doesnt work with GoodMod but i dont know how to fix it, it does work with SAP2 alone though. Ignore the new settler names, its just a workaround for a fast moving settler to start the game with. I get no errors, it just doesnt work.
    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


    Are you sure you coppied it in the right file???

    Other than that try to change the event name from 'LITE_StartUp' to anything else like 'MAQ_LITE_StartUp'. There is a chance of 1 in 10000000000000000000000 that there is a event with same name which causes the problem.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

    Comment


    • #3
      perhaps if you use the same local variable names in the same event handler (BeginTurn -post) then you get problems?

      Comment


      • #4
        *slaps forehead 10000000000000000000000 times.

        I didnt include the new script.slc in gamefile.txt. I still get a weird turn progression with it though, like this...

        -- Player1 starts at "turn 0", ends turn...
        -- Player2 now starts playing on "turn 1" ends turn.
        -- Player1 plays "turn 1" ends turn.
        -- Player2 plays "turn 2"... etc etc strange. That could be a thing with hotseat mode and GoodMod. Anyhow.
        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


        • #5
          Are you in debug mode? I put those handlers into the Vanilla game and got 'out of bounds' errors.

          Comment


          • #6
            Its on "DebugSlic=Yes" yeah, i didnt get any errors at all though.
            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


            • #7
              Don't suppose someone's fixed diplomacy in pbem yet?

              Is Maq any good at pbem btw?
              Shores Of Valinor.com - The Premier Tolkien Community -

              Comment


              • #8
                I think Locutus and Pedrunn were most active in the diplomacy work but stopped.

                And yes he is very good at PBEM. Check your email.
                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


                • #9
                  Originally posted by Turambar
                  Don't suppose someone's fixed diplomacy in pbem yet?
                  Originally posted by Maquiladora
                  I think Locutus and Pedrunn were most active in the diplomacy work but stopped.
                  I was fixing the PBEM diplomacy but i totally gave up because the PBEM has its turns broken (you cant get out of turn 0). What makes it impossible to play! So the PBEM diplomacy fix will just work for hotseat. And seems like we dont have all this search for hotseat games so i gave up.
                  "Kill a man and you are a murder.
                  Kill thousands and you are a conquer.
                  Kill all and you are a God!"
                  -Jean Rostand

                  Comment


                  • #10
                    Yeah not alot of people wanna play CtP2 PBEM unfortunately or hotseat. Me and Turambar just started a PBEM game with the "dummy AI" trick so we can save it inbetween our turns and send it. Not ideal but what else is there...
                    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


                    • #11
                      Broken how?

                      Couldn't we keep a 'virtual track' of turn numbers?

                      Comment


                      • #12
                        When you end turn in PBEM mode the turn count just stays at "0" and even when you end turn and go around in turns, the units (only move once), buildings (dont build) and research just stays the same, it just goes around, without actually ending the turn for any of the players.

                        If you can force the turn to end and clear all movement points and build/research stuff it would be great.
                        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


                        • #13
                          Isn't there an 'Begin Turn' event. What happens when its invoked?

                          Comment

                          Working...
                          X