View Full Version : please i need help
cromcrom Jul 21, 2007, 01:44 AM I would like to create a mod.
All I need know is a bit of python scripting, i tried but can't do anything :cry:
So please what I would like is this.
Each time a tech is researched, another one in the list of all techs (all will be available from start) is put aside RANDOMLY, and can't be researched by that player anymore.
Could anybody do that for me, and explain how to use it in a mod ?
This bit of code is VERY IMPORTANT to me, I tried hard to figure out myself, but can't....
I will do with all other stuff (XML...) But I need this very bit of python.
Thanks in advance.....
frenchman Jul 21, 2007, 11:38 PM I would like to create a mod.
All I need know is a bit of python scripting, i tried but can't do anything :cry:
So please what I would like is this.
Each time a tech is researched, another one in the list of all techs (all will be available from start) is put aside RANDOMLY, and can't be researched by that player anymore.
Could anybody do that for me, and explain how to use it in a mod ?
This bit of code is VERY IMPORTANT to me, I tried hard to figure out myself, but can't....
I will do with all other stuff (XML...) But I need this very bit of python.
Thanks in advance.....
*
Hello Cromcrom,
I don't know how to do that with Python but I think the game could not work with the option you described...
:)
cromcrom Jul 21, 2007, 11:59 PM Ok, this is a mod, I a not talking about regular CIV game.
All Techs will be redone, and roughly up to gunpowder techs.
This mod won't be about having all civs feel the same in the end, but all being very different in the end, for exemple, you could discover "basic navigation", "advanced navigation", "iron working" and "plundering", and imagine a viking-like civilisation, or "masonry", "blood religion", "astronomy", "theocracy", and pretend you have an aztec like civilisation. And you would sometimes have to adapt to the a tech not being accessible anymore, stealing it from another civ.
My Mod won't be a run to advanced tech, but a run to various techs.
Everybody will start with exactly the same basic civ, choose whatever leader, and build their "civ", trying to adapt to their environment, enemies... Through that random tech stuff, NO CIV will be alike in the end.
The list of techs you can imagine is huge, of course, and could include, why not, fantasy elements....
Please again, my vision is so strong, I really need this little bit of code, and to know how to implement it. I am not being lazy, I just don't figure out how to have it work.... Frenchman, if you know someone who could do yhat, could you tell him a word about my problem ?
The Flame Jul 22, 2007, 12:04 AM Sounds like you might have to go into the dll files.
to make a mod, you just have to copy the essential collaberating files (the files that make your program work) into your mods folder, then mod the script. In-game you can then load your mod.
I'm just guessing here though.
My guess is you'll haveto find the file containing tech information, then add some script creating the effect you want (randomly taking away techs). The code MIGHT look something like this:
if technology == x:
(tab) technology = y
(tab) loop = 0
elif technology == y:
(tab) technology = z
(tab) loop = 0
This wouldn't exactly randomise it, but might work. But don't take my word for it, I still kinda suck at Python.
frenchman Jul 22, 2007, 12:10 AM I understand what you want to do... But what I mean is that if "iron working" is no more allowed for me (by random if I good understood) I will never be able to update my units or to create new ones. So I will be destroyed... Imagine I have only warriors and other civs knights...
But I don't know... Just some questions...
cromcrom Jul 22, 2007, 12:45 AM to make a mod, you just have to copy the essential collaberating files (the files that make your program work) into your mods folder, then mod the script. In-game you can then load your mod.
I know, this is not my problem, my problem is that bit of python code, and how to implement it. Thanks a lot anyway for taking time to answer ^^
I will never be able to update my units or to create new ones. So I will be destroyed... Imagine I have only warriors and other civs knights...
Thanks for answering, and taking interest in this mod.
In my mod, there will be many different units. For example, you might research "forestry", because your first city is near many forests. Forestry would give you the ability to create "rangers", very strong defensive units, but only in woods.... And the price of upgraded iron armored knights (pretty unique to western civilisations (think the crusades, armored iron knights against desert camel warriors (schematizing here ^^), who won?....) would be very high. Or thoses knights could be national units, representing a kind of aristocracy, or you would need another tech or two to create them, making them quite rare in a game... And having you "run" to knights would mean some opportunities left aside. Equitation or navigation or whatever? Iron working or mathematique ? Aristocracy or herbalism (healing units)................
And yes, if at a point, you don't research any "war like" tech, you might be wiped, like many civilisations have been.... BUT there would be the possibility to steal it from other civilisations, through espionnage or city conquering or whatever ....
please all python masters around, my vision is so strong, please.... Moreover, I have been studying python quite hard, this bit of script and how to implement it would be great for me for learning.... Then I am pretty sure I will understand the stuff and be able to script myself. I am scripter on C++ on the NWN2 roleplaying game, but can't get used to python. PLEASE ^^
Quornix Jul 22, 2007, 02:23 AM The logic behind what you want to do is relatively simple -- the hard part is figuring out where you can use it. We know that somewhere in the code, there's some logic that decides which techs you can research, which is why you can't research everything at the start. You need to find this bit of code.
If you already have C++ experience, that's probably where you're going to want to do this coding. It's unlikely that there's a "set tech to researchable" bit that's exposed to Python (I'm sure someone will let you know if I'm wrong), so you'd have to either get into the SDK anyway to expose it, or you'll have to set up a more complicated set of code that does effectively the same thing.
For the record I barely register in the modding scene here, and I'm not able to direct you to where you need to go. I like your idea, although I think that an exclusion tech tag could be more interesting (researching Iron Working makes Bronze Working unavailable; Alphabet invalidates the entire tree that starts with Oral Tradition, etc.) than purely random exclusion of techs. Still, it depends on exactly how it is executed -- it's probably easier to make a balanced game your way since you don't have to predecide on the tradeoffs.
cromcrom Jul 22, 2007, 03:36 AM Exemple:
I have 4 techs: tech_1; tech_2; tech_3;tech_4.
I choose to research Tech_2.
When I am done, one of tech_1, tech_3 or tech_4 is randomly put aside.
Let's say its tech_4.
Then I can research tech_1 or tech_3.....ETC
researching Iron Working makes Bronze Working unavailable
Definitely not. maybe "BronzeWorking" would be a prerequisite for "Iron Working", but I think not. Imagine a civ that has no contact with copper, but with iron... It would directly go to Iron, although Iron units would be much more expensive...
On the other hand, imagine a civ with access to both ressources. But after researching, say, "construction", dang, "iron working" is put aside. then the player could take the risk NOT to research "copper working", or to go directly to "copper working", just to be sure. In both case, its civ will be different in the end.
A all game of choices and adaptations to your environment, enemies, etc...... So in the end, civilisations would be cefined by their techs, and their techs the result of adaptation. At the end of a game, a player could lean back and say: Look At that Civ I created, it is UNIQUE, it is mine ^^. "I stood the tests, and look what it did !!!!"
it's probably easier to make a balanced game your way since you don't have to predecide on the tradeoffs.
Yes, I am pretty sure that the game will balance itself in the long run, especially with "victory points".
The goal of the game would be to create a famous civilisation, "to stand the test of time"^^.
Ancient civilisations disappeared, but left great things behind.
Aztecs were known as a civilisation for their bloody religion, mathematiques and astronomy and mountaineering and construction skills (summarizing of course). But they had no horses, no wheel, no boats, no iron working, no gunpowder.
Again summarizing, Vikings had iron working knowledge, great seafaring, great trading, plundering, but no ecriture (or hardly, runes "only"), no construction skills....... What about a civilisation mixing things? What if a viking like civilisation, defined by its possibilities, had met a aztec like civilisation, defined by its possibilities. What if "Your_Civ" had not a bloody religion, but were a very rationnal people, or had no religion whatsoever, but instead, a basic knowledge, of, say, gunpowder ?
This is the all point of my mod, to offer a completly different game each time it is played.
I know python works through list, and there is a "on_tech_researched" event...
BUT I CAN'T FIGURE IT OUT !!!!! I NEED THAT PRECISE SCRIPT THAT WILL ALLOW ME TO BE FREE !!!!
PLEASE DELIVER ME, I KNOW THIS MOD CAN BE GREAT, BECAUSE THIS BASIC CONCEPT IS UNIQUE.
PLEASE HELP MEEEEEEEEE^^^^
snarko Jul 22, 2007, 10:18 AM If you know c++ then why don't you do this in the SDK?
I don't know how stealing techs with espionage works but I'm sure it checks if you can research the tech. If you want civs to be able to steal techs they can't research I think you'll have to do it in the SDK.
The Flame Jul 22, 2007, 12:56 PM This is just slightly off-topic, sorry, but does anyone have some good reference sites to help me learn c++? I already know quite a bit of python, but c++ sounds intriguing.
It sounds like your idea might be complicated a bit by the order of techs - it wouldn't make sense if you researched bronze working and some earlier or later teach would be forbidden. That could be quite complicated to program.
Oh and btw, I suggest that the best thing to do is to experiment a bit. Helped me alot with python :) (even though I am still inexperienced with using it :p)
cromcrom Jul 22, 2007, 01:35 PM it wouldn't make sense if you researched bronze working and some earlier or later teach would be forbidden.
No earlier or later techs, but DIFFERENT techs.
All techs would be available from start. Except for a few techs (basic navigation, advanced navigation for exemple), no tech would be left aside because another one has been put aside.
Having all techs available from start is a very simple XML stuff, I already did that.
Techs would be ranging frome stone Age to very basic gunpowder (chinese style)
Exemple of techs:
Forestry
Moutaineering
desert knowledge
Skirmishing
Bronze working
Mining
Farming
Slavery
Jewelry
Litterature
Scribing
Mathematics
Astronomy
Astrology
Alchemy
Early gunpowder
Tight formations
Headquarters.....
So you could end with a civ knowing
litterature
mining
bronze working
jewelry
Desert knowledge
astronomy
tight formations
scribing
mathematics
You could call that civ "whatever"
and another game
Moutaineering
Skirmishing
Farming
Litterature
Scribing
Astrology
Alchemy
Early gunpowder
Headquarters
making it a whole different game experience....
snipperrabbit!! Jul 22, 2007, 03:27 PM Well ... If I understand you well, you want code to only research half the tech
and disallow randomly currently researchable techs. I see a high risk to end with a cul-de-sac effect.
The Flame Jul 22, 2007, 07:45 PM Oh, I see what you mean now. It's an interesting idea, but I agree with snipperrabbit, it could have some issues. You could probably eliminate those issues though, but it would be kind of tricky.
cromcrom Jul 22, 2007, 11:32 PM Thanks in your interrest guys ....
If I understand you well, you want code to only research half the tech
not really. what is really important here is that you know what research is left aside as you go through the game, not before.
So in the preceding exemple, let's say
the first tech you research is "Forestry", because you leave near forests. Once you discover forestry, you know that "Astronomy" has been left aside. Ok.
So you decide to go for "Early gunpowder". Then you learn that "BronzeWorking" has been left aside.
You still want to have to do with minerals, so you research "Mining", only to learn that "Slavery" has been left aside............
So in the end, your civilisation will be defined as a "forest" civilisation, using very basic gunpowder and gunpowder units (firework rockets, early arquebus), and able to mine minerals, (great for trading, and bringing wealth), but having no knowledge of Astronomy, Bronzeworking or Slavery.
What you come up in the end is very Unique.
And I already think there could be like 50 or 60 techs, so imagine in the end....The sheer amount of techs will provide a basic balance.
I already started the mod (Age of Civilizations, right here on fanatics), but missing that fundamental bit of scripting, I didn't keep going....
"hey, my civ was a great seafaring plundering civilisation...."
- a bit like viking civ ?
- Yes, but mine constructed the pyramids and knew gunpowder, but it was held in check by a forest civ with a blood religion, that could heal its warriors because it knew herbalism and I didn't..... Although I tried to steal that knowledge from them...."
THIS is what I mean with this mode.....
Quornix Jul 23, 2007, 01:50 AM I think that at this point we understand what you want to do. I'm not that sure that anyone is going to do it for you.
However, I can give you a couple of places to start (in the SDK, not in Python, as I know basically nothing about Python). In CvPlayer.cpp are two functions: CvPlayer::canEverResearch and CvPlayer::canResearch.
There is also a function isCivilizationDisableTech which seems to be exposed to Python, but that is probably just a way to check to see if a give tech is disabled for a given civilization, so that won't do.
You'll probably have to write a sister function to isCivilizationDisableTech such as setCivilizationDisableTech.
The canResearch function assumes that you can research every tech, then looks for reasons why you can't, such as not having the prerequisite, or it being a disabled tech. So this function gets called regularly. It calls isCivilizationDisableTech, so being able to set that variable during the game (like when you finish researching a tech) will affect what you can research at any given time.
If you don't know how to work in the SDK, there's plenty of information on that. I didn't know either, and I didn't have much C++ experience beyond "Hello World" when I started. It's much easier to figure out what you're doing when you've got a solid base of code to work off of.
Just remember that the modding community here generally encourages people to learn how to mod if they have an idea. We've all got our own plans for what we want to do (and I wouldn't have done this much if conditional techs hadn't been interesting to me), and with BTS coming out, everyone's going to busy updating their own mods.;) You'll get a lot more help if you need to figure out what's going wrong with your code than you will if you ask for everything to be done for you.
cromcrom Jul 23, 2007, 05:26 AM Ok, thanks a lot Quornix for these great bit of advice. I didn't pay attention to the SDK so far, but will, as you give me great facts.
I do believe my concept has a great potential, and will take a look in the SDK.
Thanks again....
cromcrom Jul 28, 2007, 03:14 AM Hi again.
I am looking for
isCivilizationDisableTech
I know it is a bool from cvCivilizationInfo.
Where can I find this class (if I understand well, "cvCivilizationInfo" is a class? )
please?
snarko Jul 29, 2007, 04:32 AM You'll find all (or at least most) *info classes in CvInfos.cpp
cromcrom Jul 30, 2007, 12:43 PM ok thanks, I will have a look in the SDK then.
I started the XML / ART part of the mod. I guess I will do all this first , because although I tried, I have the greatest difficulties with the other programming stuff.
|
|