| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#21 | |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Quote:
No since TECH_ISRAEL has bTrade 0 and I'm checking .isTrade. |
|
|
|
|
|
|
#22 |
|
Golden Python
Join Date: Oct 2010
Location: Singapore
Posts: 2,260
|
Doubt so for those first player rewards, whether religion, free GP or free tech
Because I think XML effects are triggered before python effects. Although, it is not hard to test ![]() Just try: 1) If iTechType == Meditation for instance 2) Grants Meditation to Human Player See who gets it and you can write your code in peace
__________________
My Works |
|
|
|
|
|
#23 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Btw... how can I check if someone is a master? I guess I have to loop over all players like I'm already doing...
|
|
|
|
|
|
#25 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Ah! Now I remember why I'm looping over all techs... you should get techs your master/vassal has researched before, too!
|
|
|
|
|
|
#27 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Okay, you may not use onTA instead:
If you switch your research at beginning of every round while your vassal or master researches monotheism, you will not get the splash screen/great prophet (with israel for example). Cannot say why. Civ4 is strange sometimes. //Edit: I did not get the tech either lol. |
|
|
|
|
|
#28 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Here is the code:
PHP Code:
Works if I'm not changing the current research every round. |
|
|
|
|
|
#30 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
Whats up?
|
|
|
|
|
|
#31 |
|
Golden Python
Join Date: Oct 2010
Location: Singapore
Posts: 2,260
|
It means I posted that while you post the codes lol
Anyway did a simple test to test the changing current tech thingy Code:
## Nalanda University Start ## for iPlayerX in range(gc.getMAX_CIV_PLAYERS()): pPlayerX = gc.getPlayer(iPlayerX) if pPlayerX.isHuman(): iTeamX = pPlayerX.getTeam() pTeamX = gc.getTeam(iTeamX) if iTeamX != iTeam and not pTeamX.isHasTech(iTechType): pTeamX.changeResearchProgress(iTechType, pTeamX.getResearchCost(iTechType) - pTeamX.getResearchProgress(iTechType), iPlayerX) ## Nalanda University End ## ![]() Anyway, even when I set research rate at 0% and switch every turn, I still get the techs once awhile with techscreen shown when others researched theirs. Also, when Polytheism was researched by some clown out there, I got it with techscreen as well, and Hindu was founded by him not me, so it proves first player rewards are working as intended too. Anyway, I think you should modify the codes to suit the onTA part first, to minimise errors. 1) when new tech acquired 2) loop through all teams rather than players using MAX_CIV_TEAMS, less loops, more efficient 3) check if loop team is vassal or master or iTeam 4) grants the tech to loop team. Yeah, I know changeResearchProgress needs a player ID at the end. Just use loop team instance .getLeaderID() This should be enough, as for the existing techs, just do it once in onVassalState will do
__________________
My Works |
|
|
|
|
|
#32 |
|
Emperor
Join Date: Jun 2007
Posts: 1,453
|
In my example there is not only one tech shared. Maybe that's the reason. Duno. I've tested it multiple times and I can reproduce the glitch with my code.
|
|
|
|
|
|
#33 |
|
Golden Python
Join Date: Oct 2010
Location: Singapore
Posts: 2,260
|
Under onTA:
Code:
def onTechAcquired(self, argsList): 'Tech Acquired' iTechType, iTeam, iPlayer, bAnnounce = argsList # Note that iPlayer may be NULL (-1) and not a refer to a player object if iPlayer > -1 and not CyGame().isOption(GameOptionTypes.GAMEOPTION_NO_VASSAL_STATES): if CyGame().isOption(GameOptionTypes.GAMEOPTION_HEGEMON_SHARES_TECHS) or CyGame().isOption(GameOptionTypes.GAMEOPTION_VASSAL_SHARES_TECHS): pTeam = gc.getTeam(iTeam) for iTeamX in range(gc.getMAX_CIV_TEAMS()): pTeamX = gc.getTeam(iTeamX) if pTeamX.isAlive() and not pTeamX.isHasTech(iTechType): if pTeam.isVassal(iTeamX) and CyGame().isOption(GameOptionTypes.GAMEOPTION_VASSAL_SHARES_TECHS): pTeamX.changeResearchProgress(iTechType, pTeamX.getResearchCost(iTechType) - pTeamX.getResearchProgress(iTechType), pTeamX.getLeaderID()) elif pTeamX.isVassal(iTeam) and CyGame().isOption(GameOptionTypes.GAMEOPTION_HEGEMON_SHARES_TECHS)): pTeamX.changeResearchProgress(iTechType, pTeamX.getResearchCost(iTechType) - pTeamX.getResearchProgress(iTechType), pTeamX.getLeaderID()) And this chunk is for the existing techs Code:
def onVassalState(self, argsList): 'Vassal State' iMaster, iVassal, bVassal = argsList if (bVassal): # Gameoption Hegemon/Vassal Shares Tech Start ----------------------------------------------------------------------------------------------- MasterTeam = gc.getTeam(iMaster) VassalTeam = gc.getTeam(iVassal) for iTechTypeX in range(gc.getNumTechInfos()): if gc.getTechInfo(iTechTypeX).isTrade(): if VassalTeam.isHasTech(iTechTypeX) and not MasterTeam.isHasTech(iTechTypeX): if CyGame().isOption(GameOptionTypes.GAMEOPTION_VASSAL_SHARES_TECHS): MasterTeam.changeResearchProgress(iTechTypeX, MasterTeam.getResearchCost(iTechTypeX) - MasterTeam.getResearchProgress(iTechTypeX), MasterTeam.getLeaderID()) if MasterTeam.isHasTech(iTechTypeX) and not VassalTeam.isHasTech(iTechTypeX): if CyGame().isOption(GameOptionTypes.GAMEOPTION_HEGEMON_SHARES_TECHS): VassalTeam.changeResearchProgress(iTechTypeX, VassalTeam.getResearchCost(iTechTypeX) - VassalTeam.getResearchProgress(iTechTypeX), VassalTeam.getLeaderID()) # Gameoption Hegemon/Vassal Shares Tech End ------------------------------------------------------------------------------------------------
__________________
My Works Last edited by platyping; May 01, 2012 at 11:26 PM. |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|