• Welcome to the forums on our new hosting setup. Everything should be working the same, but if you run into any problems, please let us know over here.

How to deny damage

Users who are viewing this thread

someoneetc

Recruit
Hello,

I'm working on a little mod for Warband in my spare time and I was wondering if anybody could help me with an issue: I'm trying to find a way to deny damage before it is inflicted. Here's a fragment of the script I've written:

Code:
(try_begin),
    (eq, ":weapon","itm_overpower_shield"),
    (val_add,":health",":damage"),
    (agent_set_hit_points,":agent",":health",0),
(try_end),

now, there are 2 main problems:
  1. provided that both ":health" and ":damage" are gathered via store_trigger_param* (the trigger is obviously ti_on_agent_hit), I can't find information on how is the damage expressed (is it a percentage of hit points? Is it an absolute value? Is it something else?). Subsequently I can't determine the correct formula for HP restoration;
  2. the health is restored after the damage has been inflicted and I would like to deny it at all(possibly avoiding also the pushback). Is there any way to do this?
Can anybody help me?

Best regards and thanks in advance :smile:
 

someoneetc

Recruit
Ok, I have found a solution, I'll post it here for future reference:

Code:
  675     (try_begin),
  676          #CHECK ITEM
  677         (eq, ":weapon","itm_overpower_shield"),
  679         #PREVENT DAMAGE
  680         (set_trigger_result,0),
  682         #PLAY SOME COOL ANIMATION
  683         (agent_set_animation,":agent","anim_master_defence"),
  684     (try_end),
 
Top Bottom