GeneralWithAncKilled always returns true no matter what arguments you supply it. Simply using 'not I_WorldWideancillaryExists' to give the ancillary to whomever wins the next battle is the naïve approach that proliferated around 2010 when people realized that GeneralWithAncKilled is completely broken. Although it has a high failure rate (the anc going to the wrong character), that approach has the virtue of simplicity and it works for the AI. There have been improvements on the concept since then but it's still an advanced bit of scripting and there is no generally agreed upon optimal solution. How you implement ancillary stealing depends on the needs of your mod - if only a small selection of characters with known labels can hold the anc, the solution is almost trivial, if you want an entire class of characters (like all named characters or all assassins or etc.) to be able to hold the anc, it becomes more complicated but still possible.
The approach I favor is to check that the ancillary still exists when PostBattle fires, then wait 4-5 seconds for characters to finish their strat death animations, and then check again if the ancillary exists. If it did exist at PostBattle, but not 4-5 seconds later, then whomever had the ancillary must have died as a result of the battle. Since PostBattle exports character_record, we can use e_select_character to select the winner of the battle (named character in command of the army) and then use 'this' to give the ancillary to the selected character. This won't work for the AI since AI characters can't be selected, but PostBattle also exports faction type so we can use the same monitor to give the ancillary to an AI faction leader (or etc.). Or, if you know who the character is, you can just send it to his label without using selection and 'this'. The principle of checking if the ancillary exists, waiting a few seconds, and then checking again can also be used for assassination missions and denouncement missions to transfer ancillaries between agents. You can also add conditions like WonBattle to the PostBattle monitor for general-to-general anc stealing so that it only transfers for victories and is lost otherwise. I suggest pairing these monitors with an event counter that continuously tracks the status of the ancillary - held by a faction, off map, destroyed, etc.
Here's an example where we know the faction who won the battle but not the specific named character, so we use selection.
Code:
monitor_event PostBattle WonBattle ;this also handles auto-resolved battles
and FactionType turks
if I_EventCounter one_ring_status == -1 ;terminate if Ring is destroyed
terminate_monitor
end_if
if I_WorldwideAncillaryExists one_ring ;this tells us the anc wasn't lost in any other way prior to the battle
if not I_IsFactionAIControlled turks
e_select_character ;e_select_character only works for human factions
campaign_wait 4.0 ;minimized for length of general death animation (in residence == 2.0, field battle = 4.0)
e_select_character
if not I_WorldwideAncillaryExists one_ring ;4 seconds later the anc no longer exists, this means the holder must have died as a result of the battle
console_command logon password ;in case the user password-locked the console for hotseat
console_command give_ancillary this one_ring ;if faction is human, Ring goes to general who won the battle
if I_WorldwideAncillaryExists one_ring ;still not guaranteed that Ring was transferred, the general may already have max ancillaries
historic_event general_capture_ring factions { turks, }
inc_event_counter general_steals_ring 1 ;CALL: general_steals_ring, send out news to other participating factions
end_if
end_if
end_if
if I_IsFactionAIControlled turks
campaign_wait 4.0
if not I_WorldwideAncillaryExists one_ring
set_event_counter edain_leader_to_get_one_ring 1 ;schedule AI-Edain leader to get the Ring in an EDA trigger
end_if
end_if
end_if
end_monitor
And here is an example where we know the label of an inquisitor who stole the ancillary.
Code:
monitor_event DenouncementMission MissionSucceeded ;inquisitor takes the Ring from a denounced target
and Trait NazgulEpithet == 1 ;identify inquisitor who made the kill
and I_EventCounter one_ring_status > 200 ;Ring is held by a foreign agent
and I_WorldwideAncillaryExists one_ring ;ancillary exists when denouncement mission ends
campaign_wait 5 ;target is only dead once their death animation finishes playing out, this takes 5 seconds
if not I_WorldwideAncillaryExists one_ring
console_command logon password
console_command give_ancillary nazgul_1 one_ring ;we know this character so just give it to them directly without using selection, this works for the AI
if I_WorldwideAncillaryExists one_ring
if not I_IsFactionAIControlled england
historic_event nazgul_1_finds_ring factions { england, }
end_if
inc_event_counter nazgul_find_ring 1 ;CALL: nazgul_find_ring
end_if
end_if
end_monitor