Getting weapon damage for ti_on_agent_killed_or_wounded

Users who are viewing this thread

Hi, I'm trying to customise the realistic casualties trigger from VC so that the chance of death or wounding is dependant on damage value of the final blow
like so
Code:
(eq, ":is_wounded", 0),    
 (store_random_in_range, ":chance", 1,81),    
 (lt, ":chance", ":damage"),    
 (assign, ":is_wounded", 1),

Unfortunately since this uses ti_on_agent_killed_or_wounded rather than ti_on_agent_hit there is no damage value, does anyone know how I could get the damage value from the last attack this agent suffered? Or would I have to write a trigger using on_agent_hit?
 
Last edited by a moderator:
You can compare in trigger ti_on_agent_hit the damage and agent health. If damage is greater or equal to health than ti_on_agent_killed_or_wounded will be triggered after.
Read more detailed information about this triggers here:
 
Upvote 0
Yes but how do I link the two? Can I store the damage from ti_on_agent_hit somehow and then use it in the ti_on_agent_killed_or_wounded?

I tried this trigger but it doesn't appear to do anything.
Code:
common_casualties =(
  ti_on_agent_hit, 0, 0, [],
  [

    (store_trigger_param, ":agent", 1),
    (store_trigger_param, ":attacker", 2),
    (store_trigger_param, ":damage", 3),
    (store_trigger_param, ":bodypart", 4),
    (store_agent_hit_points, ":agent_health", ":agent", 1),


  
    (try_begin),
    (ge, ":damage", ":agent_health"),
    (neg|troop_is_hero, ":agent"),
    (val_sub, ":damage", ":agent_health"),
    (le, ":damage", 30),
    (assign, ":is_wounded", ":agent", 1),    # dead -> alive
    (else_try),
    (ge, ":damage", ":agent_health"),
    (neg|troop_is_hero, ":agent"),
    (assign, ":is_dead", ":agent", 1),    # alive -> dead
    (else_try),
    (set_trigger_result, -1),
    (end_try),
])

I guess is_dead is not an actual function, but I didn't get any compilation errors so idk what it's doing.
 
Last edited by a moderator:
Upvote 0
Back
Top Bottom