Captain_Russia
Chieftain
- Joined
- Sep 9, 2016
- Messages
- 48
Ok first off, I hate joining site just to ask questions on my first post, but I cannot solve this problem for the life of me.
I've read everything I can but to no success, I followed the steps here http://forums.civfanatics.com/showthread.php?t=487846
I also left only print()'s in the Lua file and it STILL didn't load!
I am an experanced lua coder (a GMOD scripter), but I'm new to Civ5's stuff, and it's pulling my hairs out when it's not working. I've gotten XML's, Icons, and other things to work but not this.
o, here's what I got for the file, I'd like to point out the rest of the mod works fine.
don't mind the all the comments, I didn't notice GetNumPolicies() existed when I wrote that, so I went for a harder approuch/work around
oh and the mod is for BNW
And I am sorry for this being my first post I just REALLY want to solve this problem!
I've read everything I can but to no success, I followed the steps here http://forums.civfanatics.com/showthread.php?t=487846
I also left only print()'s in the Lua file and it STILL didn't load!
I am an experanced lua coder (a GMOD scripter), but I'm new to Civ5's stuff, and it's pulling my hairs out when it's not working. I've gotten XML's, Icons, and other things to work but not this.
o, here's what I got for the file, I'd like to point out the rest of the mod works fine.
Code:
print("Started Mental script")
local iCiv = GameInfoTypes.CIVILIZATION_MENTAL
local iCargo = GameInfoTypes.UNIT_CARGO_SHIP
local iCaravan = GameInfoTypes.UNIT_CARAVAN
local iPietyPolicy1 = GameInfoTypes.POLICY_ORGANIZED_RELIGION
local iPietyPolicy2 = GameInfoTypes.POLICY_REFORMATION
local iPietyBranch = GameInfo.PolicyBranchTypes["POLICY_BRANCH_PIETY"].ID
local iMentalPromotion = GameInfoTypes.PROMOTION_MENTAL_HOARD
local iMentalPower=0
--local policytable--policytable={}
-----policytable--policytable[0]=GameInfoTypes.POLICY_LIBERTY
---policytable--policytable[1]=GameInfoTypes.POLICY_COLLECTIVE_RULE
---policytable--policytable[2]=GameInfoTypes.POLICY_CITIZENSHIP
---policytable--policytable[3]=GameInfoTypes.POLICY_REPUBLIC
---policytable--policytable[4]=GameInfoTypes.POLICY_REPRESENTATION
---policytable--policytable[5]=GameInfoTypes.POLICY_MERITOCRACY
---policytable--policytable[6]=GameInfoTypes.POLICY_TRADITION
---policytable--policytable[7]=GameInfoTypes.POLICY_ARISTOCRACY
---policytable--policytable[8]=GameInfoTypes.POLICY_OLIGARCHY
---policytable--policytable[9]=GameInfoTypes.POLICY_LEGALISM
---policytable--policytable[10]=GameInfoTypes.POLICY_LANDED_ELITE
---policytable--policytable[11]=GameInfoTypes.POLICY_MONARCHY
---policytable--policytable[12]=GameInfoTypes.POLICY_HONOR
---policytable--policytable[13]=GameInfoTypes.POLICY_WARRIOR_CODE
---policytable--policytable[14]=GameInfoTypes.POLICY_DISCIPLINE
---policytable--policytable[15]=GameInfoTypes.POLICY_MILITARY_TRADITION
---policytable--policytable[16]=GameInfoTypes.POLICY_MILITARY_CASTE
---policytable--policytable[17]=GameInfoTypes.POLICY_PROFESSIONAL_ARMY
---policytable--policytable[18]=GameInfoTypes.POLICY_PIETY
---policytable--policytable[19]=GameInfoTypes.POLICY_ORGANIZED_RELIGION
---policytable--policytable[20]=GameInfoTypes.POLICY_MANDATE_OF_HEAVEN
---policytable--policytable[21]=GameInfoTypes.POLICY_THEOCRACY
---policytable--policytable[22]=GameInfoTypes.POLICY_REFORMATION
---policytable--policytable[23]=GameInfoTypes.POLICY_FREE_RELIGION
---policytable--policytable[24]=GameInfoTypes.POLICY_PATRONAGE
---policytable--policytable[25]=GameInfoTypes.POLICY_PHILANTHROPY
---policytable--policytable[26]=GameInfoTypes.POLICY_AESTHETICS
---policytable--policytable[27]=GameInfoTypes.POLICY_SCHOLASTICISM
---policytable--policytable[28]=GameInfoTypes.POLICY_CULTURAL_DIPLOMACY
---policytable--policytable[29]=GameInfoTypes.POLICY_EDUCATED_ELITE
---policytable--policytable[30]=GameInfoTypes.POLICY_COMMERCE
---policytable--policytable[31]=GameInfoTypes.POLICY_TRADE_UNIONS
---policytable--policytable[32]=GameInfoTypes.POLICY_NAVAL_TRADITION
---policytable--policytable[33]=GameInfoTypes.POLICY_MERCANTILISM
---policytable--policytable[34]=GameInfoTypes.POLICY_MERCHANT_NAVY
---policytable--policytable[35]=GameInfoTypes.POLICY_PROTECTIONISM
---policytable--policytable[36]=GameInfoTypes.POLICY_RATIONALISM
---policytable--policytable[37]=GameInfoTypes.POLICY_SECULARISM
---policytable--policytable[38]=GameInfoTypes.POLICY_HUMANISM
---policytable--policytable[39]=GameInfoTypes.POLICY_FREE_THOUGHT
---policytable--policytable[40]=GameInfoTypes.POLICY_SOVEREIGNTY
---policytable--policytable[41]=GameInfoTypes.POLICY_SCIENTIFIC_REVOLUTION
--This stuff was borrowed and modified from other Civ, in this case:
--Hakurei Shrine
-------------------------------------------------------------------------------------------------------------------------
-- GetStrongestMilitaryUnit
-------------------------------------------------------------------------------------------------------------------------
function GetStrongestMilitaryUnitStrengthM(pPlayer, bIgnoreResources, ...)
local tUnit = {["Combat"] = 0}
for iKey, sCombatType in pairs(arg) do
for row in GameInfo.Units("CombatClass = \'" .. sCombatType .. "\'") do
if pPlayer:CanTrain(row.ID, bIgnoreResources) and row.Combat > tUnit.Combat then
tUnit = row
end
end
end
return tUnit.Combat
end
print("Mentals Lua: GetStrongestMilitaryUnitStrengthM")
function MentalStrength(pPlayer,iPower)
if (pPlayer:IsAlive()) then
for pUnit in pPlayer:Units() do
if (pUnit:IsHasPromotion(iMentalPromotion)) then
local iBaseCombatStrength = pUnit.Combat
local iBaseRangedCombatStrength = pUnit.RangedCombat
local iModifiedCombatStrength = math.ceil(iBaseCombatStrength * (1+(iPower/10)))
local iModifiedRangedCombatStrength = math.ceil(iBaseRangedCombatStrength * (1+(iPower/10)))
pUnit:SetBaseCombatStrength(iModifiedCombatStrength)
end
end
if pPlayer:IsHuman() then
pPlayer:AddNotification(NotificationTypes.NOTIFICATION_GENERIC, "This is a test: Unit Power at: "..iMentalPower, -1, -1);
end
end
end
print("Mentals Lua: MentalStrength")
function UpdateMentalPolicy(iPlayer)
print("Testing")
local pPlayer = Players[iPlayer]
if (pPlayer:IsAlive()) then
iMentalPower=0
iMentalPower=pPlayer:GetNumPolicies()
print("Mental has "..iMentalPower.." policies")
MentalStrength(pPlayer,iMentalPower)
end
end
print("Mentals Lua: UpdateMentalPolicy")
GameEvents.PlayerAdoptPolicy.Add(UpdateMentalPolicy);
GameEvents.PlayerDoTurn.Add(UpdateMentalPolicy);
print("Mentals Lua: Hooks are loaded!")
print("Mentals Lua is loaded and ready!")
don't mind the all the comments, I didn't notice GetNumPolicies() existed when I wrote that, so I went for a harder approuch/work around
oh and the mod is for BNW
And I am sorry for this being my first post I just REALLY want to solve this problem!