Python Snippets

Zebra 9... I'm trying to get National Wonders to play a movie when built... I already changed the XML entries, but got nothing to show-up.... Arian then told me to change the Python Event Manager and gave me some tips... I followed them as he stated...

DISREGARD ABOVE

Okay... I got it figured out (thanks to Arian's files he posted)... the problem was as simple as a couple of tabs... the start to some of my lines weren't tabbed properly. I matched them to Arians and it made all the difference in the world... believe it or not... some mere tabbing was all that was needed.
 
If it's screens, it must be done by python. I have never added a screen, but I can duplicate the dawn of man screen and make it look different. I'll seee what I can figure out with the code I gave you.

EDIT: Arian could you post the entire file you changed? I think it might be indentation but I can't be sure until I see the file.
 
Sure. I already have the permanent interception promotion. I can make another one or two with a different name "Ground Radar" (and "Improved Ground Radar") that would reflect the fact they come from the station itself. I probably will limit the number of radar stations that can be built, for the sake of game balance.

It's a little bit more complicated than that, I'm afraid, because you can bomb Radar Stations. So it can't be based just on when they leave or return to a city.

I think what we really need is a C++ system wherein the station actively gives a Y% intercept bonus to all air units within X tiles. This would be like Civ 3, and much more useful than the promotion system, since you could conceivably make tile improvements with Radar Stations and not have them in cities alone. That's probably outside Zebra 9's main area of Python expertise, though.
 
It's a little bit more complicated than that, I'm afraid, because you can bomb Radar Stations. So it can't be based just on when they leave or return to a city.

I think what we really need is a C++ system wherein the station actively gives a Y% intercept bonus to all air units within X tiles. This would be like Civ 3, and much more useful than the promotion system, since you could conceivably make tile improvements with Radar Stations and not have them in cities alone. That's probably outside Zebra 9's main area of Python expertise, though.

Well, if you want to develop a tile-based system, more power to you. On the other hand, until something like that becomes available again, I'll be using whatever Zebra can come up with. ;)
 
Zebra:

EDIT: Arian could you post the entire file you changed? I think it might be indentation but I can't be sure until I see the file.

You were right about the indentation. I checked the code with IDLE Python editor and the error showed right up. However I didn't check if it really works because the project ISS is quite at the end of the game but I'm confident it works!! :D
I didn't know Python is so sensitive for correct indentation. Wolfshanze had the same problem with identation...

Attached is the CvEventManager.py. When I check it with IDLE, it gives indentation errors but ingame everything looks fine.

Anyway thanks for your time and effort! :goodjob:
 

Attachments

  • CvEventManager.rar
    11.8 KB · Views: 75
Well, if you want to develop a tile-based system, more power to you. On the other hand, until something like that becomes available again, I'll be using whatever Zebra can come up with. ;)

If I could do it all on my own from scratch, I wouldn't be poking around here for it. ;) Though I would like to give it a try. I am still learning my way around the SDK and it might be possible sooner or later. I had hoped that Dale would do something with it, as he's the combat genius around here... I'm more of an economy-oriented guy. :mischief:
 
Wouldn't you you just update a variable that held it's interception val every time it moved? So when it moved to another plot you would run a loop checking the adjacent plots (maybe up to 9 plots way or something like that) for cities and if it finds a city it increases it's value, and you would do the same thing with the old plot but instead removing.
 
I didn't know Python is so sensitive for correct indentation. Wolfshanze had the same problem with identation...

Python is based on indentation. If you don't use the right indentation the code will have no idea where it is spose to run. A good first step might be to read a few of the tutorials on basic python. There are some good ones at the main python site.
 
(...) And about your newest Q, yes it's possible. Is it worth it? Depends on how complex it turns out to be. I would have to write code to calculate how much should go for science and treasury (don't need culture since they don't have cities). I'll see what I can do, but I can tell this much, it isn't going to be a snippet (try MOD COMP or maybe small MOD). :goodjob::cool::king:;):):D:crazyeye::scan:

That's unfortunate. I was looking at flat/constant numbers has far as how much gold and beakers* the Civ would be able to generate (basically set by the scenario). I don't know if that makes it any easier.

(*) Spy points would also be needed.
 
Well, that is the simplest system I can think, so I'll see what I can do.

P.S. I have had your code but I haven't had the time to post it and right now I don't have, I'll try to get it up to you tomorrow.
 
I just wish the script data was multiplayer compat (or I knew a way to make MP). When I first got civ I didn't know what python was (other then a snake), all I knew was JavaScript and HTML.

Here's a little Python/Civ4 trivia:
Python is actually named after "Monty Python's Flying Circus"
 
Wheather you call it selling a unit or "renting a military group", the game mechanic is the same.

Someone updated TheLopez's Mercenaries Mod to BtS. With a little tweaking you could limit unit selling to just the capital.
 
Top Bottom