Help with Techs

Lokolus

Retired...
Joined
Jul 10, 2007
Messages
761
Location
Israel
Can anyone help me? I want to make techs that whoever founds them first will recieve a multiple number of units, example: If I'm the first to research Astronomy I will recieve a galleon, a musketman, a cuirassier and a settler in my capital.
Currently I only know how to make it so you get 1 unit (like in the Economics great merchant).
If anyone could help me it will be great and you'll get a credit in my next "North American Colonization" scenario.
 
I dont think you can except with python.
 
No, GPs are given from techs, not in unitinfo. In techs units are given in singular.
 
No, GPs are given from techs, not in unitinfo. In techs units are given in singular.

That is the problem, I want several units to be gifted...
 
Then you would need python. I don't know how to do it in Python.
 
Hmm.

Try this: take the FreeUnit code line and copy it multiple times (5?) in each tech. Then change the unit names from NONE to UNIT_CUIRASSIER or whatever. It may work.
 
Already tried it, it crashes to desktop...
Can anyone code it in python?
 
You could modify the onTechAcquired event in CvEventManager.py, but have you considered using the BTS events system? You can trigger an event with the discovery of a tech and the event can gift free units. It looks like you can achieve this in XML alone.
 
I checked the documentation on events and you still need a little bit of Python, because the Events XML only allows for free units of the same unitclass. I still think you should make it as an event and use the PythonCallBack tag to call a new function, which gifts the group of units you have in mind.
 
There is no python yet, I don't need a single event but a feature that will make multiple units recieving possible when you are the first to discover the tech.
It's techs that I made my self so It's not really that simple, example: if you research "BRITISH_COLONIAL_AID" you will recieve 3 UNITCLASS_RIFLEMAN (redcoats) 2 UNITCLASS_GALLEON, 1 UNITCLASS_CUIRASSIER and 2 settlers.
If you research "DANISH_WINTER_SUPPLIES" you might recieve 2 UNITCLASS_GRENADIER, 2 workers, a UNITCLASS_FIRGATE and a UNITCLASS_GALLEON.
As you can see, some techs will be civ-specific.
I also try to make it with events (which is very complicated because I need to make an event for each tech.)
If you can it will be even better that everyone that researchs that tech will get the units and not just the first one.
 
The python is pretty straight forward. In onTechAcquired there is just something like:
if (tech == A):
iX = pCarthage.getCapitalCity().getX()
iY = pCarthage.getCapitalCity().getY()
pPlayer.initUnit(self.iPraesidiumMercennariumID, iX, iY, UnitAITypes.UNITAI_PILLAGE)
pPlayer.initUnit(self.iPraesidiumMercennariumID, iX, iY, UnitAITypes.UNITAI_ATTACK)
elif (tech == B):
....

I'll need a complete list, and also the mod so I can test the code out some.

It's more complicated to make it only fire for the 1st civ, all is easiest ;)
 
Well, I will give you the mod. but I won't make it today and I'm not going to be here for the next 4 days.
So it will be in less than a week but not tommorow\today.
 
Back
Top Bottom