1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Series of Specialist Questions

Discussion in 'CivBE - Modding Help & Mod Creation' started by GenEngineer, Feb 19, 2016.

  1. GenEngineer

    GenEngineer Prince

    Joined:
    Aug 24, 2014
    Messages:
    456
    Hey everyone. Couple of quick question to help polish off the last rough edges on the release of a mod giving the Purity/Harmony affinity some unique buildings. I designed them all to play into Specialists rather heavily, and need some help getting all of them to work perfectly.

    1) Any advice on how to change the number of specialist slots a building has? I'm currently working with a rather ungainly LUA code that checks if a slot changing perk is present and switches to an appropriate building variant at the start of each turn, but I'm not sure ow well that plays into looking at building new buildings. (Relevant for allowing building quest options to increase the number of slots)

    2) Does anyone know how to get the "FreeSpecialists" section of the XML to work? I can see that it got broken a while back, but it would be incredibly useful if someone had found a way to reimplement it.

    3) Is it possible to have a perk decrease the unhealthiness caused by specialists? Would be useful for a building designed to make it less taxing health-wise to run a lot of specialists in a single city.

    4) Is it possible to edit the PAU perk to not include a given type of specialist? I'm worried about how well they might synergy with a specialist type I added, and would like to make it so that they don't become overpowered as possible.

    Thanks in advance for any help that you can provide, these are really the last key things before first initial release of my Distinct Affinities mod.
     
  2. Starrynite120

    Starrynite120 Prince

    Joined:
    Jul 15, 2015
    Messages:
    472
    1) Here's an example

    Code:
    
    	<Buildings>
    		<Update>
    			<Set SpecialistCount="2"/>
    			<Where BuildingClass="BUILDINGCLASS_CEL_CRADLE" SpecialistType="SPECIALIST_ARTIST"/>
    		</Update>
    	</Buildings>
    
    
    2) I would also like to know if there is an answer to this.

    3) No, the only entry I can see for that is under policies. You could edit a policy to include this instead. You could also try having specialists yield health naturally, but I'm not sure this would work.

    4) Unfortunately no. Perks are only able to change all specialists yields or none, an all or nothing deal.
     
  3. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    4) Well, it can work by removing the actual functionality and instead adding a free building for the Capital that grants bonus yields for exactly the specialists you want. Don't quite remember if there's "Free Building only in the Capital"-entry but I think there isn't, so you'd need to use lua to implement that.
     
  4. Machiavelli24

    Machiavelli24 Mod creator

    Joined:
    May 9, 2012
    Messages:
    818
    FreeSpecialists is left over unimplemented code from the civ4 days. It almost certainly won't work.

    If you need some code to handle capital only buildings, I have some that will get you most of the way there.

    For #1 it sounds like you're removing buildings with specialist slots. This is something you have to be careful with. You'll need to remove the specialists from the building before your removing the building. Otherwise the citizen data for the city gets malformed. There was a problem in civ5 where you couldn't removing specialists from buildings in AI cities during the AI's turn (during the human turn it worked fine). I haven't reinvestigated to see if that is still the case in BE but I suspect it is.
     
  5. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    Hi, is there a Command, that allow adding another specialist to a building.
    I want to make 5 separate building for
    -Factory for Production,
    -Farm for food,
    -Lab for science
    -"Market" for energy,
    -"Cinema" for Culture
    I want to add to them Specialist slots, insted adding them to new build building, so instead Holosuite and CEL Cradle (2 buildnig), I would get +2 artist to Cinema from Holosuite and after build CEL Cradle + 4 Artist to Cinema.

    Wnated to create and use something like this:
    Code:
    
    	<Table name="Improvement_SpecialistCountChanges">
    		<Column name="BuildingClass" type="text" reference="BuildingClass(Type)"/>
    		<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
    		<Column name="SpecialistType" type="text" reference="Specialist(Type)"/>
    		<Column name="SpecialistCount" type="integer"/>	
    	</Table>
    
    	<Improvement_SpecialistCountChanges>
    		<Row>
    			<BuildingClass>BUILDINGCLASS_CINEMA</BuildingClass>
    			<BuildingType>BUILDING_HOLOSUITE</BuildingType>
    			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
    			<SpecialistCount>1</SpecialistCount>
    		</Row>
    	</Improvement_SpecialistCountChanges>
    
    	<Buildings>
    		<Update>
    			<Where Type="BUILDING_CINEMA"/>
    			<Set SpecialistType="SPECIALIST_ARTIST"/>
    		</Update>
    		<Update>
    			<Where Type="BUILDING_CINEMA"/>
    			<Set SpecialistCount="0"/>
    		</Update>
    	</Buildings>
    
    
     
  6. Machiavelli24

    Machiavelli24 Mod creator

    Joined:
    May 9, 2012
    Messages:
    818
    dewast, if your requirements are:

    A building that when built adds specialist slots to another building in the same city.

    It is possible, but will require some lua. You would need to implement the following:

    When a city has built building X and building Y, give them a free dummy building Z.

    In your use case it would be: When a player has built a Holosuite & Cinema they will be given a free building that has 2 Artist Specialist slots.

    To implement this, you will need:
    1) A new XML table that lists the two required buildings and the free bonus building.

    2) Some Lua that runs when a building is completed (BuildingProcessed is the event). It will need to look at the new table and see if the just completed building is in one of the required pairs. If so, see if the city has the other required buildings. If so, give the free building.

    3) Some Lua that runs when a city is captured and re-gives all the bonus buildings. Those bonus buildings should have cost = -1 and capture chance be 0 (because the required buildings could be lost on city capture).

    Do you feel like you have enough information to implement this functionality?
     
  7. GenEngineer

    GenEngineer Prince

    Joined:
    Aug 24, 2014
    Messages:
    456
    Regarding the first one, that's what I've been doing to make base level changes to the specialist count of buildings. I was wondering if there was a way to change it over the course of the game without the ungainly method I described - for example, CEL Cradle has 2 specialist slots by default, one of the quest rewards for the buildings restores it to 4.

    Ryika, that might actually be the perfect solution. I know you can add buildings that edit the yields of specialists - giving the PAU an invisible building that nerfs the yield of the new specialist so that it cancels out might just work perfectly.

    Sad to hear the free specialist code is just outright broken. Might just change that building to be free population and slots instead - similar idea, but not as thematic.

    Also a pity about the health - I had seen that same policy option, but I'd like to see it more of a local effect. Worst comes to worse, I could see about making a new policy (not on the tree) with just that effect and have the buildings unlock it, but also not as thematic. In fact, it would be easier in general if someone knew where in the code Health was calculated to make it easier to play around with
     
  8. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    I am not so good at writing new LUA, and adding new building is not my idea, just in the game I want in one place all types of specialist and not looking throu the list of buildings with specialist. I can try to rewrite existing code, but cant find any in similar actions, the one I found was about "Improwemants" and adding them extra gold, but as You can see it did not work, others were: prerequested building or tech, but cant modify them.
     
  9. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    I did found in game in building xml:
    Code:
    
    		<Table name="Building_FreeSpecialistCounts">
    			<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
    			<Column name="SpecialistType" type="text" reference="Specialists(Type)"/>
    			<Column name="Count" type="integer"/>
    		</Table>
    
    My try
    Code:
    		<Building_FreeSpecialistCounts>
    
    			<Row>
    				<BuildingType>BUILDING_HEADQUARTERS</BuildingType>
    				<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
    				<Count>1</Count>
    			</Row>
    			
    		</Building_FreeSpecialistCounts>
    
    but dont know how to use it, when I try the game make error and it make grafic dum (oll in one level higher than should)
     
  10. GenEngineer

    GenEngineer Prince

    Joined:
    Aug 24, 2014
    Messages:
    456
    That's what we were referring to about a broken part of the XML. It looks like it was kept since Civ4 days, when you could do that, but it hasn't worked since. Still trying to figure out a way to replicate it, but not looking likely
     
  11. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    Is there a posibility to find a compatibile LUA file in civ 4, and adapt it or it would be hardly posible? Or is it in Dll files. If so how to open it? - You can send me to proper page so I can learn.
     
  12. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    No, it is not possible to emulate that because it's handled by the core files of the game and there is no functionality to actually tell the core files of the game what you want to do.

    The closest you can come to adding specialist slots to a building is actually creating a dummy-building, give it 1 specialist slot and then use lua to regularly check if the requirements for the extra specialist are fulfilled in a city.
     
  13. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    I cant (dont know how) write new Lua file, I can only modyfiy existing one.
     
  14. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    Well, then learn how to do it? ^^ There are good tutorials for basic lua on the internet and there's lot of code in existing mods that you can look at to see how exactly it works in Beyond Earth.
     
  15. Starrynite120

    Starrynite120 Prince

    Joined:
    Jul 15, 2015
    Messages:
    472
    I second what Ryika says. It looks hard, but it's not too too difficult once you get into it, and it really frees up what is possible while modding. I only learned lua recently in the way Ryika described, and it was difficult but I figured it out. People on this forum are also really helpful with wuestiona you have about it when you have problems.
     
  16. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    I decidet to try with free building, but it wont work.
    I was tring with pre defined code:
    Code:
    <Column name="FreeBuilding" type="text" reference="BuildingClasses(Type)" default="NULL"/>
    <Column name="FreeBuildingThisCity" type="text" reference="BuildingClasses(Type)" default="NULL"/>
    
    but it do not work, is this also an old code, missing from LUA and dll, and they just did not delete it at the end?
     
  17. Starrynite120

    Starrynite120 Prince

    Joined:
    Jul 15, 2015
    Messages:
    472
    No, that works properly. I've used it multiple times. Could you post what you tried to do with it?
     
  18. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    It is for testing so price cost and tech change leater, 2 new building, one is to build 2 free build BUILDING_CULTURE_CENTER and free BUILDING_CENTER
    Code:
    <Buildings>		
    <Row>
    			<Type>BUILDING_CULTURE_CENTER</Type>
    			<BuildingClass>BUILDINGCLASS_CULTURE_CENTER</BuildingClass>
    			<Description>Culture Center</Description>
    			<Help>Culture Center allow proper Culture propagation.</Help>
    			<Cost>2</Cost>
    			<Civilopedia>Culture Center where build to allow colonist a steady enviremant to always have acces to their Culture.</Civilopedia>
    			<FreeBuildingThisCity>BUILDINGCLASS_CENTER</FreeBuildingThisCity>
    			<ConquestProbability>0</ConquestProbability>
    			<HurryCostModifier>-1</HurryCostModifier>
    			<IconAtlas>BW_ATLAS_1</IconAtlas>
    			<PortraitIndex>31</PortraitIndex>
    			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
    			<SpecialistCount>9</SpecialistCount>
    		</Row>
    
    		<Row>
    			<Type>BUILDING_CENTER</Type>
    			<BuildingClass>BUILDINGCLASS_CENTER</BuildingClass>
    			<Description>Center</Description>
    			<Cost>2</Cost>
    			<Help> Center allow proper Culture propagation.</Help>
    			<Civilopedia>Culture Center where build to allow colonist a steady enviremant to always have acces to their Culture.</Civilopedia>
    			<ConquestProbability>0</ConquestProbability>
    			<HurryCostModifier>1</HurryCostModifier>
    			<IconAtlas>BW_ATLAS_1</IconAtlas>
    			<PortraitIndex>31</PortraitIndex>
    			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
    			<SpecialistCount>9</SpecialistCount>
    			<FreePlayerPerk>PLAYERPERK_FOREIGN_POLICY_LUXURY_GROWTH19</FreePlayerPerk>
    			
    		</Row>
    
    
    	</Buildings>
    	<BuildingClasses>
    	<Row>
    		<Type>BUILDINGCLASS_CULTURE_CENTER</Type>
    		<DefaultBuilding>BUILDING_CULTURE_CENTER</DefaultBuilding>
    		<Description>TXT_KEY_BUILDING_CULTURE_CENTER_DESC</Description>
    	</Row>
    
    		<Row>
    			<Type>BUILDINGCLASS_CENTER</Type>
    			<DefaultBuilding>BUILDING_CENTER</DefaultBuilding>
    			<Description>TXT_KEY_BUILDING_CULTURE_DESC</Description>
    		</Row>
    	</BuildingClasses>
    
    could it work with 2 or more free buildings?
     
  19. dewast

    dewast Chieftain

    Joined:
    Jul 7, 2012
    Messages:
    22
    So why isn't it working?
     
  20. Starrynite120

    Starrynite120 Prince

    Joined:
    Jul 15, 2015
    Messages:
    472
    I'm not sure what exactly you're trying to accomplish with these two buildings, but I don't see anything wrong in the code, though the game might not like the specialist count being set to 9. Could you explain?

    Also, does the playerperk exist that you have written there? That could also cause problems.
     

Share This Page