Skill efects for troops

Users who are viewing this thread

I've made a regeneration and a horse regeneration script based on chel's, but dependant on a skill ("First Aid" for humans and "Horsemaster" (previously "Reserved 5") for horses.).
It only works for the player now, but I want to make it work for all troops, which know this skill. Is it possible?
Code:
regeneration = (1, 0, 1,[(neg|main_hero_fallen)], [
			(get_player_agent_no, ":player_agent"),
			(agent_get_horse, ":horse_agent", ":player_agent"),
			(call_script, "script_get_player_regen"),
			(assign, ":player_regen_rate", reg0),
			(store_agent_hit_points,":life",":player_agent",1),
			(val_add, ":life", ":player_regen_rate"),
			(agent_set_hit_points,":player_agent",":life",1),
			(call_script, "script_get_horse_regen"),
			(assign, ":horse_regen_rate", reg0),
			(store_agent_hit_points, ":horse_life", ":horse_agent", 1),
			(val_add, ":horse_life", ":horse_regen_rate"),
			(agent_set_hit_points, ":horse_agent", ":horse_life", 1),
		])
 
Well you could always try adding it to knows_reserved_5 to troops to see if that works, I suspect so. As for if it would work if regular troops I'm not sure. Troops are usually stored as templates, which works fine for heros as there is only one of them, but for others they get gear randomly from the template. It think there are a few scripts which give rank and file troops a bit more of a personality, so I think it is possible but it would require some scripting, I think.
 
I think horses might actually be considered agents anyway. Might be hard working out whose horse belongs to what person.
 
Why? Working with the above code:

Code:
regeneration = (1, 0, 1,[(neg|main_hero_fallen)], [
         (try_for_range, ":agent", <agents in battle begin>, <agens in battle end>),
                  (agent_get_horse, ":horse_agent", ":agent"),
                  (call_script, "script_get_agent_regen"),
                  (assign, ":agent_regen_rate", reg0),
                  (store_agent_hit_points,":life",":agent",1),
                  (val_add, ":life", ":agent_regen_rate"),
                  (agent_set_hit_points,":agent",":life",1),
                  (call_script, "script_get_horse_regen"),
                  (assign, ":horse_regen_rate", reg0),
                  (store_agent_hit_points, ":horse_life", ":horse_agent", 1),
                  (val_add, ":horse_life", ":horse_regen_rate"),
                  (agent_set_hit_points, ":horse_agent", ":horse_life", 1),
         (end_try),
      ])

I just thought of this, so it might be very straightforward.
I need to replace <agents in battle begin> and <agents in battle end> with something proper.
 
Back
Top Bottom