Cromcrom
Hi all,
I would like th have the possibility to have troops in a party randomly die or be wounded (as a result of disease, traps, ambushes....)
This basic code doesn't work:
Any hints or tips or advices would be greatly appreciated.
Thanks in advance and take care all
I would like th have the possibility to have troops in a party randomly die or be wounded (as a result of disease, traps, ambushes....)
This basic code doesn't work:
Code:
("rigale_random_troop_death_or_wounded",
[
(store_script_param, ":chance_to_die",1),
(store_script_param, ":chance_to_be_wounded",2),
(store_script_param, ":party_no",3),
(party_get_num_companion_stacks, ":num_stacks",":party_no"),
(try_for_range, ":i_stack", 0, ":num_stacks"),
(party_stack_get_size, ":stack_size",":party_no",":i_stack"),
(party_stack_get_troop_id, ":troop_id", ":party_no", ":i_stack"),
(store_random_in_range,":random_check",1,101),
(str_store_troop_name,s1,":troop_id"),
(try_for_range,":j_troop",0,":stack_size"),
(neg|troop_is_hero,":troop_id"),
(try_begin),
(le,":random_check",":chance_to_die"),
(remove_member_from_party,":troop_id",":party_no"),
(display_message,"@A {s1} dies"),
(else_try),
(le,":random_check",":chance_to_be_wounded"),
(troop_set_health,":troop_id",30),
(display_message,"@A {s1} is wounded"),
(try_end),
(val_add,":j_troop",1),
(try_end),
(try_end),
(str_clear,s1),
]),
Any hints or tips or advices would be greatly appreciated.
Thanks in advance and take care all