I also found
LootDrop.LootExpirationTurnsRemaining = MaxLootExpirationTurns;
So I decided to create a new class "XComGameState_Mod_LootDrop", then added
[Engine.Engine]
+ModClassOverrides=(BaseGameClass="X2Item_DefaultWeapons" , ModClass="X2Item_Mod_Weapon_Slots")
+ModClassOverrides=(BaseGameClass="XComGameState_LootDrop", ModClass="XComGameState_Mod_LootDrop")
to the XComGame.ini file. My class contains this:
class XComGameState_Mod_LootDrop extends XComGameState_LootDrop config(AKBalanceMod);
var config int LOOT_TIMER_BASE;
var config int LOOT_TIMER_RANDOM_MIN;
var config int LOOT_TIMER_RANDOM_MAX;
static function CreateLootDrop(XComGameState NewGameState, const out array<XComGameState_Item> LootItems, Lootable LootSource, bool bExpireLoot)
{
local XComGameState_LootDrop LootDrop;
local XComGameState_Item ItemState;
local X2EventManager EventManager;
local Object ThisObj;
local int rnd;
`log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
rnd = default.LOOT_TIMER_BASE;
if( LootItems.Length > 0 )
{
LootDrop = XComGameState_LootDrop(NewGameState.CreateStateObject(class'XComGameState_LootDrop'));
NewGameState.AddStateObject(LootDrop);
rnd = default.LOOT_TIMER_BASE + RandRange(default.LOOT_TIMER_RANDOM_MIN , default.LOOT_TIMER_RANDOM_MAX);
`log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("Random roll:" @ rnd);
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("LOOOOOOOT");
`log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
LootDrop.LootExpirationTurnsRemaining = rnd;
ThisObj = LootDrop;
EventManager = `XEVENTMGR;
EventManager.RegisterForEvent(ThisObj, 'PlayerTurnBegun', OnPlayerTurnBegun, ELD_OnStateSubmitted);
EventManager.RegisterForEvent(ThisObj, 'LootDropCreated', OnLootDropCreated, ELD_OnStateSubmitted);
EventManager.TriggerEvent('LootDropCreated', ThisObj, ThisObj, NewGameState);
if( !bExpireLoot )
{
++LootDrop.LootExpirationTurnsRemaining;
}
LootDrop.TileLocation = LootSource.GetLootLocation();
LootDrop.LastLootOwnerName = LootSource.GetLootingName();
LootDrop.LootSourceID = XComGameState_BaseObject(LootSource).ObjectID;
foreach LootItems(ItemState)
{
LootDrop.LootableItemRefs.AddItem(ItemState.GetReference());
}
if( `CHEATMGR == None || !`CHEATMGR.bDisableLootFountain )
{
NewGameState.GetContext().PostBuildVisualizationFn.AddItem(LootDrop.VisualizeLootFountain);
}
}
}
But I never see the CreateLootDrop function being called when inspecting the console when debugging. Am I overriding the function correctly ? Any advice is welcome :smile: