Doctor's oath feature in Surgery ability in MB Warband

Users who are viewing this thread

Hello Everyone.
I've been looking around the internet and asking a lot of people regarding this, I hope small, feature. I've come along with a nice person that helped me start with this, but I do not quite understand what should I implement into that in order for it to work. Here is the code:

(agent_get_troop_id, ":troop", ":agent"),
# Store surgery skill level for selected troop
(store_skill_level, ":surgery_skill", skl_surgery, ":troop"),

(assign, ":base_survival_chance", 25),
# surgery skill *4
(val_mul, ":surgery_skill", 4),
(store_add, ":actual_survival_chance", ":base_survival_chance", ":skl_surgery"),
(store_random_in_range, ":random", 0, 100),
(le, ":random", ":actual_survival_chance"),
try_begin
(le, ":random", ":actual_survival_chance"),
eq, ":agent_team", 0, # Team number of your enemies
lt, ":random_num", ":survival_chance"

I know that I need to add the try begin etc, but I couldn't find in triggers/mission templates anything that would allow me to knock out the agent instead of killing him if the surgery number is higher than the random one. All I've been doing was reading through those .py walls of codes to find what I need but apparently, I failed. As far as I know, the surgery itself is hardcoded and cannot be changed, which is unlucky cause it would be (I guess) much easier to just insert the agents from team 1 to that code so it would work along with my allies. Thanks for any help in advance :smile:.
 
You need to learn how to implement a trigger in missions using mission_templates and plug the above script into a ti_on_agent_killed_or_wounded trigger.

Python:
ti_on_agent_killed_or_wounded= -26.0 # Agent has been defeated in battle (killed or wounded)
    # trigger param 1 = defeated agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = wounded flag: 0 = agent is killed, 1 = agent is wounded
    # If (set_trigger_result) with non-zero parameter is used in the code, it will override the agent's fate. Use value of 1 to force kill, and 2 to force wounded.

You would use the trigger and (set_trigger_result, 2), in the event survival chance succeeded.
 
Upvote 0
Back
Top Bottom