Inightshade
Chieftain
@MorpheusAK
Alright, so in terms of actual functionality, DLL would be the way to go.
But if you are looking for magic...
From what I can tell there are not a lot of useful, good, or even existent hooks for combat. However to achieve what you are looking for: Bonus vs barbs (as UU), UI functionality, and ?maybe? not too much overhang if you can avoid selecting and unselecting units as much as I do... you can try this--
Do note that I workaround the lack of AI selecting units (as this is a human player thing only) by just giving the AI of said faction a flat bonus vs Barbs. The AI gets a different bonus than the player normally anyways, so it should suffice without any game breaking, or back breaking
, effects.
Hope this helps! (p.s. this may not be the best way, if someone else has better working hooks to grab onto do please comment!)
EDIT: For some reason my formatting just goes out the window and all [ ] spaces before lines disappear? Is this just me?
Alright, so in terms of actual functionality, DLL would be the way to go.
But if you are looking for magic...
From what I can tell there are not a lot of useful, good, or even existent hooks for combat. However to achieve what you are looking for: Bonus vs barbs (as UU), UI functionality, and ?maybe? not too much overhang if you can avoid selecting and unselecting units as much as I do... you can try this--
Code:
-- Lua code for MorpheusAK
-- Last edited: 1/17/15
--------------
-- Set up globals to check for Lua dependent Civs.
--------------
bIsCivName = true; -- Note that this is backwards on purpose, this is because Lua defaults to true unless its explicitatly stated as false or is null.
---------------------------------------------------------------------------------------
-- Lua to check who is in game.
---------------------------------------------------------------------------------------
for id, checkPlayer in pairs(Players) do
if(checkPlayer:IsEverAlive() and checkPlayer:GetCivilizationType == GameInfoTypes["CIVILIZATION_NAME_HERE"] and checkPlayer:IsHuman()) then bIsCivName = false;
elseif(checkPlayer:IsEverAlive() and checkPlayer:GetCivilizationType == GameInfoTypes["CIVILIZATION_NAME_HERE"]) then
checkPlayer:ChangeBarbarianCombatBonus(25); end --The AI has drastically different Barb bonuses anyways, this will be unnoticed by the human player.
end -- Modified to check for human also.
---------------------------------------------------------------------------------------
-- Lua to provide semi dynamic Barb bonus for a UU.
---------------------------------------------------------------------------------------
function UUSelectDirect (playerID, unitID)
local pPlayer = Pplayers[playerID];
local pUnit = pPlayer:GetUnitByID(unitID);
if(pUnit ~= nil and pUnit:GetUnitType = GameInfoTypes["UNIT_TYPE_HERE"]) then
pPlayer:ChangeBarbarianCombatBonus(33); --Unconfirmed. However the call exists in the LuaPlayer.h so it does something! :P
else
pPlayer:ChangeBarbarianCombatBonus(-33);
end
if bIsCivName then
-- unsub if they are not in game. --Added check for human above.
Events.SerialEventUnitFlagSelected.Remove(UUSelectDirect);
end
end
---------------------------------------------------------------------------------------
-- Lua to provide semi dynamic Barb bonus for a UU.
---------------------------------------------------------------------------------------
function UUSelectFromHex (iHexX, iHexY)
local pPlot = Map.GetPlot(ToGridFromHex(iHexX, iHexY));
local skip = nil; -- Use this to prevent stacked units from causing unintended effects!
for i = 0, pPlot:GetNumUnits() -1 do -- Cycle
local pUnit = pPlot:GetUnit(i);
if(pUnit ~= nil and pUnit:GetUnitType == GameInfoTypes["UNIT_TYPE_HERE"] and skip ~= nil) then
skip = whatever;
local pPlayer = pUnit:GetOwner();
pPlayer:ChangeBarbarianCombatBonus(33);
elseif skip ~= nil then
pPlayer:ChangeBarbarianCombatBonus(-33);
else end
end
if bIsCivName then
-- unsub if they are not in game. --Added check for human above.
Events.SerialEventHexSelected.Remove(UUSelectFromHex);
end
end
Events.SerialEventUnitFlagSelected.Add(UUSelectDirect);
--Events.SerialEventHexSelected.Add(UUSelectFromHex); --Optional
--Unfortunately I do not think you can hook to the auto cycler :/
--This will mean that things could be weird when the auto cycler changes units for you...
Do note that I workaround the lack of AI selecting units (as this is a human player thing only) by just giving the AI of said faction a flat bonus vs Barbs. The AI gets a different bonus than the player normally anyways, so it should suffice without any game breaking, or back breaking

Hope this helps! (p.s. this may not be the best way, if someone else has better working hooks to grab onto do please comment!)
EDIT: For some reason my formatting just goes out the window and all [ ] spaces before lines disappear? Is this just me?