Which file contains the script/trigger for agent wounded or dead

Users who are viewing this thread

Does anyone know which file contains this trigger to determine whether an agent is killed or knocked unconscious during battles when their HP drops to zero? I'm trying to find it in the module system but I don't know what it's called which makes it a bit of a pain.
 
There's definitely more to it for the players party, surgery skill decreases the chance of death and even without surgery the base chance of death is less than 100% from cut and pierce damage. Perhaps there is a script checking this for the players party and not the AI, it seems as if AI does not make any use of surgery skill.
 
Upvote 0
The skill is working that way that there exists a chance for "killed" members of the party, to be wounded instead which gets applied after the battle iirc, so not in the battle itself. The surgery skill is a hardcoded one, meaning that you can't modify it directly. All in all you can still create your own system, overruling the hardcoded one, as mentioned before.
 
Upvote 0
But doesn't the display immediately tell you if an agent's been killed or wounded? I'm quite sure you can tell the difference in the battle if you have a party level of 10 surgery vs 0. But I've also played mods where the chance of survival is quite obviously increased for AI party members also. Perhaps they used scripts which resurrected some dead agents after the battle, the effect was probably subtle enough that you wouldn't notice.

I can't actually see the trigger on_agent_hit at all in the native mission template.py file. In the header file it has:
ti_on_agent_hit = -28.0 #can only be used in module_mission_templates triggers .
Does this mean that the one instance of -28 found in the mission_templates text file is calling this trigger or have I just misunderstood how the magic module system works again?
 
Last edited:
Upvote 0
Hm, could then actually be that the skill effect is already applied in-battle, then I missremembered.
In the Native Module System, the trigger ti_on_agent_hit is not getting used at the Singleplayer, only once at the Multiplayer. There is also the operation agent_set_no_death_knock_down_only about which I forgot, you can set agents to be unkillable with it. In Native it is only getting used at the training mission template.
 
Upvote 0
I had a look at the VC module system and it looks like their script was triggered on agent_killed_or_wounded and then decided whether to kill the agent or not. I think.
 
Upvote 0
Does anyone know which file contains this trigger to determine whether an agent is killed or knocked unconscious during battles when their HP drops to zero? I'm trying to find it in the module system but I don't know what it's called which makes it a bit of a pain.
That 'trigger' is hardcoded. As Earendil said, you may create a bunch of scripts modifying some aspects of the game which are otherwise inaccessible through the ModSys modding. Also, the tf_unkillable flag may prevent some agents from dying in addition to the agent_set_no_death_knock_down_only operation that Earendil mentioned earlier.
 
Last edited:
Upvote 0
Ah so you could set the battle mission template to agent_set_no_death_knock_down_only and then run a script on trigger agent_killed_or_wounded to decide whether agents have been killed or wounded. Although I'm not sure that would be any different from letting them die as normal and then running the script but my brain though it would for a minute.
 
Upvote 0
Ah so you could set the battle mission template to agent_set_no_death_knock_down_only and then run a script on trigger agent_killed_or_wounded to decide whether agents have been killed or wounded. Although I'm not sure that would be any different from letting them die as normal and then running the script but my brain though it would for a minute.
What do you want to achieve?
 
Upvote 0
To replace the death/wound system so that cut and pierce give a chance to wound rather than kill for AI as well as the player, and perhaps so that blunt is not guaranteed to wound.
 
Upvote 0
To replace the death/wound system so that cut and pierce give a chance to wound rather than kill for AI as well as the player, and perhaps so that blunt is not guaranteed to wound.
In theory it is possible by making an 'on hit' trigger detecting a weapon (check header_common.py for item groups such as multi_item_class_type_blunt) and calculating damage inflicted on every agent. Randomization and calculation will be crucial for the success of your script.
 
Upvote 0
Code:
(
    ti_on_agent_killed_or_wounded, 0, 0, [],
  [
    # 1. GATHER DATA
    (store_trigger_param_1, ":dead_agent"),
    (store_trigger_param_2, ":killer_agent"),
    (agent_get_troop_id, ":dead_agent_trp", ":dead_agent"),
    (neg|troop_is_hero, ":dead_agent_trp"),
    (agent_get_wielded_item, ":killer_weap", ":killer_agent"),
    (item_get_swing_damage_type, ":swing_type", ":killer_weap"),
    (item_get_thrust_damage_type, ":thrust_type", ":killer_weap"),

    # 2. KILL/WOUND CHANCE
    # 2.1 BLUNT KILL CHANCE
    (try_begin),
        (this_or_next|eq, ":swing_type", 2), # 2 = blunt
        (eq, ":thrust_type", 2), # 2 = blunt
        (store_random_in_range, ":blunt_kill_chance", 1, 4),
        (eq, ":blunt_kill_chance", 1), # 25% chance to kill
        (set_trigger_result, 1), # 1 = force kill
        
    # 2.2 CUT/PIERCE WOUND CHANCE
    (else_try),
        (this_or_next|neq, ":swing_type", 2), # NOT BLUNT
        (neq, ":thrust_type", 2), # NOT BLUNT
        (store_random_in_range, ":cut_pierce_wound_chance", 1, 8),
        (eq, ":cut_pierce_wound_chance", 1), # 12.5% chance to wound
        (set_trigger_result, 2), # 2 = force wounded
    (end_try),
    ]),

I don't know if this stack/clash with surgery skill, haven't tested that.
 
Upvote 0
Back
Top Bottom