Quick Modding Questions Thread

Lets try to code.

first step:
Add lines to CvEventManager.py:

After imports:
from myscript import Each_turn_event

After: def onBeginPlayerTurn(self, argsList):
iGameTurn, iPlayer = argsList
Each_turn_event(iGameTurn,gc.getPlayer(iPlayer))

PS. Don`t forget an ident.

This code imports function (Each_turn_event) from file myscript.py
and calls it every turn.

Next put myscript.py to python folder.

Edit dateEvents dictionary as you wish.
I got an error


EDIT: I found my error a " . " instead of " , "
Code:
Each_turn_event(iGameTurn.gc.getPlayer(iPlayer))
instead:)of
Code:
Each_turn_event(iGameTurn,gc.getPlayer(iPlayer))

I'll now start to add some popups messages. :D
 
@Duha

I assume I can miss out turns e.g.
Code:
              907: (popup,("November 6 – Italy joins the Anti-Comintern Pact.",)),
              909: (popup,("December 11 – Italy withdraws from the League of Nations.",)),
missing out 908 - 1937, second fortnight in November.
 
@Duha

I assume I can miss out turns e.g.
Code:
              907: (popup,("November 6 – Italy joins the Anti-Comintern Pact.",)),
              909: (popup,("December 11 – Italy withdraws from the League of Nations.",)),
missing out 908 - 1937, second fortnight in November.

Is is question or statement ?

You can place any integer to first place(this place calls "key") and in any order.
{1: (popup,("text",)),
4: (popup,("text",)),
2: (popup,("text",)),
55: (popup,("text",)),
3: (popup,("text",)),
}
 
Does anyone know where the code is that generates these light blue circles on the map that should indicate a recommended plot? I've heard numerous reports of such recommendations for workers where no action was highlighted when moving the worker to such a plot, and I wanted to investigate .. just couldn't find the code yet.

nvm, it's in CvGameInterface.cpp - CvGame::updateColoredPlots()
 
I'm not seeing anything wrong so far, but maybe you could help me? First, how do I "uncomment" the mod directory?

I don't remember how the config looks without editing but mine looks this. Do you possibly mean this part in the config:
Code:
# If you want to run this on a mod, uncomment the next line and make
# sure the path points to your mod.
# add_directory charlemagne "$install_dir/beyond the sword/mods/charlemagne/assets"
add_directory 19th "$install_dir/beyond the sword/mods/19th and 20th Century/assets"
As you can see, the last line isn't commented (so it's uncommented ;)) the 19th is at the start of every line that has been checked from your mod so make it something you can find easily. Then there should be a path to your mod's assets folder.
I'm sorry but English isn't my native language, so it's very hard to write something like this. :sad:
 
Is is question or statement ?

You can place any integer to first place(this place calls "key") and in any order.
{1: (popup,("text",)),
4: (popup,("text",)),
2: (popup,("text",)),
55: (popup,("text",)),
3: (popup,("text",)),
}

Excellent, because in some fortnights, nothing significant happens.

Next step is assigning an Event effect, e.g. +1 happiness in ...., or "Great Person" created in ...

btw: In cutting and pasting text from wikipedia, I discovered a problem with 0x96 character, but if I replace it with "-" it is fine as opposed to a "–". Note the subtle size difference
Code:
-
–
 
I don't remember how the config looks without editing but mine looks this. Do you possibly mean this part in the config:
Code:
# If you want to run this on a mod, uncomment the next line and make
# sure the path points to your mod.
# add_directory charlemagne "$install_dir/beyond the sword/mods/charlemagne/assets"
add_directory 19th "$install_dir/beyond the sword/mods/19th and 20th Century/assets"
As you can see, the last line isn't commented (so it's uncommented ;)) the 19th is at the start of every line that has been checked from your mod so make it something you can find easily. Then there should be a path to your mod's assets folder.
I'm sorry but English isn't my native language, so it's very hard to write something like this. :sad:

Actually, I believe your English is perfect. It certainly is much better than a lot of LOLCats-esque garbage I read from many native speakers.

So the "pound symbol" (#) denotes a commented tag. That is as I suspected, but I wanted to be sure. The current problem file is technologyinfos.xml. When I get back to my own computer I will post the edits I made to the file, but either I haven't done everything to point to the mod, or it's not finding the problem with my mod.
 
@The_J

As I understand python calls many C++ functions. Can you tell me where I can get their source? this one here is not very informative :)

And another question:
If i want to add "+1 Happines" to all cities where I should do it? Is it any global object that stored this info?
 
@The_J

As I understand python calls many C++ functions. Can you tell me where I can get their source?

The source is the CvGameCoreDll, which is build out of the .cpp and .h files, which are in the CvGameCoreDll folder.

this one here is not very informative :)

It is not? Why? Most functions are imho named very clear.

And another question:
If i want to add "+1 Happines" to all cities where I should do it? Is it any global object that stored this info?

No global objects, as far as i know.
I think you have to iterate over the cities and add manually a +1:) everywhere.
 
The source is the CvGameCoreDll, which is build out of the .cpp and .h files, which are in the CvGameCoreDll folder.
It was so near that I can`t find it :)

It is not? Why? Most functions are imho named very clear.
Some times it named more better when I can read c++ :)

No global objects, as far as i know.
I think you have to iterate over the cities and add manually a +1:) everywhere.

Something like that :)

[city.changeExtraHappiness(+1) for city in [player.getCity(x) for x in xrange(player.getNumCities())]]
 
For you as a beginner: Right :goodjob:.

There are some problems with that pseudo code, which you can't know.
Complelty right would be this:
PHP:
    (loopCity, iter) = pPlayer.firstCity(False)
    while (loopCity):
            if not loopCity.isNone():
                loopCity.changeExtraHappiness(+1) 
	    (loopCity, iter) = pPlayer.nextCity(iter, False)

I can explain the difference if needed, but atm i'm to lazy :D.
 
Either I'm doing something terribly wrong with Civchecker, or it isn't good enough to find what's wrong with my mod. Here's the configuration, in my attempt to check my "World 2010" mod:

Spoiler :
# The installation path is probably right. Change it if you installed
# the game somewhere else.
set install_dir "c:/program files/firaxis games/sid meier's civilization 4"

# If you have files in your local CustomAssets you want checked,
# uncomment the next line and make sure the path is correct. For
# non-English language installations, you will need to change "my documents"
# to the right name also.
# add_directory custom "c:/documents and settings/jena/my documents/my games/beyond the sword/customassets"

# If you want to run this on a mod, uncomment the next line and make
# sure the path points to your mod.
add_directory charlmagne "$install_dir/beyond the sword/mods/World 2010"

# If you don't have BTS or warlords, comment out the corresponding lines
add_directory bts "$install_dir/beyond the sword/assets"
add_directory warlords "$install_dir/warlords/assets"
add_directory vanilla "$install_dir/assets"

# Uncomment these lines to enable some more verbose reports
report_filenames
report_definitions
report_unused

# You may want to find undefined text strings; then comment this out
add_prefix TXT_KEY

### From here down, you should only change if you know what you are doing.

# Values inside these keys will be checked for art file existence
add_art_key Button KFM NIF SHADERNIF

# General list of symbol prefixes to ignore. You may prefer to locate
# the corresponding type definition and use add_define instead.
add_prefix ADVISOR ANIMATIONPATH ANIMCAT AQUEDUCT ARTSTYLE ASSS
add_prefix ATTACHABLE AUTOMATE AXIS BONUSCLASS CAMERA CITY
add_prefix CITYBILLBOARD CITYSIZE CITYTAB COLOR COMMAND CONCEPT
add_prefix CONTACT CONTROL CULTURELEVEL CURSOR DELTA DF DIPLOMACYPOWER
add_prefix EFFECT ENDSTEP FIREWORKS FLAVOR FOOTSTEP FORCECONTROL GAME
add_prefix GAMESPEED GLOBE GRAPHICOPTION INTERFACE INTERFACEMODE KB
add_prefix LIGHTING LOOPSTEP LSYSTEM MAIN_MENU MAINMENU MENU PLAYEROPTION
add_prefix PLOT RIVER SEALEVEL SYSTEM TILE_ART TUTORIAL TXT_MAIN_MENU
add_prefix UNIT_HEALTH UPKEEP WALL WIDGET WORLDBUILDER WORLDSIZE YIELD

# If an all-cap string happens to appear in a language tag, don't take it
add_language English French German Italian Spanish

# Some exact strings are undefined, which we don't want
add_string NONE UNIT GENERAL SIEGE WORKERSWORKING STEAM UNIT_SCALE
add_string LIGHT_TYPE_SUN ICBM IDS ONU SDI SOUNDSCAPE TEMP MD
add_string FOOTPRINT FOG_TYPE_NONE LANDSCAPE_DEFAULT LOOPINGEFFECT_SMOKE
add_string DISSOLVE FADEIN POP

# These are the containers and keys that perform a definition
add_define AttitudeInfo Type
add_define BonusArtInfo Type
add_define BonusInfo Type
add_define BuildInfo Type
add_define BuildingArtInfo Type
add_define BuildingClassInfo Type
add_define BuildingInfo Type
add_define CalendarInfo Type
add_define CivicInfo Type
add_define CivicOptionInfo Type
add_define CivilizationArtInfo Type
add_define CivilizationInfo Type
add_define ClimateInfo Type
add_define CommerceInfo Type
add_define CorporationInfo Type
add_define DenialInfo Type
add_define DiplomacyInfo Type
add_define DomainInfo Type
add_define EffectTypes EffectType
add_define EmphasizeInfo Type
add_define EntityEventInfo Type
add_define EraInfo Type
add_define EspionageMissionInfo Type
add_define EventInfo Type
add_define EventTriggerInfo Type
add_define Fader Name
add_define FeatureArtInfo Type
add_define FeatureInfo Type
add_define FormationInfo Type
add_define GameOptionInfo Type
add_define GoodyInfo Type
add_define HandicapInfo Type
add_define HurryInfo Type
add_define ImprovementArtInfo Type
add_define ImprovementInfo Type
add_define InterfaceArtInfo Type
add_define InvisibleInfo Type
add_define LeaderheadArtInfo Type
add_define LeaderHeadInfo Type
add_define LoadTypes LoadType
add_define MemoryInfo Type
add_define MiscArtInfo Type
add_define MissionInfo Type
add_define MonthInfo Type
add_define MovieArtInfo Type
add_define MPOptionInfo Type
add_define PathEntry Operator
add_define PlayerColorInfo Type
add_define PositionTypes PositionType
add_define ProcessInfo Type
add_define ProjectInfo Type
add_define PromotionInfo Type
add_define ReligionInfo Type
add_define RouteInfo Type
add_define SeasonInfo Type
add_define SlideShowInfos TransitionType
add_define SoundData SoundID
add_define SpaceShipInfo InfoType
add_define SpecialBuildingInfo Type
add_define SpecialistInfo Type
add_define SpecialUnitInfo Type
add_define TechInfo Type
add_define TerrainArtInfo Type
add_define TerrainInfo Type
add_define TEXT Tag
add_define TraitInfo Type
add_define TurnTimerInfo Type
add_define UnitAIInfo Type
add_define UnitArtInfo Type
add_define UnitArtStyleTypeInfo Type
add_define UnitClassInfo Type
add_define UnitCombatInfo Type
add_define UnitFormation FormationType
add_define UnitInfo Type
add_define VictoryInfo Type
add_define VoteInfo Type
add_define VoteSourceInfo Type


Interestingly, when I try to change the text, add_directory charlmagne "$install_dir/beyond the sword/mods/World 2010" into add_directory world 2010 "$install_dir/beyond the sword/mods/World 2010", just because my mod is not called "Charlmagne," I get some sort of error I can't quite understand.

Finally, because I'm utterly tired of waiting around not knowing whether or not I simply made a stupid mistake, I enclosed a copy of my problem files.
 

Attachments

  • Technologies.zip
    7.6 KB · Views: 136
For you as a beginner: Right :goodjob:.

There are some problems with that pseudo code, which you can't know.
Complelty right would be this:
PHP:
    (loopCity, iter) = pPlayer.firstCity(False)
    while (loopCity):
            if not loopCity.isNone():
                loopCity.changeExtraHappiness(+1) 
	    (loopCity, iter) = pPlayer.nextCity(iter, False)
This code looks like PyHelprs.getCityList :)

I can explain the difference if needed, but atm i'm to lazy :D.
User with 9.56 Posts Per Day can`t be lazy :)

Needed.
 
Maybe change world 2010 to "world 2010".
The space in the name might cause some problems which are caught by the "".

Do you mean the instance of the phrase right after "add directory," the instance in the directory title itself, or both? Renaming it with quotation marks in the former case seems to have allowed it to check the mod again without error, but it still doesn't detect the error in the mod itself.

New question: I want to upload the whole of my mod files for anybody who wants to take a look at them, but the mod's too big for an attachment here, though by mod standards it's rather small at the moment. Where should I post it?
 
Either I'm doing something terribly wrong with Civchecker, or it isn't good enough to find what's wrong with my mod. Here's the configuration, in my attempt to check my "World 2010" mod:

Code:
# If you want to run this on a mod, uncomment the next line and make
# sure the path points to your mod.
 add_directory charlmagne "$install_dir/beyond the sword/mods/World 2010"

That's actually supposed to point to your assets folder. ;)
Code:
add_directory charlmagne "$install_dir/beyond the sword/mods/World 2010/[COLOR="Red"]assets[/COLOR]"
 
This code looks like PyHelprs.getCityList :)

Oh, didn't know this, interesting.

User with 9.56 Posts Per Day can`t be lazy :)

Needed.

:D, okay:
The problem is, that destroyed instances are not deleted from the list of cities (also units, and probably some things else).
Example: You have 3 cities, the cities #1, #2 and #3.
The enemy captures city #2.
player.getNumCities() will now return 2, because you have the cities #1 and #3, but if you take a normal loop over the cities, you'll check city #1 and #2 (which is not more existent for you), and you will not reach #3.

Do you mean the instance of the phrase right after "add directory," the instance in the directory title itself, or both? Renaming it with quotation marks in the former case seems to have allowed it to check the mod again without error, but it still doesn't detect the error in the mod itself.

I meant the first, but i guess NotSoGood has revealed the real problem.

New question: I want to upload the whole of my mod files for anybody who wants to take a look at them, but the mod's too big for an attachment here, though by mod standards it's rather small at the moment. Where should I post it?

You could create an account at WePlayCiv, or upload it to Rapidshare, FileFront, AtomicGamer, Megaupload or other filehosting sites.
 
Thanks for the info about the "assets" thing, but still no revelation of errors, unless you can pick them out of this result:
Spoiler :
Edit C:/Users/Tom/Downloads/civcheck-latest/civcheck.config and then use File=>Run
Status: loaded 5045 art files from cache, 0 duplicate
Status: total art load time 0 seconds
SUMMARY: 0 missing art files
SUMMARY: 0 undefined symbols found
SUMMARY: 0 symbols defined
SUMMARY: 0 unreferenced symbols found
Status: Results written to C:/Users/Tom/Downloads/civcheck-latest/civcheck.txt



I will upload the mod, but can anyone here really take a look at it, please? You will be credited in the credits--if it ever gets done.
 
Top Bottom