• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

This might belong more into the RFC subforum, but how difficult would it be to create a 1500AD scenario or something like that for Rhye's and Fall of Civilization, or to be more specific its Multiplayer Version? No adding of new civs, units or other features, just an advanced start.

idk anything about multiplayer, but a new scenario for RFC is medium difficulty. I may be forgetting something but I think it is all python and WBS, no C++.

I'm trying to re-compile a K-mod DLL with no changes of my own and I am getting this error:

Spoiler :
1>------ Build started: Project: CvGameCoreDLL, Configuration: Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>"fastdep.exe" NOT FOUND!
1>Please edit Makefile to reflect the correct path of fastdep.
1> "C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /Og /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files (x86)\WindowsSDK/Include" /I"C:\Program Files (x86)\WindowsSDK/Include/mfc" /YcCvGameCoreDLL.h /Fo"Release\_precompile.obj" /c _precompile.cpp
1>_precompile.cpp
1>c:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Civ4-K-Mod-RFC-project\CvGameCoreDLL\CvGameCoreDLL.h(227) : fatal error C1083: Cannot open include file: 'boost/python/list.hpp': No such file or directory
1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Civ4-K-Mod-RFC-project\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


does anyone know what I need to do?
 
ok I think I have had these issues before but I am very sleepy and off to bed in a minute.

The first error is about fastdep usually I get so frustrated with this one I just go into the nmake file and just 'note out' the use fastdep bit and the path.

C1083: Cannot open include file: 'boost/python/list.hpp': No such file or directory
1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'

this bit I think is a problem with either the file path in nmake file not pointing to where you have the "Microsoft Visual C++ Toolkit 2003" installed, or it is possibly pointing to a wrong bit in this folder...

It has been a little while since i had this issue, and like I said I am sleepy so cannot give a more in depth response right now, if nobody smarter comes along I will try and give a slightly better response tomorrow!
 
C1083: Cannot open include file: 'boost/python/list.hpp': No such file or directory
1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
Looks like you don't have the Boost-1.32.0 and/or Python24 folders at the place the compiler expects them, usually in the same folders than your source files.

fastdep probably belongs to bin/fastdep.exe
 
Looks like you don't have the Boost-1.32.0 and/or Python24 folders at the place the compiler expects them, usually in the same folders than your source files.

fastdep probably belongs to bin/fastdep.exe

I was had similar problem and i am fix it. See MY THREAD from 14-18 maybe can help you, i am forget how i am fix that error.
 
fatal error C1083: Cannot open include file: 'boost/python/list.hpp': No such file or directory
1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'

If you have a look in your makefile you will probably see some variables at the top where you have to set paths to various folders, one of those folders will be to the Python or Boost libraries, though it may be an indirect link through your main Civ4 SDK installation.

If you could post your makefile I could take a look and see where you need to define the path.

You can get hold of fastdep here where there is a copy in the first attachment in the opening post. You should extract the zip and put fastdep executable in your Visual C++ Toolkit bin folder...this again should be defined in the makefile
 
@dacubz

So I can't really see anything wrong. The only thing at this point I can suggest is try 'simplifying' your mod name. try calling it TTT or somehting like that and change those path names to match..

It probably won't work, but I have a wonder that it might be the ' - ' part that is causing problems as it may not like that sort of formating, particularly the spaces..

I sincerely doubt it is the problem, but it is at least worth a try as it is a fairly quick and simple thing to do...

Do you get any kind of message with your CTD?

It has been so long since I did this for my mod that I cannot really remember how I did it successfully.

The only other thing I can suggest is taking the unmodified vanilla resource folder (without the utility change) and following the tutorial to change the colour yourself and see if you get a working result...

I think the only crash I have had is when the file paths don't match properly... I cannot think of any other issue I had, I think this (for me) was one of the few times where i followed the tutorial and it just worked..

Sorry I can't help more, I think it was actually a couple of years ago I played with this and haven't been back to this part of the display system since...
 
God damn! how can I get the game to set the result of a division in float point precision?!?!

@#$@ing thing just doesn't let me! I'm setting a variable to a number with a decimal in different ways, and when I check and read the variable to see what it is, its always returning some large number.

I've tried the following already:


iTestVariable = 0.5
iTestVariable = float(0.5)
iTestVariable = (5 / 10)
iTestVariable = (5.0 / 10)
iTestVariable = float(5 / 10)
iTestVariable = float(iTestVariable) ; returns error, defining none-existing variable. which is correct.

WTH!!!!

How the hell can I get the game to work with floats!!!???

I'm working in CvEventManager.py


Also anyone know where I can insert code to modify the research formula calculations at the end of a turn before any value is actually added to the current research? onEndPlayerTurn isn't it. onEndPlayerTurn is already after research is applied.
 
I'm setting a variable to a number with a decimal in different ways, and when I check and read the variable to see what it is, its always returning some large number.

How are you looking at it?

It sounds like you are formatting the output with a %d in a "print" statement or some equivalent. That formats the data as an integer. If the data is a floating point number you need to format it with a %f format specifier. This is purely a formatting thing - it is affecting how it shows you the number, not what it actually is. The actual layout of the data (the bits in the bytes) of a floating point number typically makes it look like a big integer if that piece of memory is treated as an integer.

(By the way, the "i" at the start of a variable name is used to indicate that the variable should be an integer. If you don't use it like that it will be confusing. To name a floating point variable you'd typically prefix it with an "f" instead. This has no effect on how it works, it just helps you keep track of what the variable is supposed to be used for. This is known as Hungarian notation.)
 
Thank you. Exactly right.

I figured it out eventually but didn't know the correct print notation. Thanks.


Hey God-Emperor you have both God and Emperor in your name and Deity under it, of all the people you're probably one of the few who can help me with this with your godly likeness! :king:


I want to be able to modify the amount of total science that's about to be added to the current research before it is added and then have it get added. Such that I can boost or reduce the final number before its added. But I don't know how.

ResearchProgress is not it. I'm guessing I need to find the route. The science formula itself. The one that has adds all the different variables and sources and pumps the final number.

Do you know anything about this? can you help me figure it out?
 
Hopefully quick question: Does anyone know if there is a Python wonder that would grant :hammers: (or another yield) from trade routes? I need one in my mod, and I have no idea how to code it, so if someone has made one, I would appreciate it.
 
Hopefully quick question: Does anyone know if there is a Python wonder that would grant :hammers: (or another yield) from trade routes? I need one in my mod, and I have no idea how to code it, so if someone has made one, I would appreciate it.

I doubt Python is necessary, it's at least possible to add Hammer and Food Yields for Trade Routes from civics though, so maybe some copy paste with C++ would be required.
 
@dacubz

So I can't really see anything wrong. The only thing at this point I can suggest is try 'simplifying' your mod name. try calling it TTT or somehting like that and change those path names to match..

It probably won't work, but I have a wonder that it might be the ' - ' part that is causing problems as it may not like that sort of formating, particularly the spaces..

I sincerely doubt it is the problem, but it is at least worth a try as it is a fairly quick and simple thing to do...

Do you get any kind of message with your CTD?

It has been so long since I did this for my mod that I cannot really remember how I did it successfully.

The only other thing I can suggest is taking the unmodified vanilla resource folder (without the utility change) and following the tutorial to change the colour yourself and see if you get a working result...

I think the only crash I have had is when the file paths don't match properly... I cannot think of any other issue I had, I think this (for me) was one of the few times where i followed the tutorial and it just worked..

Sorry I can't help more, I think it was actually a couple of years ago I played with this and haven't been back to this part of the display system since...
didn't work....sigh, but thanks for the effort, truly appreciate it!
 
I have some problems with this component from The_J. It makes some leaders change at a certain date. It works fine in custom games, but not in scenarios. The old civ and leader are "killed" and an exact copy appears with the same leader. This works fine for the first time, but apparantly in the scenario, when there is already a leader "dead", for example: Kug-Bau of Sumer and a new leader, Senusret III of Egypt has to spawn, he takes her slot; which results in this.
Spoiler :
attachment.php
Other example:
attachment.php

attachment.php

Khufu is dead, replaced by Senusret III (who is called Kug-Bau) and Ashurbanipal takes the old name of Khufu and the old civ-description, flag, civname and adjective.

The old flag, old description, name, adjective of the civ and the old leader's name are kept, but the civilization and leader are successfully changed.
How can I solve this problem? Maybe another python code that changes the flag, name, description, adjective of the civ and changes the leadername?
Or modify the code so that the new leader automatically takes a unowned civ-slot and not that of a dead civ?
Code:
###Changing leaders###
LeaderList = []
###Changing leaders###
Code:
		###changing leaders###		
                self.InitLeaderList()
		###changing leaders###
Code:
		###changing leaders###
		if iGameTurn ==1:
                        self.InitLeaderList()
		###changing leaders###
Code:
		###changing leaders
		self.ChangeLeaders(iGameTurn+1,iPlayer)
		###changing leaders
Code:
###changing leaders###
        def InitLeaderList(self):
                LeaderList.append(["CIVILIZATION_SUMER",-2100,"LEADER_URNAMMU",-1])
                LeaderList.append(["CIVILIZATION_EGYPT",-1900,"LEADER_SENUSRET",-1])
                LeaderList.append(["CIVILIZATION_HITTITE",-1250,"LEADER_PUDUHEPA",-1])
                LeaderList.append(["CIVILIZATION_ASSYRIA",-700,"LEADER_ASHURBANIPAL",-1])
                self.TestLeaderList()
                
        def TestLeaderList(self):
                NotInList = []
                for i in range(len(LeaderList)):
                        InList = False
                        for j in range(gc.getMAX_CIV_PLAYERS ()):
                                pPlayer = gc.getPlayer(j)
                                Civ = pPlayer.getCivilizationType ()
                                if Civ == gc.getInfoTypeForString(LeaderList[i][0]):
                                        InList = True
                                        break
                                if LeaderList[i][3]!=-1:
                                        if Civ == gc.getInfoTypeForString(LeaderList[i][3]):
                                                NotInList.append(i)
                                                break
                        if InList == False:
                                #For Debuging# CyInterface().addMessage(0,false,20,CyTranslator().getText(str(i),()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), 1, 1, True,True) 
                                NotInList.append(i)
                StartPoint = len(NotInList)
                #CyInterface().addMessage(0,false,20,str(StartPoint),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), 1, 1, True,True) 
                for k in range(StartPoint,0,1):
                        #CyInterface().addMessage(0,false,50,CyTranslator().getText("MEMORY",())+str(k),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), 1, 1, True,True) 
                        LeaderList.pop(NotInList[k])
                        
                        
                                        
                                
                
        def ChangeLeaders(self,iGameTurn,iPlayer):
                pPlayer = gc.getPlayer(iPlayer)
                ##old code
                #if pPlayer.isHuman():
                        #return
                Year = gc.getGame().getTurnYear(iGameTurn)                
                Civ = pPlayer.getCivilizationType ()
                Leader = pPlayer.getLeaderType ()
                if CyGame().countCivPlayersAlive ()==gc.getMAX_CIV_PLAYERS ():
                        return
                for i in range (len(LeaderList)):
                        if LeaderList[i][1]<=Year:
                                if Civ == gc.getInfoTypeForString(LeaderList[i][0]):
                                        if Leader != gc.getInfoTypeForString(LeaderList[i][2]):
                                                PlayerTeamID = gc.getTeam(pPlayer.getTeam()).getID()
                                                NewLeaderID = gc.getInfoTypeForString(LeaderList[i][2])
                                                NewID = -1
                                                for NumCiv in xrange (gc.getMAX_PLAYERS ()):
                                                        PotPlayer = gc.getPlayer(NumCiv)
                                                        if not PotPlayer.isAlive():
                                                                NewID = NumCiv
                                                                break
                                                if NewID ==-1:
                                                        return
                                                if LeaderList[i][3]!=-1:
                                                        Civ = gc.getInfoTypeForString(LeaderList[i][3])
                                                        
                                                CyGame().addPlayer(NewID,NewLeaderID,Civ)                                                
                                                NewPlayer = gc.getPlayer(NewID)
                                                NumCities = pPlayer.getNumCities ()
                                                NumUnits = pPlayer.getNumUnits ()
                                                otherteam = gc.getTeam(gc.getPlayer(iPlayer).getTeam())
                                              
                                                for iUnits in xrange (NumUnits):
                                                        TheUnit = pPlayer.getUnit(iUnits)
                                                        if TheUnit.isNone():
                                                                continue
                                                        newUnit = NewPlayer.initUnit(TheUnit.getUnitType (), TheUnit.getX(), TheUnit.getY(), UnitAITypes.UNITAI_GENERAL, DirectionTypes.NO_DIRECTION)
                                                        
                                                for iCivics in xrange(gc.getNumCivicOptionInfos ()):                                                        
                                                        CurCivic = pPlayer.getCivics(iCivics)        
                                                        NewPlayer.setCivics(iCivics,CurCivic)
                                                oldReligion = pPlayer.getStateReligion()
                                                oldGold = pPlayer.getGold()
                                                oldResearch = pPlayer.getCurrentResearch ()
                                                oldResearchProg = otherteam.getResearchProgress(oldResearch)
                                                for iNumPlayers in xrange (gc.getMAX_PLAYERS()):
                                                        LoopPlayer = gc.getPlayer(iNumPlayers)                                                        
                                                        ExtraAttitude = pPlayer.AI_getAttitudeExtra(iNumPlayers)
                                                        NewPlayer.AI_setAttitudeExtra(iNumPlayers,ExtraAttitude)
                                                        ExtraAttitude2 = LoopPlayer.AI_getAttitudeExtra(iPlayer)
                                                        LoopPlayer.AI_setAttitudeExtra(NewID,ExtraAttitude2)
                                                        for iNumMemories in range(29):###29 = Number of Memory Infos; No idea, how to get dynamically
                                                                OldMemory = pPlayer.AI_getMemoryCount(iNumPlayers,iNumMemories)
                                                                NewPlayer.AI_changeMemoryCount(iNumPlayers,iNumMemories,OldMemory)
                                                                OldMemory2 = LoopPlayer.AI_getMemoryCount(iPlayer,iNumMemories)
                                                                LoopPlayer.AI_changeMemoryCount(NewID,iNumMemories,OldMemory2)                                                                                                                               
                                                                
                                                VassalStatus = []
                                                MasterStatus = []
                                                OpenBordersStatus =[]
                                                WarStatus =[]
                                                WarWearinessStatusOwn=[]
                                                WarWearinessStatusOther=[]
                                                EspionageStatusOwn=[]
                                                EspionageStatusOther=[]
                                                DefPactStatus =[]
                                                NewTeamID = NewPlayer.getTeam()
                                                NewTeam = gc.getTeam(NewPlayer.getTeam())                                                
                                                for iNumTeams in xrange(gc.getMAX_TEAMS ()):                                                        
                                                        if iNumTeams == NewTeamID:
                                                                continue                                                        
                                                        LoopTeam = gc.getTeam(iNumTeams)
                                                        if LoopTeam.isOpenBorders(iPlayer):
                                                                OpenBordersStatus.append(True)
                                                        else:
                                                                OpenBordersStatus.append(False)
                                                        if LoopTeam.isVassal(iPlayer):
                                                                MasterStatus.append(True)
                                                        else:
                                                                MasterStatus.append(False)
                                                        if otherteam.isVassal(iNumTeams):
                                                                VassalStatus.append(True)
                                                        else:
                                                                VassalStatus.append(False)
                                                        if otherteam.isAtWar(iNumTeams):
                                                                WarStatus.append(True)                                                                
                                                        else:
                                                                WarStatus.append(False)
                                                        if otherteam.isDefensivePact(iNumTeams):
                                                                DefPactStatus.append(True)
                                                        else:
                                                                DefPactStatus.append(False)
                                                        WarWearinessStatusOwn.append(otherteam.getWarWeariness(iNumTeams))
                                                        WarWearinessStatusOther.append(LoopTeam.getWarWeariness(iPlayer))
                                                        EspionageStatusOwn.append(otherteam.getEspionagePointsAgainstTeam(iNumTeams))
                                                        #CyInterface().addMessage(0,false,50,CyTranslator().getText("Spio 1. Teil  ",())+str(otherteam.getEspionagePointsAgainstTeam(iNumTeams)),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), 1, 1, True,True) 
                                                        EspionageStatusOther.append(LoopTeam.getEspionagePointsAgainstTeam(iPlayer))
                                                #pPlayer.killAllDeals ()
                                                for iTechs in xrange(gc.getNumTechInfos ()):
                                                        if otherteam.isHasTech(iTechs):
                                                                NewTeam.setHasTech(iTechs,True,NewID,False,False)
                                                
                                                for iCities in xrange (NumCities):
                                                        TheCity = pPlayer.getCity(iCities)
                                                        if TheCity.isNone():
                                                                continue
                                                        CultureLevel = TheCity.getCulture (iPlayer)
                                                        NewPlayer.acquireCity(TheCity,False,False)
                                                        NewCity = NewPlayer.getCity(iCities)
                                                        NewCity.changeCulture(NewID,CultureLevel,True)                                                
                                                
                                                NewTeamID = NewPlayer.getTeam()
                                                NewTeam = gc.getTeam(NewPlayer.getTeam())
                                                CountTeams = 0
                                                for iNumTeams in range(gc.getMAX_TEAMS ()):
                                                        if iNumTeams == NewTeamID:
                                                                continue                                                                                                           
                                                        LoopTeam = gc.getTeam(iNumTeams)
                                                        if OpenBordersStatus[CountTeams]:                                                         
                                                                LoopTeam.signOpenBorders(NewTeamID)
                                                                NewTeam.signOpenBorders(iNumTeams)
                                                        if MasterStatus[CountTeams]:
                                                                LoopTeam.setVassal(NewTeamID,True,True)
                                                        if VassalStatus[CountTeams]:
                                                                NewTeam.setVassal(iNumTeams,True,True)
                                                        if WarStatus[CountTeams]:
                                                                NewTeam.declareWar(iNumTeams,True,WarPlanTypes.WARPLAN_LIMITED)
                                                                gc.getTeam(iNumTeams).declareWar(NewTeam.getID(),True,WarPlanTypes.WARPLAN_LIMITED)
                                                        if DefPactStatus[CountTeams]:
                                                                NewTeam.signDefensivePact(iNumTeams)
                                                                LoopTeam.signDefensivePact(NewTeamID)
                                                        NewTeam.setWarWeariness(iNumTeams,WarWearinessStatusOwn[CountTeams])
                                                        LoopTeam.setWarWeariness(NewTeamID,WarWearinessStatusOwn[CountTeams])
                                                        NewTeam.setEspionagePointsAgainstTeam(iNumTeams,EspionageStatusOwn[CountTeams])
                                                        #CyInterface().addMessage(0,false,50,CyTranslator().getText("Spio 2. Teil  ",())+str(EspionageStatusOwn[CountTeams]),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), 1, 1, True,True)                                                         
                                                        LoopTeam.setEspionagePointsAgainstTeam(NewTeamID,EspionageStatusOther[CountTeams])
                                                        CountTeams = CountTeams+1

                                                
                                                #NumDeals = CyGame().getNumDeals ()
                                                #for iDeals in xrange (NumDeals):
                                                        #ThisDeal = CyGame().getDeal (iDeals)
                                                        #iFirstPlayer = ThisDeal.getFirstPlayer ()
                                                        #iSecondPlayer = ThisDeal.getSecondPlayer ()
                                                        #if iFirstPlayer = iPlayer or iSecondPlayer = iPlayer:                                                          

        

                                                NewPlayer.convert(oldReligion)
                                                NewPlayer.setGold(oldGold)
                                                NewTeam.setResearchProgress(oldResearch, oldResearchProg,NewID)
                                                LeaderList.pop(i)
                                                if pPlayer.isHuman():
                                                        CyGame().setActivePlayer(NewID,False)
                                                        
                                                break
                                        
                                
                                
        
###changing leaders###
Please help, I can't continue my mod otherwise. If more suitable, you can reply in my thread about the Ancient Middle East mod.
 

Attachments

  • Civ4ScreenShot0962.JPG
    Civ4ScreenShot0962.JPG
    210.4 KB · Views: 222
  • Civ4ScreenShot0963.JPG
    Civ4ScreenShot0963.JPG
    139.8 KB · Views: 210
  • Civ4ScreenShot0964.JPG
    Civ4ScreenShot0964.JPG
    136.9 KB · Views: 188
Just a quick thought: how many civs do you have at the beginning of your scenario and how many does your dll allows?
 
Just a quick thought: how many civs do you have at the beginning of your scenario and how many does your dll allows?
I don't know the precise number, but I think 42-44 or something. The DLL that I currently use, allows 77 civs to exist in the game.
 
I doubt Python is necessary, it's at least possible to add Hammer and Food Yields for Trade Routes from civics though, so maybe some copy paste with C++ would be required.

I'm trying to make it work for only the city was built it, and while I have some small experience with Python, my experience with C++ and the SDK is none. If no-one has a python wonder like that, I may just make one.
 
Actually, good luck with the change leader component.
What it does is trying to change leader while keeping everything else similar.
However, it is impossible to replicate everything via python.
For instance, liberation of colony +10 relationship is not one of the memories.
Cities are screwed since the original ownership still belongs to the old leader.
Ongoing trades like peace treaty or resources for gpt are all screwed.
 
Actually, good luck with the change leader component.
Uh...thanks I guess...
For instance, liberation of colony +10 relationship is not one of the memories.
Players are not supposed to liberate colonies in my mod, where there is only one continent and only a few islands.
Cities are screwed since the original ownership still belongs to the old leader.
Those leaders are dead, but it still messes up the territory ownership with other civs.
Ongoing trades like peace treaty or resources for gpt are all screwed.
Well that's one of the disadvantages, but nothing that can't be retraded...
Unless someone can mod in the RFC component (not me), I'm stuck with this, not that it's really bothering me.
 
Back
Top Bottom