Agent regeneration script

From Mount&Blade Modding Wiki
Revision as of 21:50, 16 June 2011 by Wolfstar (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

[edit] Description

Regenerates health for King/Lord/Companion/Player. For Single Player.

[edit] Agent Regeneration Script for Singleplayer

Coded by: cdvader

Python File Used: Module_Mission_Templates.py and Module_Common.py

How to implement:

1. Add All of the required New and Changed Codes (seen below.

2. Add the mission_template shortcut to any Singleplayer mission template eg. lords_hall

New and Changed Codes:

[edit] Module_Common

Add

slot_regeneration_rate = 155


[edit] Module_Mission_Templates

Add before tournament_triggers

regeneration_info = (
    ti_on_agent_spawn, 0, 0, [],
   [
       (store_trigger_param_1, ":agent"),
      (try_begin),
          (is_between, ":agent", kings_begin, kings_end),
         (agent_set_slot, ":agent", slot_regeneration_rate, 3),
      (try_end),
      (try_begin),
          (is_between, ":agent", kingdom_heroes_begin, kingdom_heroes_end),
         (agent_set_slot, ":agent", slot_regeneration_rate, 2),
      (try_end),
      (try_begin),
          (is_between, ":agent", companions_begin, companions_end),
         (agent_set_slot, ":agent", slot_regeneration_rate, 1),
      (try_end),
      (try_begin),
          (get_player_agent_no, ":player"),
          (agent_set_slot, ":player", slot_regeneration_rate, 1),
      (try_end),
   ])
 
regeneration = (
    3, 0, 0, [],
   [
       (try_for_agents, ":agent"),
          (agent_get_slot, ":rate", ":agent", slot_regeneration_rate),
         (store_agent_hit_points, ":hp", ":agent", 1),
         (val_add, ":hp", ":rate"),
         (agent_set_hit_points, ":agent", ":hp", 1),
      (try_end),
   ])

[edit] Details

Quoted from Cdvader: "What my script does is that every time a agent spawns somewhere, it checks if it's a king, lord, companion or you, the player, and gives the regeneration rate modifier. Then, every 3 seconds in the game, it adds the regeneration rate modifier to the HP."

[edit] Forum Link

http://forums.taleworlds.com/index.php/topic,8652.msg2040210.html#msg2040210

[edit] Credit

By Cdvader

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox