I'm trying to set up a script that transfers a unique ancillary from a denouncement target to the inquisitor (same idea for assassination target and assassin). This is what I have:
Code:
monitor_event DenouncementMission MissionSucceeded ;exports inquisitor ID
and Trait CharacterID_0001 > 0 ;unique trait to identify the inquisitor that will get the ancillary, prevents effects from firing if a different inquisitor does the denouncement
and I_EventCounter test_anc_on_map == 1 ;this is linked to other monitors which tells us the ancillary is being held by an agent/general and they haven't died by any other means
campaign_wait 5.0 ;it takes around 5 in-game seconds for the target to die and hence for the game to return false for I_WorldwideAncillaryExists
if not I_WorldwideAncillaryExists test_anc ;unique ancillary, only one on the map at a time
console_command give_ancillary this test_anc ;'this' is exported by character_record from DenouncementMission
historic_event test_event_message
end_if
end_monitor
This script works almost as intended (I haven't tested for assassins, but presumably it would be the same with AssassinationMission MissionSucceeded), it allows me to transfer a unique ancillary from the target to the inquisitor when the inquisitor successfully denounces the target. The problem is that if I left-click the map quickly after the denouncement animation begins to play on the inquisitor strat model (to speed it up), then the give_ancillary command doesn't fire. The historic_event test_event_message still plays which means the 'if not I_WorldwideAncillaryExists' condition is passed, i.e. speeding the animation has no effect on the campaign_wait. If I speed up the animation by left-clicking the map, the log says:
give_ancillary this test_anc
err: character not found
The problem seems to be 'this' not pointing to the correct character at that moment in time when I speed up the animation. If I let the animation play out, 'this' points at the correct character. Obviously, I don't want the script to break if the user speeds up the denouncement animation (it has been my experience that 100% of users speed up strat animations 100% of the time). So, any ideas to address this bug?