View Full Version : Help with Techs
Lokolus Aug 07, 2008, 04:26 AM 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.
Ajidica Aug 07, 2008, 10:44 AM I dont think you can except with python.
NikNaks Aug 07, 2008, 11:23 AM I'd imagine it would be similar to how free GP are awarded for the first to discover. I'm guessing it might be in the UnitInfos file if it's not with each Tech.
Ajidica Aug 07, 2008, 12:18 PM No, GPs are given from techs, not in unitinfo. In techs units are given in singular.
Lokolus Aug 08, 2008, 06:56 AM 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...
Ajidica Aug 08, 2008, 10:18 AM Then you would need python. I don't know how to do it in Python.
Lokolus Aug 08, 2008, 04:18 PM I also don't know, that is why I'm asking it here...
Gooblah Aug 08, 2008, 04:46 PM 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.
Lokolus Aug 09, 2008, 03:37 AM Already tried it, it crashes to desktop...
Can anyone code it in python?
Fierabras Aug 09, 2008, 06:19 AM 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.
Lokolus Aug 09, 2008, 07:18 AM I'll try that.
Fierabras Aug 09, 2008, 08:31 AM 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.
primordial stew Aug 09, 2008, 03:09 PM I can whip it out :eek:
I take it this is for BtS. Is there any other python for this scenario yet?
What is the list of units and techs?
Lokolus Aug 09, 2008, 04:18 PM 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.
primordial stew Aug 09, 2008, 05:50 PM 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 ;)
Lokolus Aug 10, 2008, 03:53 AM 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.
|
|