DLL - Various Mod Components

cargo ships show they have a range of -43,457 or some crazy number - but always negative.

This has been reported before - I got it at +18.5 million once! - (can't find the link) it's been fixed, but I've been out-of-town, so I may not have posted the updated DLL
 
This has been reported before - I got it at +18.5 million once! - (can't find the link) it's been fixed, but I've been out-of-town, so I may not have posted the updated DLL

Awesome, and no problem man. I'm just relieved it's a known bug. Take your time, I managed to temporarily fix it by adding Harbors. Odd how the reverse fixed it last time /shrug.
 
Can you please give me a hand guys? :(

I got this message...

from University artifact slot (great work research)message from game when i m trying to enable it:

"the mod is missing required dependencies"....
:\

whats wrong??? is it working or not? :(

Help somebody please....!
 
Hi whoward69. Hope you could remember me. My Modpack "Super Power" which using your DLL - Various Mod Components for some core functions has been released. Thanks for your great work.

I will keep reporting to you in the future about some possible DLL-related bugs claimed by my mod users.

looking forward to working with you!
 
Same trade rout thing.

Also I'm using your mods in a multiplayer game, and so far the only bug I've found aside from the trade rout thing is this:

Another player playing Inca suddenly gained the ability to upgrade his workers like pikeman the turn I researched gunpowder as Ottomans. When he chose Janissary his game crashed.

I doubt some of that is important, but I wanted to provide you everything you might need.

I'll also add that we're the only two human players and have 8 other AI's.

I would assume it's something in the upgrade paths mod. Let me know what you think.

PS Using a bunch of mods via MPMPM and it works awesome other than these two bugs so far. Consider trying it yourself if you play MP.
 
Does CombatEnded and CombatResult work when one of the parties is a Worker?

CustomMods.cpp: 252 - Cache: EVENTS_RED_TURN = 1
CustomMods.cpp: 252 - Cache: EVENTS_RED_COMBAT = 1
CustomMods.cpp: 252 - Cache: EVENTS_RED_COMBAT_MISSION = 1
CustomMods.cpp: 252 - Cache: EVENTS_RED_COMBAT_ABORT = 1
CustomMods.cpp: 252 - Cache: EVENTS_RED_COMBAT_RESULT = 1
CustomMods.cpp: 252 - Cache: EVENTS_RED_COMBAT_ENDED = 1

I have it all enabled, the file is loading but the function is never called.
If not, is there any way to fire a function when a civilian is captured?
 
I am able to build this wonder without having public schools in all my cities. I have noticed this before playing a different civ so it is not civ related. Also some of the cities which do not have public schools are my original cities. One large continent. Not a issue just wanted to make you aware.:)
 
@bane: Gedemon wrote the RED events, I just included the code (following a modder's request), so can't say exactly under what conditions they fire, but I'd be surprised if they did include capturing a civilian as that's handled differently to combat

@rltmd317: there is no such wonder as "Palace of Culture & Science"
 
// Event sent as a unit is captured (v46)
// GameEvents.UnitCaptureType.Add(function(iPlayer, iUnit, iUnitType, iByCiv) return iCaptureUnitType; end)
#define MOD_EVENTS_UNIT_CAPTURE gCustomMods.isEVENTS_UNIT_CAPTURE()
 
Not sure if there are any users of TableSaverLoader here. But if there are, it's a whole lot easier to use (and safer) if its TableSave function can be triggered from a GameSave event. (The alternative is a rather complex set of Lua hacks.)

It's easy to add a GameSave hook in CvDllGame::Write before Civ5SavedGameDatabase.db serialization happens:
Spoiler :
Code:
void CvDllGame::Write(FDataStream& kStream) const
{

#ifdef EA_EVENT_GAME_SAVE	// Paz - This will fire before Civ5SavedGameDatabase.db serialization into the gamesave file
	ICvEngineScriptSystem1* pkScriptSystem = gDLL->GetScriptSystem();
	if (pkScriptSystem)
	{
		CvLuaArgsHandle args;
		bool bResult;
		LuaSupport::CallHook(pkScriptSystem, "GameSave", args.get(), bResult);
	}

#endif
	
	m_pGame->Write(kStream);
}
This dll plus the ability to easily persist Lua tables seems like a winner for Lua-only modders :).
 
Cheers,

I'll add the GameSave event when I've finished unifying yields (or at least as many as I'm going to do for the time being)
 
Sorry to come to you again, but I can't figure this out. The log is giving me confusing returns and I can't make much sense of the code either.

I'm trying to kill the unit capturing my worker, but it either can't get the unit in the plot my worker was (returning nil) and later it simply returns iUnit as nil too.

Spoiler :
Code:
function TNTWorker(iPlayer, iUnit, iUnitType, iByCiv)
	print("TNTWorker called")
	local pPlayer = Players[iPlayer]
	local pUnit = pPlayer:GetUnitByID(iUnit)
	print( tostring(pPlayer:GetCivilizationType()) )
	print( tostring(GameInfoTypes["CIVILIZATION_ALTJAPAN"]) )
	print( tostring(pUnit) )
	if iUnitType == GameInfoTypes["UNIT_WORKER"] then
		print("Is worker...")
		local pPlot = pUnit:GetPlot()
		if pPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_ALTJAPAN"] then
			print("...from AltJapan")
			--pUnit:Kill(false, -1) --with or without the kill here, it still doesn't work.
			local pPlotUnit = pPlot:GetUnit()
			print( tostring(iByCiv) )
			print( tostring(iPlayer) )
			pPlotUnit:Kill(false, -1)
			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 damUnit = pAdjacentPlot:GetUnit()
					damUnit:ChangeDamage(-15, -1)
				end
			end
		end
	end
end

Here is the log:
Spoiler :
[43973.452] UA: TNTWorker called
[43973.452] UA: 45
[43973.452] UA: 45
[43973.452] UA: table: 5C6CE4F0
[43973.452] UA: Is worker...
[43973.452] UA: ...from AltJapan
[43973.452] UA: 45 -- byciv = me? I'm capturing my own unit?!
[43973.452] UA: 0
[43973.452] Runtime Error: C:\Users\bane_\Documents\My Games\Sid Meier's Civilization 5\MODS\Alternate Japan (v 1)\Lua/UA.lua:80: attempt to index local 'pPlotUnit' (a nil value)
[43973.452] UA: TNTWorker called
[43973.452] UA: 45
[43973.452] UA: 45
[43973.452] UA: nil
[43973.452] UA: Is worker...
[43973.452] Runtime Error: C:\Users\bane_\Documents\My Games\Sid Meier's Civilization 5\MODS\Alternate Japan (v 1)\Lua/UA.lua:73: attempt to index local 'pUnit' (a nil value)

Is it being called twice or something?
 
pPlot:GetUnit() requires a parameter - the index of the unit on the plot (remember there can be more than one) that you want to retrieve

Also, the event MUST return a value - see the OnUnitCaptureType() method in MorindimReligion.lua in the "Civilization - Morindim" mod for an example
 
I would really like to use your mod, but i am having a problem, when i try to enable the mod a red message shows saying 'This version of the game is not compatible with this mod' I have tried reinstalling but i still have the same problem. I am playing on mac but i assume it will still work, other mods have worked. Please could i have some help. Thank you in advance
 
I am playing on mac but i assume it will still work,

DLL is a PC only technology, so any mod with a modded DLL won't work on a Mac
 
I'm having a few issues with the DLL. When I have it enabled, the AI is less aggresive and sometimes I CTD. I've also experienced the negative trade bug and sometimes my science would massivly inflate so that I was researching everything in one turn. It also causes a conflict with Reform and Rule that leads to crashes.
 
Hmmm, so, if I got it right, to do what I want (to kill the capturer and damage adjacent) I would need to return a custom unit that pushes a mission when created that iterates through all adjacent tiles including itself (using your ringiterator) recognizing where it has an unit and aplly the damage to each accordingly?

Sounds fun!
 
Hi dumb question coming up so bar with me.

In the MOD "Diplomacy - Tech Bonuses" what are these Tech Bonus that you can get? Are they from Research Agreements, Trade Routes just trying to understand if its something I want or not?
 
Back
Top Bottom