Announcement

Collapse
No announcement yet.

Wonderful Reality

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

  • Pedrunn
    replied
    Originally posted by J Bytheway
    Can't you just remove the advance from all the players who have it?
    Yep the RemoveAdvance function was working nicely with EndTurn and BeginTurn event. But that means the AI would have a whole turn with Subneural Ads. And he could place cities while with this advance. So i tried to add the fuction in the ExpandCity function. Did not work no matter where i write it . So i thought i would have to add the fuction in all event handlers but no need anymore i found the solution. Simple, yet perfect :
    Code:
    HandleEvent(CreateImprovement) 'RemoveSubNeralAds' post {
    	if (HasAdvance(player[0], ID_ADVANCE_SUBNEURAL_ADS)) {
    		RemoveAdvance(player[0], AdvanceDB(ADVANCE_SUBNEURAL_ADS));
    	}
    }
    This means we are only one known bug to the release of the city expansion v2.0:
    Prevent the building of regular improvements over the wonders. I tried this code:
    Code:
    HandleEvent(CreateImprovement) 'DontLetPlaceImpsOverCities' pre {	// Does not work :(
    	if(TileHasWonder(location[0]) == 1			// only works for slic placements
    	|| TileHasCity (location[0]) == 1) {
    		return STOP;
    	}
    }
    where the functions TileHasCity and TileHasWonder are known to be working perfecly. I tried several variations and even tested the event in several ways. I got to the conclusion that the CreateImprovement event only works for slic placements .
    The best solution i came up to was to dont try to stop the placement but preventing the exclusion of the Imp: All wonders and cities Imps are OceanATM and none of the regular imps can exclude this type of TI. Wich means we have to place the port in another place (suggestion: OceanMine). Bad solution yet a solution.
    Last edited by Pedrunn; August 17, 2002, 09:26.

    Leave a comment:


  • J Bytheway
    replied
    Originally posted by Pedrunn
    I will test the RemoveAdvance function again. But your piece of code needs modification since not only players who had sucess = 1 must get the advance but all those who triggered the expansion.
    Can't you just remove the advance from all the players who have it?

    Leave a comment:


  • Pedrunn
    replied
    Originally posted by Immortal Wombat
    Ah. You appear to have prevented any player from having any advance.
    : Now i got how those fuctions work! Thanks

    Originally posted by Immortal Wombat
    But you don't need it really. SubNeural ads can never be researched anyway, and you just need the RemoveAdvance function in a different handler at the end of that turn to make it work.
    Actually i was hoping the mod fuction would remove the advance and not prevent its research.

    I will test the RemoveAdvance function again. But your piece of code needs modification since not only players who had sucess = 1 must get the advance but all those who triggered the expansion.
    Last edited by Pedrunn; August 16, 2002, 22:29.

    Leave a comment:


  • Immortal Wombat
    replied
    Ah. You appear to have prevented any player from having any advance. Put the two if() statements the other way around, replace the second 0 with a 1, and you got it.

    But you don't need it really. SubNeural ads can never be researched anyway, and you just need the RemoveAdvance function in a different handler at the end of that turn to make it work.
    Set up a player array as a switch, eg:
    Code:
    int_t    IsPlayerExpanding[];
    
    // In the expandcity function
    if(sucess == 1){
         IsPlayerExpanding[owner] = 1;
    }
    
    // and then later...
    
    HandleEvent(endturn) 'remove_ads' pre{
         int_t  i;
        for(i=0; i < preference("NumPlayers"); i = i + 1){    // or whatever
                if(IsPlayerExpanding[i] == 1){
                    RemoveAdvance(i, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
                    IsPlayerExpanding[i] = 0;
                }
           }
    }
    or something

    Leave a comment:


  • Pedrunn
    replied
    This is making the game crash after lauching it. Any suggestion on how to make this code work.
    Code:
    int_t ExpansionPlayer;	
    
    int_f mod_CanPlayerHaveAdvance(int_t thePlayer, int_t theAdvance) {
    int_t tmpAdvance;
    int_t tmpPlayer;
    	tmpAdvance = theAdvance;
    	tmpPlayer = thePlayer;
    	if(tmpPlayer == ExpansionPlayer) {	
    		if (tmpAdvance == AdvanceDB(ADVANCE_SUBNEURAL_ADS)) { 
    			return 1;
    		}
    		else{
    			return 0;
    		}
    	}
    	else{
    		return 0;
    	}
    }
    
    HandleEvent(EndTurn) 'NobodyCanCreateCities' pre {
    	ExpansionPlayer = 0;
    }
    And this is part of the where ExpansionPlayer is defined.
    Code:
    	ExpansionPlayer = ownerNum;
    	GrantAdvance(ownerNum, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
    Right before the expansion starts. It is in the beginning of the expandCity function of my code for those who have see the code.

    PS: Does the RemoveAdvance function work. I have tried to used but not with sucess.

    Leave a comment:


  • Immortal Wombat
    replied
    Did I mention, the wonder code should work - provided when you test it, you don't complete two wonders on consecutive turns. Otherwise the TI isn't built properly, and problems occur.

    Leave a comment:


  • Pedrunn
    replied
    Thanks

    Leave a comment:


  • Martin Gühmann
    replied
    Originally posted by Pedrunn
    what are the variables for the mod_CanPlayerHaveAdvance function?
    (int_t, ) ???
    Just take a look into the WW_mod.slc and you will find this:

    Code:
    // Players can not research any new technologies
    int_f mod_CanPlayerHaveAdvance (int_t thePlayer, int_t theAdvance)
    {
    	if (theAdvance == AdvanceDB(ADVANCE_ADV_NAVAL_TACTICS) ||
    		theAdvance == AdvanceDB(ADVANCE_VERTICAL_FLIGHT_AIRCRAFT) ||
    		theAdvance == AdvanceDB(ADVANCE_SUPERSONIC_FLIGHT) ||
    		theAdvance == AdvanceDB(ADVANCE_MASS_TRANSIT) ||
    		theAdvance == AdvanceDB(ADVANCE_COMPUTER) ||
    		theAdvance == AdvanceDB(ADVANCE_GLOBAL_ECONOMICS) ||
    		theAdvance == AdvanceDB(ADVANCE_CORPORATE_REPUBLIC)) {
    		return 0;
    	} else {
    		return 1;
    	}
    }
    So the first argument is the player index in the game in integer form.

    And the second argument is the advance represented by an integer the DataBase index of the advance.

    -Martin

    Leave a comment:


  • Immortal Wombat
    replied
    int_t [player], int_t [advanceDB index]

    Leave a comment:


  • Pedrunn
    replied
    Originally posted by Locutus
    Uhm, why don't you just give all the TileImps an advance as prerequisite that's impossible to research (i.e. has itself as prerequisite or is disabled with the mod_* SLIC function)?
    what are the variables for the mod_CanPlayerHaveAdvance function?
    (int_t, ) ???

    Leave a comment:


  • Immortal Wombat
    replied
    6Mb??

    Leave a comment:


  • Locutus
    replied
    So? What's 20k on a 6MB download?

    Leave a comment:


  • Immortal Wombat
    replied
    Extra text file. Not a major problem, but annoying.

    Unless I use Subneural Ads as that advance. Which is basically what I was going to do anyway.
    Last edited by Immortal Wombat; August 4, 2002, 18:39.

    Leave a comment:


  • Locutus
    replied
    Uhm, why don't you just give all the TileImps an advance as prerequisite that's impossible to research (i.e. has itself as prerequisite or is disabled with the mod_* SLIC function)?

    Leave a comment:


  • Immortal Wombat
    replied
    Yeah, good point. It'll have to be the advances then

    Leave a comment:

Working...
X