Sid Meier's Civilization: Beyond Earth

Sid Meier's Civilization: Beyond Earth

Policies grant perks & buildings [snippet for mod makers] (vanilla)
33 条留言
Machiavelli  [作者] 2015 年 10 月 25 日 下午 6:59 
I've updated this snippet for Rising Tide and put it on the workshop. There are links to the Rising Tide version at the top of this workshop page.

Gokudo, the problem you are seeing is a mistake on my part. I copied InfoTooltipInclude.lua from another of my mods when I was putting together this snippet. Those missing strings are stuff my other mod uses that the snippet does not need. The Rising Tide version does not have that mistake. You can fix the issue by deleting three lines from InfoTooltipInclude.lua (search for "nh_" to find them, they are all next to each other. I'll see about updating this version of the snippet to fix that shortly.
Gokudo31 2015 年 10 月 25 日 下午 12:20 
I get : TXT_KEY_NH_POLICY_EFFECT_BUILDING_PURCHASE_COST_MODIFIER
Gokudo31 2015 年 10 月 25 日 下午 12:11 
ok thx dude. May you explain me why the infotooltips doesn't seem to work with the building cost reduction in the policy.xml ?
Machiavelli  [作者] 2015 年 10 月 24 日 上午 7:28 
The InfoTooltipInclude.lua assumes you are using both the Policies Grant Buildings and the Policies Grant PlayerPerks. If you're only using one it will not work correctly. I should have put that information above in an explicit location.

I've completed regression testing and have found some areas where I will need to change the code for Rising Tide. I'm probably going to mark this workshop entry as the base game version and put up another entry that will be for Rising Tide. I'll have some time to work on it this weekend so hopefully it will be done before Monday.
Gokudo31 2015 年 10 月 22 日 下午 9:55 
I've got an issue where I cant display the virtue menu once I've activated InfoTooltipInclude.lua vfs = true. I only use the Policy_PGP_Freeperk( InfoTooltipInclude, Policy_GP_Freeperk lua and xml). Is there any kind of dependancy between InfoTooltipInclude and The building part of your mod ?
Machiavelli  [作者] 2015 年 10 月 21 日 下午 5:33 
Gokudo, I haven't completed regression testing yet. But so far the code seems fine in its current form. I have not been able to reproduce the crash Galgus described. You can probably continue to use the code as is for your Rising Tide mods.
Gokudo31 2015 年 10 月 21 日 下午 4:32 
excuse my presumptuousness, but is there any ETA ?
Machiavelli  [作者] 2015 年 10 月 9 日 下午 6:51 
I haven't updated this snippet for Rising Tide yet so it may not work correctly until then.
Galgus 2015 年 10 月 9 日 下午 6:07 
With additional testing, I believe that policies granting perks is the source of the crash, conflicting with the new trait system.
Galgus 2015 年 10 月 9 日 下午 5:48 
In an attempt with a different mod using it it appeared to work, so I'm confused on the cause.

This could be nothing, but there may be a crash issue in some use of the code.
Galgus 2015 年 10 月 9 日 下午 5:41 
I suspect that mods using this code may be causing crashes in the new Rising Tide diplomacy screen.

When I have tried to use such mods, the game has frozen while trying to fully load the screen, and the mods seem functional otherwise and should have nothing to do with trait or leader perks.
Machiavelli  [作者] 2015 年 9 月 3 日 下午 4:00 
The code allows a Virtue to be give a PlayerPerk. However, to do the opposite is tricky as there is no easy way to detect when a PlayerPerk is gained. There is an event that fires when a player gains a Virtue but there isn't one when a player gains a perk.

I have an idea that may make it possible but it would require some investigation on my part to confirm. If it did work, it would also take a bit of effort (perhaps a weekend) to implement and test.
Gokudo31 2015 年 9 月 2 日 下午 7:05 
Not exactly but i understand better how works your mod.
What I want, is actually simple. You allowed us to use perkplayer into virtue. I just want to be able to use the virtues ( policies ) into the perkplayer.

An example, I can't give +1 production to my specialist from the playerperk table. so i want to be able to take it from the virtue table which already allows it ( with "Hands never idle")

To be SUPER SIMPLE : you are doing Playerperk -> Virtue, I want Virtue -> Playerperk.
I don't ask you to do it, I just want few advices:AmericanReclamationCorporation:
Machiavelli  [作者] 2015 年 9 月 2 日 下午 5:49 
Bonjour Gokudo, your English is certainly much better than my French.

To make use of this snippet you don't have to worry about include or import commands. Just download the mod. It will contain some files you'll need to copy (unchanged) into your own mod. You need to get all the lua and xml files in the "Policies grant buildings" directory and the "Policies grant PlayerPerks" directory.

In Modbuddy have the XML files update the database (via the Action tab) and set the LUA file as an "InGameUIAddin" (via the Content tab).

Lastly, InfoTooltipInclude.lua will need to be added via "InGameUIAddin" and have VFS set to true. It will replace the existing InfoTooltipInclude.lua. Without it the help text will not get added to the Virtue tooltip (but buildings and perks will still be granted).

Does this answer your question?
Gokudo31 2015 年 9 月 2 日 下午 4:01 
Hi Machiavelli, it's an excellent work. I want to ask some help because I want to link like you different tables. I want to be able to use the table Policies with Playerperk in order to get Extra global health, or unhappiness modifier for cities and population. I usually use Java so i'm not a stranger to object programmation but I need to know where and how I can use the civlua library ( sorry for my aweful english, I'm french )
Galgus 2015 年 8 月 27 日 下午 11:24 
In a new mod, I'm having a strange issue where the XML with the free building code is loading, but the free buildings are not being created with the policy.

They seem to be there in the debug folder in building classes and the policy building classes, so I don't know why they are not showing up in the capital.

They are using the free building code designed to make them appear in all cities.
Galgus 2015 年 8 月 16 日 下午 9:27 
I fixed that bit, but the policy building component still is not working.

Sorry for having that amateur mistake while asking for help, though - I should have caught that.
Machiavelli  [作者] 2015 年 8 月 16 日 下午 8:15 
I'm looking through the files and I think I see the issue. It looks like kickerBuff.xml is not in OnModActivated->UpdateDatabase.
Machiavelli  [作者] 2015 年 8 月 16 日 下午 8:09 
There are multiple ways to view the SQLite database. I use a firefox plug in (SQLite Manager) but it is invaluable skill for debugging your own civ mods. You'll want to look at your "Civ 5/cache/Civ5debugDatabase.db" (not mods database). It will help you verify XML tables are being set up as intended.
Galgus 2015 年 8 月 16 日 下午 7:57 
I don't know how to use SQLite, but I can do that if it would help.

I'll send the mod in the meantime.
Machiavelli  [作者] 2015 年 8 月 16 日 下午 7:55 
That lua issue sounds like something with the interface, but seems unlikely to be related to InfoTooltipInclude.lua. When you have your mod running and use SQLite to look at the debugDatabase, do you see the MODERATE_ONE building in the buildings table and the Policy_PGB_FreeBuildingClassCapital table?

If you can send me the mod I'll see if I can take a look tomorrow evening. A dropbox link or via the CivFanatics forums are likely the two easiest ways.
Galgus 2015 年 8 月 16 日 下午 5:52 
<BuildingClassType>BUILDINGCLASS_MODERATE_ONE</BuildingClassType>
<Help>TXT_KEY_MODERATE_ONE_EXAMPLE</Help>
</Row>
</Policy_PGB_FreeBuildingClassCapital>
<Language_en_US>
<Row Tag="TXT_KEY_MODERATE_ONE_EXAMPLE">
<Text>+2 Energy from Trader Specialists.</Text>
</Row>
</Language_en_US>

<Building_SpecialistYieldChanges>
<Row>
<BuildingType>BUILDING_MODERATE_ONE</BuildingType>
<SpecialistType>SPECIALIST_TRADER</SpecialistType>
<YieldType>YIELD_ENERGY</YieldType>
<Yield>2</Yield>
</Row>

</Building_SpecialistYieldChanges>

I can send mod files or logs if that would help at all.
Galgus 2015 年 8 月 16 日 下午 5:52 
This is some of the relevant XML in case it is flawed- it largely repeats with small changes.

<BuildingClasses>
<Row>
<Type>BUILDINGCLASS_MODERATE_ONE</Type>
<DefaultBuilding>BUILDING_MODERATE_ONE</DefaultBuilding>
<Description>TXT_KEY_POLICY_MODERATE_KICKER_1</Description>
</Row>
</BuildingClasses>
<Buildings>
<Row>
<Type>BUILDING_MODERATE_ONE</Type>
<BuildingClass>BUILDINGCLASS_MODERATE_ONE</BuildingClass>
<Cost>-1</Cost>
<ConquestProbability>0</ConquestProbability>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>14</PortraitIndex>
<Description>TXT_KEY_POLICY_MODERATE_KICKER_1</Description>
<Help>TXT_KEY_POLICY_MODERATE_KICKER_1</Help>
</Row>
</Buildings>
<Policy_PGB_FreeBuildingClassCapital>
<Row>
<PolicyType>POLICY_MODERATE_KICKER_1</PolicyType>
Galgus 2015 年 8 月 16 日 下午 5:52 
I'm not seeing the building be created or its intended effect activate, though XML not related on the buildings to be created with policies seems to work.

Using the mod attempt without any others and the lua copied into folders with, it shows these erros in the lua log.

I can try to recopy the lua to double check, if you think that is the issue.

Runtime Error: Assets\UI\InGame\InGame.lua:1554: attempt to index a nil value
stack traceback:
Assets\UI\InGame\InGame.lua:1554: in function '(main chunk)'
[C]: in function '(anonymous)'
Runtime Error: Error loading Assets\UI\InGame\InGame.lua.
stack traceback:
[C]: in function '(anonymous)'
AdvisorInfoPopup: Closing Advisor Info
WorldView: ERROR: Unable to Show/Hide InGame control from WorldView. Control Path: /Ingame/NotificationLogPopup hiding: true
WorldView: ERROR: Unable to Show/Hide InGame control from WorldView. Control Path: /Ingame/NotificationLogPopup hiding: false
Machiavelli  [作者] 2015 年 8 月 16 日 下午 4:50 
Galgus, what behavior are you seeing? If you have any of the syntax wrong there should be some errors in your lua log. What table were you using? I'll do some testing and see if I can reproduce an issue.

PlayerPerks that use VirtueTierSynergyRequirementDiscount (ei: the Bytegeist wonder) can cause minor problems (the building won't be given until the player adopts another virtue).
Galgus 2015 年 8 月 16 日 下午 4:27 
As you thought, the Synergy bonus Virtues don't seem to be working for granting Buildings or Perks.

Or my code is wrong, which is also a possibility.

If it isn't that latter, would you mind updating the mod to include that?
Machiavelli  [作者] 2014 年 12 月 20 日 下午 5:12 
The CivFanatics modding forum http://forums.civfanatics.com/forumdisplay.php?f=512 isn't yet as developed as its Civ5 forum, but is a good place to ask questions and find information.

Currently, the best introduction to Beyond Earth modding for people without any experience is on Fraxis's twitch channel. http://www.twitch.tv/firaxisgames/c/5490091
Shadowchild22 2014 年 12 月 20 日 下午 4:47 
I see, can anyone tell me how to learn to become a mod maker?
Machiavelli  [作者] 2014 年 12 月 20 日 下午 3:56 
It is only for mod makers. It can allow them to create virtues that have effects that normally only buildings or perks can achieve.
Shadowchild22 2014 年 12 月 20 日 下午 3:33 
What is the purpose?
Machiavelli  [作者] 2014 年 12 月 14 日 上午 10:02 
Yes, buildings in Policy_PGB_FreeBuildingClass will be given to every city a player has, founds or captures.
Highlord Elliot 2014 年 12 月 14 日 上午 10:01 
from what im readingthis mod allows buildings to instantly be made in cities based on if they have certain policies and will give all those buildings to conquered cities when you take them is thata good sumarization of this mod yes or no?