Simple Python Things

Just checked it, there's no possibility to define a X and Y in any of the events files, so that would still need Python.


Some thoughts about the mod component: Obviously you'd need to define a civ, a round to spawn, the type and number of units and the location.
In case no location is given, I'd make them spawn in the capital.
Else I guess peace and open borders have to be respected, as well as spawning within enemy stacks or cities (in that case a test for neighbouring plots would be needed; if all fail, then no units are spawned).
I'd not care about the terrain. If you want units in water or on a peak, then it's your decision :D.
Did I forget anything?

Promotions, just for the sake of having them :p
 
Just one request: Is there some way to combine the two together? So you have to build a project AND the other two (or X) civs are dead?

Made the needed changes, take a look at the attachement.
Not sure if the victory screen is okay in this way, but could be changed if you want it.

Unit spawning might come on Sunday or Monday, depending on my time (not earlier, because there's lots of garden work to do on Saturday, and since my father wants to start early, I also can't do anything on Friday evening/night).
 

Attachments

I wrote it somewhere for him and never bother to keep a copy :D
Anyway, should be just 5 mins of typing for you with your capabilities.

1) Units in water is not as bad as naval units on land.
IIRC, naval units on land crash my game before.
So for naval units, you definitely need a check for terrain/coastal cities.
2) If the spawned units are barbarians, then a check for Great Wall as well, else they will be pushed out and disturb others instead.
 
Anyway, should be just 5 mins of typing for you with your capabilities.

And one hour of debugging, or so *sigh* (I think I already said it: I'm not really a good programmer).

Had not thought of what you mentioned, so thanks :hatsoff:.
 
You said it to me :lol:. I think you are very good programmer :D
 
Unit spawning might come on Sunday or Monday, depending on my time (not earlier, because there's lots of garden work to do on Saturday, and since my father wants to start early, I also can't do anything on Friday evening/night).

Might have guessed it, I need a day more.
Wasted quite some time today on a search to find the mods name via Python. Apparently there isn't (no surprise, else other people would use that). Seems the Civ4 Python interpreter relocates all modded files into the BtS directory. Means BtS claims that my file BtS\Mods\SpawnUnits\Assets\Python\SpawnUnitUtil is in the BtS\Assets\Python folder. Guess such a hack was necessary to make the whole mod loading system work, but for this part here it's annoying :/.

Else, the basics are already working, but haven't built in any of the necessary checks yet, so that and testing is for tomorrow.
 
Might have guessed it, I need a day more.
Wasted quite some time today on a search to find the mods name via Python. Apparently there isn't (no surprise, else other people would use that). Seems the Civ4 Python interpreter relocates all modded files into the BtS directory. Means BtS claims that my file BtS\Mods\SpawnUnits\Assets\Python\SpawnUnitUtil is in the BtS\Assets\Python folder. Guess such a hack was necessary to make the whole mod loading system work, but for this part here it's annoying :/.

Else, the basics are already working, but haven't built in any of the necessary checks yet, so that and testing is for tomorrow.

No rush. :thumbsup:
 
why do you want the mod name? :p probably some way to do it, even if it means adding a comment to the top of every modded file saying #modname
 

:)
But I also want to get it done.
If something takes longer (no matter due to what reason; like e.g. the events I made), then it's also not much fun.

why do you want the mod name? :p probably some way to do it, even if it means adding a comment to the top of every modded file saying #modname

Didn't find a way :dunno:.
The "problem" is that I load in some mod comps data from additional files (mostly pseudo XML files), and to open them, I have to mention the path somewhere. Means the name of the mod folder is there in the Python files. Would be easier for merging if the name of the folder could be determined automatically, without that the modder has to change it.
That's what I tried, and that's where I failed :dunno:.
 
Okay, it's here :).

Spoiler :

spawnunit_O8m.jpg


I think I took care of everything which could happen. If not, then let me know.
 
1 thing though, because when all plots tested are invalid, the units are forced to spawn at capital without additional checks.
Thus, naval units can still spawn in non-coastal capitals.

And if you want to add checks for planes, you have to consider missiles as well.
Although, beside forts and cities, they can spawn directly on their transports as well, which I will conveniently ignore to make it simple :D

Spawning on enemy units does not "kill" the units if i remember from my previous experiments. The enemy units will just be pushed to nearest available plot.
Thus, this check may not be so important since you have to loop through every unit on each plot you are testing.
Also, there are instances where your units and enemies can still be on same plot together, due to invisible units and spies.
 
Only thing I could think of is to make sure that planes were on cities or forts. Otherwise nice work:goodjob:

And if you want to add checks for planes, you have to consider missiles as well.
Although, beside forts and cities, they can spawn directly on their transports as well, which I will conveniently ignore to make it simple :D

I wanted to ignore that part totally :mischief:.
But okay, since I have to make some adjustments...:)

1 thing though, because when all plots tested are invalid, the units are forced to spawn at capital without additional checks.
Thus, naval units can still spawn in non-coastal capitals.

Oh damn...valid point.

Spawning on enemy units does not "kill" the units if i remember from my previous experiments. The enemy units will just be pushed to nearest available plot.
Thus, this check may not be so important since you have to loop through every unit on each plot you are testing.
Also, there are instances where your units and enemies can still be on same plot together, due to invisible units and spies.

:think: *scratchesHead* mmhh...that might need some tests.
But good idea :yup:.
 
Utter :mad:.
Fixed the problem. I think.
Discovered some major other problems. Fixed one too, but the other one is giving me headeaches.
The small part of optimization (which kicks out after loading every invalid spawn event for the map) does not work correctly and eliminates way too many events. Haven't fixed that yet, because I have not yet ofund out what exactly the problem is (okay, spotted different problems, but it's still broken).
:mad:
Will fix that tomorrow. Hopefully.
:gripe:
 
Back
Top Bottom