If is it possible...

hrochland

Prince
Joined
Apr 9, 2006
Messages
2,512
Location
Czech Kingdom
Good day...
I have in my mod one improvement, which abound in game and I have idea make more form of this improvement.

Is possible write code which choose in order that game place after improvement build
improvement_x_1 (model 1)
after improvement_x_2 (model 2)
after
after improvement_x_3 (model 3)
and all the time in this cycele?

It is possible
Can somebody write it for me?
Please :please: :help:
 
I keep in mind more models for one improvement type to doesn't look like all the same. Exist for it some code, please?
 
You can try to add that to CvEventManager by changing onImprovementBuilt . Define a test for each improvement if you want ( just copy paste ). Note this is just a test to check how automate workers will act . The model is chosen at random ... we can check later if that's work .

Code:
def onImprovementBuilt(self, argsList):
        'Improvement Built'
        iImprovement, iX, iY = argsList

        # create n improvements : IMPROVEMENT_FARM1 ,IMPROVEMENT_FARM2 , IMPROVEMENT_FARM3 , ... in CIV4ImprovementInfos.xml
        # with the same attributes of farm but with different graphics
        if iImprovement == gc.getInfoTypeForString("IMPROVEMENT_FARM") :
                # create a list with the improvement's model
                improvementList = ["IMPROVEMENT_FARM1", "IMPROVEMENT_FARM2", "IMPROVEMENT_FARM3"]

                # convert type strings to integer :
                improvementList = [ gc.getInfoTypeForString(item) for item in improvementList ]

                # choose at random the model :
                iModel = CyGame().getSorenRandNum(len(improvementList), "Bob")

                # assign the plot improvement :
                CyMap().plot(iX, iY).setImprovementType(improvementList[iModel])


        ## make the same for any other improvement
                
        if (not self.__LOG_IMPROVEMENT):
                return
        CvUtil.pyPrint('Improvement %s was built at %d, %d'
                %(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))

Tcho !
 
Damn!!
Now I have work for a one month :crazyeye:
Thanks, Sto. I have great (big) eyes. You are too good and quick :)
I'm enjoying as far as I manage it all :crazyeye:
In last weeks I was accorded more help than in last two years :crazyeye:
Thanks you very much. Owing to your help I have much much work now :)
 
This is just a test . i really don't know if automated workers will replace the improvements changed . Try to check that only with farms ( or anyone ) before doing a long stuff . If this don't work , i think that would requires a lots of SDK

Tcho !
 
OK. Thank you very much. Now I need a few days for ingame test and many hours of modeling. It all sounds good. Filling some of my plans is approaching, I think. :)
 
To make a test just assign farm1 to plantation model , farm2 to mine model , farm3 to workshop model and you will be able to test a game without modeling anything and test if all works . When you pass the mouse over an improvement it should give you farm in the description . That can save you hours of modeling .

Tcho !
 
I believe that it will be functional. I thank you for your advice I will take your advice. Unfortunately I have time for modding one two hours in night. that's why it take me number of days :)
As I wrote to Seven05:
I hope will you be here when I come back :hatsoff:
thanks
HROCHland
 
@ Sto
at Christmas I tested your idea. Here is problem. If I used your code so I must in xml write more improvements of same type and after system want event BUILD for everyone improvement.

Is here possibility call directly ART_DEF_IMPROVEMENT_x - y and no IMPROVEMENT_x - y ?
 
@ Sto
at Christmas I tested your idea. Here is problem. If I used your code so I must in xml write more improvements of same type and after system want event BUILD for everyone improvement.

Have you really tested it ? I've done a test like described below , and i get no problems with build infos. The only problem i got is that if multiple workers works on the same plot , if one finish , the improvement change so others continue to work . And i don't know what will happen with automated workers later . That's why that need some tests if you want to check how workers will act .

Is here possibility call directly ART_DEF_IMPROVEMENT_x - y and no IMPROVEMENT_x - y ?

... probably not with simply python .

Tcho !
 
maybe I misunderstood you. You wrote:

... in CIV4ImprovementInfos.xml (as regards IMPROVEMENT_FARM1 ,IMPROVEMENT_FARM2 etc)

I make IMPROVEMENT_HRAD1 ,IMPROVEMENT_HRAD2 etc in XML and pasted your Python code and here was problem with BUILD order for workers in buildInfos.xml

I will test it again with farms as you wrote
(maybe I made error with python??? :( )
 
maybe I misunderstood you. You wrote:

... in CIV4ImprovementInfos.xml (as regards IMPROVEMENT_FARM1 ,IMPROVEMENT_FARM2 etc)

I make IMPROVEMENT_HRAD1 ,IMPROVEMENT_HRAD2 etc in XML and pasted your Python code and here was problem with BUILD order for workers in buildInfos.xml

I will test it again with farms as you wrote
(maybe I made error with python??? :( )

Do not forget to let the original improvement (FARM) in the xml . Then copy paste the xml for farm any times you want and just change the Type and the art ( i've made a test with plantation,mine,cottage art with farm and got no problems ... with IMPROVEMENT_FARM (original) ,IMPROVEMENT_FARM1 (plantation artand other xml values like farm) , .... )

Tcho !

EDIT : if you get the error again , please post the files and the error .
 
Hi, all :)
I need a little help because I´m not coder. :(

Sto for me wrote above-mentioned code what work fine. Is here one problem only.

When I have three form of IMPROVEMENT_SEAFACTORY (for example), with this solve game randomly change models for Seafactory. It is OK but in civilopedia I have Seafactory three times. (In techbutton in techtree too)

Is possible solve this problem so that I will have three changed models but one civpedia entry for Seafactory only?

Thanks for help
HROCHland

(sorry for my very simple English)
 
You can try to put the tag isGraphicalOnly in the xml and make a test (that will work for the pedia). I've sseen nothing in the sdk that can prevent that to work. But i've not checked all the SDK (just the basic functions).

I this not work that will requires to change two py pedia files.

Tcho !
 
You can try to put the tag isGraphicalOnly in the xml and make a test (that will work for the pedia). I've sseen nothing in the sdk that can prevent that to work. But i've not checked all the SDK (just the basic functions).

I this not work that will requires to change two py pedia files.

Tcho !

Thank you very much, Sto
I will try modified "isGraphicalOnly" tag
thanks
HROCHland
 
Back
Top Bottom