Python (civ4 scripting language) tutorial thread

I dont know if im posting this in the right thread, but I need some assistance.

I have downloaded so many mods, yet only about at third of them work. I have installed them exactly as instructed. The game begins to restart when i go to load the mod, but about half way through starting up I get various error messages and it shuts down.

Can someone please help?

Thanks
Netrom
 
Thank you very much for this tutorial Gingerbread Man!! Thanks to you I have written my first Python program. Its been over twenty years since I have dabbled in programming (very simple BASIC programs in high school). Thanks to you I have finally taken my first step into Python programing. It was both easier and more difficult than I had imagined. The simple program below took me hours to write. And I couldn't do everything I had wanted to do with it.

But I had fun and look forward to learning more.
yltype.gif


Knock Knock... v2
Spoiler :
tyv2.jpg
hmmm The program runs as intended from the GUI.
But from Command Line it exits before displaying the final print line??
 
I'll have a go although I'm a bit older than most/all of you. Started my IT career in 78. Mostly RPG (no, not role playing games) and don't regard HTML as a language at all 'cos it's too easy. Mostly HLL so Python will be a learning experience.
 
I tried the first one, but encountered a problem. When you say to type 'python -V' on the command line, I do that and get this message:
Code:
NameError: name 'python' is not defined
 
Whats everyone in for?

Is this a gang? :D

I done a year or so of C, then C++. Little bit of basic, and cobal. Touch of mark up.

Never tried this though...

Edit: Looked at the python, looks quite nice high level to me! So.. where are the lessons about actually starting to learn how to MOD... (not code!) ;p
 
I am serious distress here. I don't know where to start with this (XML or Python?) I am trying to make each of my civs have their own tech trees. Each with it's own techs and requirements. What kind of python would I use or do I need to work this into XML? (or SDK- don't have any knowledge of SDK at all).
 
both xml will allow you to say what it does or is and python will effect how the tech,civ,civic,ect. will work as for sdk i don't know(idk) and don't forget about c++(i still don't know about that)
 
HEy I figured it out. All i have to do is merge a mod by classic thuinder that does exactly this using python. Then all I have to do is specify which chanel each civ can research in.

Thanks! :)
 
um... it says "name 'python' is not defined"...

edit: everything else is working fine, it just doesn't know what 'python' is
 
Netrom, you are in fact in the wrong place, this is a very old sticky about python modding (predating Civ IV) but to answer your question, do you have BtS with the latest patch, 3.17? If your mods are for another version they may crash. I got a new computer, installed a big 1 gigabyte mod and spent a month making a mod of my own, then
1. the mod I downloaded (New Destiny) crashed
2. I uploaded my mod and realized I had not patched my new computer to 3.17 and had made a mod for a version that was obsolete.

Leoncalvin definitely XML. Start out like this. Make a folder called MyMod. Inside it make another folder called Assets and inside that make another one called XML. Now explore into the program files/Civilization/BeyondTheSword/Mods. Put your folder there. Now, go out to ProgramFiles/Civ/BtS/Assets/XML. You should see Art, Units, GameInfo, Terrain stuff like that. Whatever you want to change, copy it and paste it into an identical directory structure in your own mod, the folder you made in step one. Say you want to increase the combat strength of the basic tank from 28 to 30.

Make a folder called Units in .../MyMod/Assets/XML. Into ProgramFiles/CivilizationIV/BeyondTheSword/Mods/MyMod/Assets/XML/Units copy the file UnitInfos.xml from ProgramFiles/CivilizationIV/BeyondTheSword/Assets/XML/Units. Now, open your UnitInfos with WordPad. Now use the search, looking for UNIT_TANK until you get to the actual part that talks about the tank rather than something indented about things upgrading to tank or something.
Now search, looking for iCombat. This takes you to a "tag," which is a line in XML.

<iCombat>28</iCombat>. The / in front of the second iteration of "iCombat" means the tag is ending. (A slash at the other end, without both bookends, means a tag about a null value.) What matters here is what is in between the book ends, namely the number "28." By changing this to 30 you make the basic Tank more powerful. Save this changed document. Now start Civ and Single Player/Play Now go to Advanced/Load Mod. Select "MyMod." Now you are playing a little mod with Shermans retrofitted with the 105. I think they called it the Pershing.

That's basically how it works. Learning to mod XML is basicallly learning what stuff is and where it is.
 
I'm going take another crack at it.

I know a bit of TI-BASIC and HTML, but...

Let's see.
 
Would a Summer Class like this, Game Design, help with modding in Civ IV?
 
Seems like the most fitting thread for my question:

I'm pretty sure that there's a thread somewhere in which people posted new selection sounds based on existing languages but I can't find it, even using the research tool... Can somebody point me to it, please? :)
 
Back
Top Bottom