| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Prince
Join Date: Sep 2006
Posts: 392
|
Getting the ai to not build a unit
Does anyone know what, i need to put in the unitinfos.xml to have the ai not build a unit type, i'm sure this is the file i need to edit as it has all the unit attributes and unit AI types but i don't know what to put in place of the default unit AI
On a side note, does anyone know if the pirate AI also works for a land unit, with the hidden nationality, always hostile atrributes? |
|
|
|
|
|
#2 |
|
Say No 2 Net Validations
![]() ![]() |
Do you want, that nobody can build the unit?
If yes: Set iCost to -1, this disables a unit. |
|
|
|
|
|
#3 | |
|
Emperor
Join Date: Jul 2002
Location: Japan
Posts: 1,344
|
Quote:
The method to use to make the AI not build a unit depends on what kind of unit and why you want to discourage it. If you want to play as a human with a unit that the AI cannot use, why not just make a Human civilization in CivilizationInfos and give it this as a UU? If you simply want to discourage the building of a unit, you could make another unit similiar to it that is better. For example, if you have Swordsman and Legion, and you don't want the AI to build Swordsman, give Legion an icombat of 8 and Swordsman an icombat of 6, but make them otherwise identical. Last edited by Tholish; May 15, 2009 at 06:44 PM. |
|
|
|
|
|
|
#4 |
|
General Guy
Join Date: Oct 2008
Location: Los Angeles
Posts: 5,524
|
But then nobody would build swordsmen at all (8
vs 6 at an identical cost), you want to set the iPower or iAsset (preferabley the latter) higher, because then the AI will think its better, but they'll be the same/
|
|
|
|
|
|
#5 |
|
Deity
Join Date: Mar 2003
Posts: 6,296
|
Give it no UnitAIs, and fill up the NotUnitAI field with all UnitAI types for that domain, AI will never see it as a valid unit to build, as it is invalid for all roles it is looking to fill if that's the case.
iPower and iAsset will have an effect, but the AI will ignore it if it wants to fill a role and sees the unit is available and has the best stats for the job.
__________________
Do not PM me with questions about modding. I will not answer. If you want help with something, start a thread on it, or post in a related existing thread. |
|
|
|
|
|
#6 |
|
Prince
Join Date: Sep 2006
Posts: 392
|
Thanks for all the replies, basically i made a assasin unit, that becomes available with guilds (at least thats my current thinking)
The unit is going to be a national unit limited to 3, with a very good withdrawl change and attack bonus into difficult terain It's also going to be hidden nationality and always hostile I was told in the better AI forum that pirate AI does not work for land units, i don't want the AI to build this unit, as defensively it's not all that great, same str as a maceman and does not get terrain def bonus's, it relies on speed and making hit and run strikes using it high withdrawl and terrain attack bonus to ambush units before pulling back The AI is just going to build it like a normal unit, as it's a hostile unit (anyone can attack it with declaring war, like a privateer)it will likely get killed the second they leave there teritory with it, so i don't want the AI wasting money on a quite expensive unit, that it won't use effectively, thats why i was wondering if there is somthing you can put in the unit AI field that basically says don't build this |
|
|
|
|
|
#7 |
|
General Guy
Join Date: Oct 2008
Location: Los Angeles
Posts: 5,524
|
Give it a very low iAsset and iPower, then the AI will think it's worthless.
|
|
|
|
|
|
#8 |
|
Venite, videte, audite
|
Good to know.
![]() Any suggestions for a unit not to be built by barbs?
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
|
|
#9 |
|
Deity
Join Date: Mar 2003
Posts: 6,296
|
civilizationsinfos file. At the bottom of it is a list of all the units barbs and minor civs can't build/spawn as. Just add the unit there, and barbs/minors can't build or spawn as them.
__________________
Do not PM me with questions about modding. I will not answer. If you want help with something, start a thread on it, or post in a related existing thread. |
|
|
|
|
|
#10 |
|
Venite, videte, audite
|
Cool! I'll add it to my TO DO list for MOO2Civ's next patch. (Don't want Space Pirates to spawn Planetary Defense ships.)
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
|
|
#11 |
|
Deity
![]() Join Date: Apr 2006
Location: New York State
Posts: 4,859
|
If you want to guarantee that an AI won't build a unit you can disallow it in python. In CvGameUtils.py in the cannotTrain method just add something like this:
Code:
iKlingonUU = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_KLINGON_CHANG')
iKlingonUUClass = gc.getUnitInfo(iKlingonUU).getUnitClassType()
if (eUnit == iKlingonUU):
if (not gc.getPlayer(ePlayer).isHuman()):
return True
__________________
Mods: Convert Production to Espionage, FinalFronterFlat, The Road to War Ultimate Edition for BtS 3.19, Star Trek |
|
|
|
|
|
#12 |
|
Emperor
Join Date: Feb 2008
Location: MN
Posts: 1,057
|
Actually the XML tags using <Unit>NONE</Unit> works 100% of the time, without the need for Python.
__________________
|
|
|
|
|
|
#13 |
|
Deity
![]() Join Date: Apr 2006
Location: New York State
Posts: 4,859
|
I think that disallows everyone from building it (I say "I think" because many files have a <Unit> tag and I'm not sure where you're referring to). My stuff was mentioned for preventing the AI from building it while allowing humans to build it.
__________________
Mods: Convert Production to Espionage, FinalFronterFlat, The Road to War Ultimate Edition for BtS 3.19, Star Trek |
|
|
|
|
|
#14 |
|
Emperor
Join Date: Feb 2008
Location: MN
Posts: 1,057
|
I think I now understand your method. My way, when used in CivilizationInfos.xml disallows any chosen Civ to not build a unit, human or not. Your way appears to only allow the human to build a unit, which was the whole point of this thread.
![]() Thanks for the clarification.
__________________
|
|
|
|
|
|
#15 | |
|
Venite, videte, audite
|
Quote:
(I checked the barb list phungus mentioned, but it seems to list units the barbs actually do build.)
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
|
|
|
#16 |
|
General Guy
Join Date: Oct 2008
Location: Los Angeles
Posts: 5,524
|
Actually, it uses the UU system to place NONE as a unit for that particular UnitClass. That's why you will never see barb missionaries, even if they captured a city with a religion. Below that is also the buildings they cannot build (all the wonders).
|
|
|
|
|
|
#17 |
|
Venite, videte, audite
|
OK, thanks.
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
|
|
#18 | |
|
Venite, videte, audite
|
Quote:
def cannotTrain(self,argsList): pCity = argsList[0] eUnit = argsList[1] bContinue = argsList[2] bTestVisible = argsList[3] # Block out the rest return False iStarbaseI = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), "UNIT_STARBASE_I") iStarbaseII = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), "UNIT_STARBASE_II") iStarbaseIII = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), "UNIT_STARBASE_III") if (eUnit == iStarbaseI or eUnit == iStarbaseII or eUnit == iStarbaseIII): return True iRobo-Warriors = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUni tInfos(),'UNIT_ROBO_WARRIORS') iRobo-Armor = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUni tInfos(),'UNIT_ARMOR') iRobo-Battleloid = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUni tInfos(),'UNIT_BATTLELOID') if (eUnit == iRobo-Warriors or eUnit == iArmor or eUnit == iBattleloid): return True return False copying the Starbase example, but after reloading I have no interface. What's wrong?
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
|
|
|
#19 |
|
Deity
Join Date: Mar 2003
Posts: 6,296
|
Put that in code tags. It's python so whitespace matters.
__________________
Do not PM me with questions about modding. I will not answer. If you want help with something, start a thread on it, or post in a related existing thread. |
|
|
|
|
|
#20 |
|
Venite, videte, audite
|
Do you mean like this: [CODE] ... [\CODE]? (Because that still gives me no interface.
)
__________________
MOD MOO2Civ SCENARIOS 1250 BC for BtS/1250 BC for HitM 2.01/1000 BC for BtS/1000 BC for CIV Gold BtS/600 BC for BtS/600 BC for CIV Gold BtS/300 BC for BtS/300 BC for CIV Gold 5.2/50 AD for BtS/750 AD for BtS/750 AD for CIV Gold BtS/1000 AD for SevoMod/1066 AD for BtS/1066 AD for CIV Gold BtS/1066 AD for Thomas' War/1066 AD for Amra BtS/The Crusades !/The Crusades! for CIV Gold BtS/The Crusades! for Esnaz's Mod/1600 AD for CIV Gold BtS/1790 AD for CIV Gold BtS/1862 AD for CIV Gold BtS/Star Trek scenarios MAPS Amra 18 civs BtS/Random Religions 18 civs BtS/RoM 2.3 Huge Earth 18 civs/Thomas' War 2.8 Huge Earth 18 civs/HitM 2.01 Huge Earth 18 civs/GEM 5.3 Ancient 26 civs/Map pack for Chiyu's Extra mod |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Making the AI not build a unit | peter450 | Civ4 - Creation & Customization | 2 | May 15, 2009 06:54 PM |
| How to bring the AI to build specific unit? (BtS) | [WTN]Manhattan | Civ4 - Creation & Customization | 4 | Jan 27, 2009 11:34 AM |
| How does AI decide which unit to build? | wotan321 | Civ3 - Creation & Customization | 5 | Sep 24, 2005 09:29 PM |
| AI unit build queue | alpha wolf 64 | Civ3 Conquests - Requests, Fixes, & Changes | 0 | Jul 18, 2003 11:33 PM |
| Question: Is it possible to build a worker unit moving on water to build colonies? | W.i.n.t.e.r | Civ3 - Creation & Customization | 3 | Oct 17, 2002 05:12 PM |