WB Coding Making a NPC use a specific animation in a specific place

Currently viewing this thread:

John25-

Sergeant at Arms
Hi, how can I make a NPC use a specific animation when they are located in a specific place? For example, a companion who would appear elsewhere than in tavern but would have a different animation at that moment/place. I have tried to do something similar to this from module_scripts.py:
Code:
  ("init_town_agent",
    [
      (store_script_param, ":agent_no", 1),
      (agent_get_troop_id, ":troop_no", ":agent_no"),
      (set_fixed_point_multiplier, 100),
      (assign, ":stand_animation", -1),
      (try_begin),
        (this_or_next|is_between, ":troop_no", armor_merchants_begin, armor_merchants_end),
        (is_between, ":troop_no", weapon_merchants_begin, weapon_merchants_end),
        (try_begin),
          (troop_get_type, ":cur_troop_gender", ":troop_no"),
          (eq, ":cur_troop_gender", 0),
          (agent_set_animation, ":agent_no", "anim_stand_townguard"),
        (else_try),
          (agent_set_animation, ":agent_no", "anim_stand_townguard"),
        (end_try),
      (else_try),
        (is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end),
        (assign, ":stand_animation", "anim_stand_lady"),
      (else_try),
        (is_between, ":troop_no", active_npcs_begin, active_npcs_end),
        (assign, ":stand_animation", "anim_stand_lord"),
      (else_try),
        (is_between, ":troop_no", soldiers_begin, soldiers_end),
        (assign, ":stand_animation", "anim_stand_townguard"),
      (try_end),
      (try_begin),
        (ge, ":stand_animation", 0),
        (agent_set_stand_animation, ":agent_no", ":stand_animation"),
        (agent_set_animation, ":agent_no", ":stand_animation"),
        (store_random_in_range, ":random_no", 0, 100),
        (agent_set_animation_progress, ":agent_no", ":random_no"),
      (try_end),
      ]),

It then seems to be related to module_mission_templates.py, but I don't know what to do over there..
 
Solution
Code:
set_ani = (
 0, 0, 0, [],
    [(try_for_agents, ":agent"),
    (agent_is_alive, ":agent"),
    (agent_is_human, ":agent"),
    (agent_get_troop_id, ":troop", ":agent"),
    (is_between,":troop", "trp_first_troop", "trp_trp_after_last_troop"),
       (try_begin),
        (this_or_next|eq,":troop","trp_first_troop"),
        (this_or_next|eq,":troop","trp_second_troop"),
        (eq,":troop","trp_third_troop"),
          (agent_set_stand_animation, ":agent", "anim_X"),
      (try_end),
    (try_end),
 ])

now you can call that in the missions you want with set_ani,

Tocan

Sergeant Knight at Arms
Code:
set_ani = (
 0, 0, 0, [],
    [(try_for_agents, ":agent"),
    (agent_is_alive, ":agent"),
    (agent_is_human, ":agent"),
    (agent_get_troop_id, ":troop", ":agent"),
    (is_between,":troop", "trp_first_troop", "trp_trp_after_last_troop"),
       (try_begin),
        (this_or_next|eq,":troop","trp_first_troop"),
        (this_or_next|eq,":troop","trp_second_troop"),
        (eq,":troop","trp_third_troop"),
          (agent_set_stand_animation, ":agent", "anim_X"),
      (try_end),
    (try_end),
 ])

now you can call that in the missions you want with set_ani,
 
Upvote 0
Solution
Top Bottom