PDA

View Full Version : Advanced Scripting - GeneralAssaultsGeneral -> Target Character



Alexandrivs
12-19-2012, 01:01
Hi every one,
I'm currently working on a script that spawns an AI army that lay siege on a AI settlement.
Everything is going fine, i use a trait that drop army movement's points to zero,preventing the lifting of the siege.

Now, this siege must be interrupted by the player or must end with the win of the attacker.
My problem occurs when the defending AI armies, try to sally / attack my spawned general. I need his forced victory.
So,first i need to check if he's under attack, and then let him auto_win.

But i cannot manage to restrict this condition only to him. ( i gave a traits that identify the sieging army)

Here's my code:



monitor_event GeneralAssaultsGeneral TargetFactionType romani
and not TargetCharacterIsLocal
and not FactionIsLocal
and I_SettlementUnderSiege Cures
and Trait Aisiegingarmy = 1 ;;I use this trait to identify the attacked general, but this conditions refers to the attacker, and not the defender...
and I_CompareCounter cures_siege_started = 1

console_command auto_win defender

terminate_monitor
end_monitor


My code should work if i know how to manage other exports by GeneralAssaultsGeneral that refers to the target_character_records.
In other words, i need some condition like one of the following:

TargetCharacterTrait
TargetCharacterHasAnc
TargetCharacterName

Any help?
Thank you...