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

[BNW] Can't seem to get the UU appear at all...

Discussion in 'Civ5 - Creation & Customization' started by RoxyRiku94, Dec 21, 2016.

  1. RoxyRiku94

    RoxyRiku94 Detective Agent

    Joined:
    Jan 30, 2016
    Messages:
    133
    Gender:
    Male
    Location:
    Souzai Daigaku
    I'm currently making a UU for a Disney Civ, but for some reason, I can't seem to get the second UU appear at all. I looked in the SQL files, but can't seem to find any errors at all.

    I'm trying to give the second UU a promotion which allows attacking twice a turn when adjacent to another one, but I don't know if this was coded correctly in Lua (I mostly took reference of JFD's Austria's Code).

    Has anybody a solution? The SQL and Lua file is included in the ZIP folder.
     

    Attached Files:

  2. Alkanta

    Alkanta Chieftain

    Joined:
    Oct 27, 2016
    Messages:
    8
    Did you create the two UUs in the same SQL/XML file ? Otherwise the file including the code of the non-appearing one may have an error in it and may be ignored by the game.

    I can't look at your file atm, but it's an idea.
     
  3. OTiger

    OTiger Chieftain

    Joined:
    Aug 26, 2012
    Messages:
    178
    Gender:
    Male
    Do you have the modinfo file? The mod won't work if the modinfo file isn't there, or unless it's part of the mod, not part of the "full" mod.
     
  4. RoxyRiku94

    RoxyRiku94 Detective Agent

    Joined:
    Jan 30, 2016
    Messages:
    133
    Gender:
    Male
    Location:
    Souzai Daigaku
    Yeah, I created both of the UUs in the same SQL file. The first UU appears ingame and is actually working, but it's the second one which doesn't seem to appear at all.

    Modinfo is already finished, I've just pasted the files of the UUs in the ZIP Data. Though if you want to check it out, I can give out the full mod.
     
  5. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,224
    Location:
    Illinois, USA
    Zip the mod as it currently is in the game's mods folder at: C:\Users\YourNameHere\Documents\My Games\Sid Meier's Civilization 5\MODS. The attach the zip to a post or link to where the zip can be downloaded if the zip is too big to attach to a forum post.

    Very often the actual problem is not where you think it is. Having the mod itself as is it is being seen by the game allows us to run the mod on our end and see what the game is encountering.
     
  6. RoxyRiku94

    RoxyRiku94 Detective Agent

    Joined:
    Jan 30, 2016
    Messages:
    133
    Gender:
    Male
    Location:
    Souzai Daigaku
    There you go. You might want to disable E&D though, as it's still incomplete by now.

    Btw, I'm curious about writing XML Text with Macrons (for Japanese Clans which I plan to make). Does Civ 5 accept the Macrons when writing the appropriate HTML code for it?
     
    Last edited: Dec 26, 2016
  7. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,224
    Location:
    Illinois, USA
    A couple of sample Database errors being generated by your sql files:
    Code:
    [389822.281] no such column: ArtDefineTag
    [389822.281] near ",": syntax error
    The timestamps match up to these files listed within Stopwatch.log
    Code:
    [389822.281] , 					Update Database - ModSupport/Other/ScroogeOtherModSupport.sql, 0.011169
    [389822.281] , 					Update Database - SQL/DuckBuildings.sql, 0.002987
    [389822.281] , 					Update Database - SQL/DuckCivilization.sql, 0.001924
    [389822.281] , 					Update Database - SQL/DuckGreatWork.sql, 0.000547
    Which for the ArtDefineTag error leads to this within file ModSupport/Other/ScroogeOtherModSupport.sql:
    Code:
    CREATE TABLE IF NOT EXISTS 
    Civilization_JFD_CultureTypes (
    	CivilizationType 							text 	REFERENCES Civilizations(Type) 		default null,
    	CultureType 								text										default null,
    	SplashScreenTag								text										default	null,
    	SoundtrackTag								text										default	null);
    
    INSERT INTO Civilization_JFD_CultureTypes
    			(CivilizationType,				ArtDefineTag,		CultureType,		DefeatScreenEarlyTag, 	DefeatScreenMidTag, 	DefeatScreenLateTag, 	IdealsTag,			SplashScreenTag,   SoundtrackTag,   	UnitDialogueTag)
    See whoward69's enable error logging tutorial

    The error
    Code:
    [389822.281] near ",": syntax error
    appears to be coming from:

    appears to be in the Buildings file between the <Buildings> definition of the Moneybin and the <Building_Flavors> table because no Building-Flavors are making it into the game's database. But as Yet I am not spotting the error.
    Code:
    --*********************************************************************************
    --Building_Flavors
    --*********************************************************************************
    INSERT INTO Building_Flavors
    			(BuildingType, FlavorType, Flavor)
    SELECT		('BUILDING_MONEYBIN', FlavorType, 'FLAVOR_GOLD'+20)
    FROM Building_Flavors WHERE (BuildingType = 'BUILDING_PALACE');
    
    INSERT INTO Building_Flavors
    VALUES		('BUILDING_MONEYBIN', 'FLAVOR_AIRLIFT', 10);
    You are attempting to add a numerical value to the text string 'FLAVOR_GOLD'

    And an additional error related to your Units file
    Code:
    [389822.296] near ",": syntax error
    appears to be coming from this:
    Code:
    --==========================================================================================================================
    -- UnitGameplay2DScripts
    --==========================================================================================================================
    INSERT INTO UnitGameplay2DScripts 	
    			(UnitType, 			SelectionSound,			FirstSelectionSound)
    SELECT		('UNIT_INVESTOR', 	SelectionSound,			FirstSelectionSound)
    FROM Unit_Gameplay2DScripts WHERE (UnitType = 'UNIT_MERCHANT');
    The correct table-name has no underscore in it.

    Database log shows more errors coming from your mod than just the examples I have shown here.
     
    Last edited: Dec 26, 2016
  8. RoxyRiku94

    RoxyRiku94 Detective Agent

    Joined:
    Jan 30, 2016
    Messages:
    133
    Gender:
    Male
    Location:
    Souzai Daigaku
    Thanks for mentioning the stopwatch.log! I've already enabled error logging, but only searched the Database.log, XML.log and Lua.log before.

    By now, I've tracked down the errors in the Log Files and fixed them so that the UUs work in-game now (though the extra attack promotion still doesn't apply properly). However for some reason, the second decision is messed up with the wrong text appearing while hovering over the Enact button.

    Spoiler :
    The Promotion Bug as mentioned above (despite having three adjacent Knightslayer UUs, the promotion with the extra attack doesn't change).


    Spoiler :
    The second decision has the wrong text (the text box's content is supposed to be for the last Civ decision)



    I've also looked at the Lua.log, but couldn't find any related errors. Any suggestions of how to fix it?
     
  9. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,224
    Location:
    Illinois, USA
    E&D I don't even touch anymore it is such a PITA for me to figure out when/where something is wrong.

    --------------------------------------------------------------------------------------

    There's really nothing wrong with using PlotIterators, but since you are only checking adjacent tiles, you really don't need it for the Knightslayer functions. The game has a pre-provided DirectionTypes for adjacent plots.

    Try this version in place of what you currently have in the KnightslayerFunctions.lua file.

    I don't generally use CP, so if you are using it, this line might not actually be set up correctly for the boolean arguments:
    Code:
    return pUnit:IsAdjacentToUnit(iUnitType, true, false)
    Spoiler :
    Code:
    --------------------------------------------------------------------------------------------------------------------------
    -- MOD CHECKS
    --------------------------------------------------------------------------------------------------------------------------
    -- JFD_IsCivilisationActive
    function JFD_IsCivilisationActive(civilizationID)
    	for iSlot = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
    		local slotStatus = PreGame.GetSlotStatus(iSlot)
    		if (slotStatus == SlotStatus["SS_TAKEN"] or slotStatus == SlotStatus["SS_COMPUTER"]) then
    			if PreGame.GetCivilization(iSlot) == civilizationID then
    				return true
    			end
    		end
    	end
    
    	return false
    end
    
    -- JFD_IsUsingCPDLL
    function JFD_IsUsingCPDLL()
    	local cPDLLID = "d1b6328c-ff44-4b0d-aad7-c657f83610cd"
    	for _, mod in pairs(Modding.GetActivatedMods()) do
    		if (mod.ID == cPDLLID) then
    			return true
    		end
    	end
    	return false
    end
    local isUsingCPDLL = JFD_IsUsingCPDLL()
    
    --------------------------------------------------------------------------------------------------------------------------
    -- GLOBALS
    ----------------------------------------------------------------------------------------------------------------------------
    local civilizationID 			 = GameInfoTypes["CIVILIZATION_DUCK"]
    local isScroogeMcDuckCivActive 	 = JFD_IsCivilisationActive(civilizationID)
    
    -- KNIGHTSLAYER
    --------------------------------------------------------------------------------------------------------------------------
    -- Scrooge_Knightslayer
    
    local unitKnightslayerID = GameInfoTypes["UNIT_KNIGHTSLAYER"]
    local iUnitClass_Knightslayer = GameInfoTypes[GameInfo.Units[unitKnightslayerID].Class]
    local unitPromotionKnightslayerArrowFormationID = GameInfoTypes["PROMOTION_KNIGHTSLAYER_ARROW"]
    local unitPromotionKnightslayerArrowFormationInfoID = GameInfoTypes["PROMOTION_KNIGHTSLAYER_ARROW_INFO"]
    function UnitIsAdjacentToUnitType(pUnit, iUnitType)
    	if isUsingCPDLL then
    		return pUnit:IsAdjacentToUnit(iUnitType, true, false)
    	end
    	local pPlot = pUnit:GetPlot()
    	for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
    		local pAdjacentPlot = Map.PlotDirection(pPlot:GetX(), pPlot:GetY(), direction)
    		if pAdjacentPlot and pAdjacentPlot:IsUnit() then
    			local iNumberUnitsOnPlot = pAdjacentPlot:GetNumUnits()
    			for i = 0, iNumberUnitsOnPlot - 1 do
    				local pAdjUnit = pAdjacentPlot:GetUnit(i)
    				if pAdjUnit then
    					if (pAdjUnit:GetUnitType() == iUnitType) then
    						return true
    					end
    				end
    			end
    		end
    	end
    	return false
    end
    function Scrooge_Knightslayer(playerID)
    	local player = Players[playerID]
    	if (player:IsAlive() and (not player:IsBarbarian())) then
    		if (player:GetUnitClassCount(iUnitClass_Knightslayer) > 0) then
    			for unit in player:Units() do
    				if unit:GetUnitType() == unitKnightslayerID then
    					if UnitIsAdjacentToUnitType(unit, unitKnightslayerID) then
    						if (not unit:IsHasPromotion(unitPromotionKnightslayerArrowFormationID)) then
    							unit:SetHasPromotion(unitPromotionKnightslayerArrowFormationID, true)
    							unit:SetHasPromotion(unitPromotionKnightslayerArrowFormationInfoID, false)
    						end
    					else
    						if unit:IsHasPromotion(unitPromotionKnightslayerArrowFormationID) then
    							unit:SetHasPromotion(unitPromotionKnightslayerArrowFormationID, false)
    							unit:SetHasPromotion(unitPromotionKnightslayerArrowFormationInfoID, true)
    						end
    					end
    				end
    			end
    		end
    	end
    end
    if isScroogeMcDuckCivActive then
    	print ("Duckburg Civ active, may load Knightslayer Arrow Formation Function")
    	GameEvents.PlayerDoTurn.Add(Scrooge_Knightslayer)
    end
     

Share This Page