Changing starting loactions

FatWalker

Chieftain
Joined
Jan 25, 2005
Messages
24
I want to create a mod where you start with a transport och some units in it. I have figured out how to start the game with the wanted units, but right now the transport starts on land, which looks a little bit silly...

And can I make all units start on the same square, instead of spreadout, as they usually are?

Thankful for help, im quite new to this, but want to see if I can make a small mod for me that is fun to play.

Some complications:
- I am still using warlords, as I do not own BtS
- I have like no experience of python, which i presume is where this has to be changed (it cannot be done in xml?)
 
What you aim to do is not so simple :

To make start units on the same you have to put or change in the map script :
Code:
def startHumansOnSameTile():
	return True

The problem is that even if the units will start on the same tile, they will not be on the transport. Except trying to change that with python, a SDK cahnge would be the best. Or just spawn the transport with xml and fill it at the start of the game.

For the starting locations. This is more difficult and need some different changes because map scripts uses different methods. You have to change either the SDK, CvMapGeneratorUtil.py or the map script. you can directky change map script to be sure all players will start on water.

But without python skill, this is not an easy project to begin with I think.

Tcho !
 
Thanks for the answer.

First stupid question:
To input the above code to make all start on the same tile, I have to put a copy of the map script in the mod folder, as I do with XML files that i change?


Spawning the units on land with a transport next to them would also be an option (even if not as fun, but still better then nothing). However, when I tell the XML file to start the game with a transport, it treats it as a land unit and spawns it on land. How do I hcange this, so that the transport spawns on sea (or ocean) tiles?
 
First stupid question:
To input the above code to make all start on the same tile, I have to put a copy of the map script in the mod folder, as I do with XML files that i change?

You can do that but I think you need to specify that in the .ini and create a folder for public maps but not sure it has the same name. If this is just for you you can let the script in public map, but make a back up of the script you change.

Spawning the units on land with a transport next to them would also be an option (even if not as fun, but still better then nothing)
I think the AI will settle where it begin. And I'm not sure of how the AI will react if it start with a settler in a boat. I don't understand what you try to do . If you start near land, what the purpose of having the setler in a boat ?

However, when I tell the XML file to start the game with a transport, it treats it as a land unit and spawns it on land. How do I hcange this, so that the transport spawns on sea (or ocean) tiles?

The function place the units on the starting location, regardless of the domain of the unit. to change that you have 2 choices :

_ rewrite the function in the sdk . (really not easy)
_ rewrite the starting locations in the map script to put all players in water, and just spawn the transport then fill the transport with units at the start of the game. (not easy even with python skill)

Now, if what you want is just to have a transport with the units on land. You can try Full of Resources. And add coastal start and a transport unit for each player. The transport will be placed in water with my script. But I'm not sure that starting on land with a transport will do what you want.

Tcho !
 
I think the AI will settle where it begin. And I'm not sure of how the AI will react if it start with a settler in a boat. I don't understand what you try to do . If you start near land, what the purpose of having the setler in a boat ?

My plan was to be able to go exploring with the boat first, before you unload all the troops. So that you can choose your landing spot, instead of being "forced" into one. But starting on coast with a boat is almost as good.



The function place the units on the starting location, regardless of the domain of the unit. to change that you have 2 choices :

_ rewrite the function in the sdk . (really not easy)
_ rewrite the starting locations in the map script to put all players in water, and just spawn the transport then fill the transport with units at the start of the game. (not easy even with python skill)

Sound hard and sounds hard. Not that I am afraid of work, but I think I would need excessive walkthrough, which i doubt anybody wants to give.

Now, if what you want is just to have a transport with the units on land. You can try Full of Resources. And add coastal start and a transport unit for each player. The transport will be placed in water with my script. But I'm not sure that starting on land with a transport will do what you want.

Full of resources sounds nice, I will give it a try!

Thanks!
 
Full of Resources was really nice, did a couple of things I wanted to change! Thanks!

If I later know exactly what I would like to change, could I be so rude and ask for a scripts that does only change those specific things, and not gives any other options? I do not know if that is much work, or if it just is copy and paste from the main script. :)
 
Full of Resources was really nice, did a couple of things I wanted to change! Thanks!

If I later know exactly what I would like to change, could I be so rude and ask for a scripts that does only change those specific things, and not gives any other options? I do not know if that is much work, or if it just is copy and paste from the main script. :)

Since this a qualitative function, this is always a lot of works. Only place a transport unit in water then fill it is a few SDK change. But place starting locations in water so players have a good chance to settle at different places, this is another world. The map script must have a lots of water. And there is still the mystery of how the AI players will react.

Tcho !
 
Ok, I understand that. I will drop the idea of starting in water, and be happy that I can start with a transport :)

If I remember correctly you can change the minimum starting distance to other players in the XML files. Can you also change the maximum distance? I would it be possible to have all players start near eachother? Well actuelly I would only like to have some players start near eachotehr, and the rest far away, but I guess that is not easily fixable.

Sorry for asking things I could look up myself, but I do not have civ on the same computer as I have internet (im using an internetcafe, because I am away from home).
 
If I remember correctly you can change the minimum starting distance to other players in the XML files. Can you also change the maximum distance? I would it be possible to have all players start near eachother? Well actuelly I would only like to have some players start near eachotehr, and the rest far away, but I guess that is not easily fixable.

The "default" process place players in an order defined by the difficulty. The minimum start distance (may be affected by the map script) is for the first pass. It place players till there is no more place with minimal start distance, then place others. This is for this reason that with default map script you can end up at pole or in a 2tiles island if you choose more players for a small map. But there is no maximal start dsitance, and even if there would have one it should not do what you want.

I think you should try to make your own starting location placement with any default map script. When you will achieve that, you should be able to do the same thing with water. But it is not an easy task.

Tcho !
 
Any tips on how I can get started with that? (like forum threads) =)

I'm afraid I don't have one in mind. You should start to learn (civIV) python. And take default map script that do it's own assignStartingPlots to have an example (don't remember a default map script that do it's own impl) . Then try to change it like you want. Do not hesitate when you'll begin to post your code if you're stuck.

Tcho !
 
I have looked into it a little, read some guides and looked at some code, but not starting experimenting with civ4 python yet. I am still a little confused and cannto "read" the civ4 py files that I have looked into. Can you give me a tip on what the command for player starting location are? I have only seen alot of code for where resources, hills etc are, but not players or units.

But its going forward atleast :)
 
an example :

Code:
def assignStartingPlots() :

        # Do some code to choose start locs
        # where you define listPlayer and the list startPlot = [(15,13), (27,34), ...]
        
        for iPlayer in listPlayer :
                iX, iY = startPlot[iPlayer]
                startPlot = CyMap().plot(iX, iY)
                startPlot.setStartingPlot(True)
                gc.getPlayer(iPlayer).setStartingPlot(startPlot, True)

I strongly advise you to begin by solving the other problems before beginning a huge function to choose start locs in water.

Do a simple function that choose a water plot for each player. Change the xml to have only a transport placed. Do the function to fill the transport with the settler and an unit at the beginning of the game. And check if the game start correctly. Then if all is right and the AI react correctly, you can start to make a real assign plot functions wich is the more difficult.

Tcho !
 
Back
Top Bottom