1. // character.zonescript
  2. // Created on: 23-Feb-2019
  3. // Last modified on: 06-May-2019
  4.  
  5. //--------------------------------------------------------------------------
  6.  
  7. import includes.animations.generate;
  8. import includes.animations.logic;
  9.  
  10. //--------------------------------------------------------------------------
  11.  
  12. function processCharacterAnimations(src, tgt, character_name)
  13. {
  14.         var array = [];
  15.         var animations = [];
  16.  
  17.         array = array.concat(processAnimation(src, "combat_idle",                       true, character_name, animations, -16.0, "", -1));
  18.         array = array.concat(processAnimation(src, "combat_walk",                       true, character_name, animations, -16.0, "", -1));
  19.         array = array.concat(processAnimation(src, "crouch_idle",                       true, character_name, animations, -16.0, "", -1));
  20.         array = array.concat(processAnimation(src, "crouch_walk",                       true, character_name, animations, -16.0, "", -1));
  21.         array = array.concat(processAnimation(src, "explore_idle",                      true, character_name, animations, -16.0, "", -1));
  22.         array = array.concat(processAnimation(src, "explore_walk",                      true, character_name, animations, -16.0, "", -1));
  23.         array = array.concat(processAnimation(src, "dead_idle",                         true, character_name, animations, -16.0, "", -1));
  24.  
  25.         array = array.concat(processAnimation(src, "cast_big",                  false, character_name, animations, -16.0, "CastEvent", 31));
  26.         array = array.concat(processAnimation(src, "cast_small",                        false, character_name, animations, -16.0, "CastEvent", 12));
  27.         array = array.concat(processAnimation(src, "combat_to_explore",                 false, character_name, animations, -16.0, "", -1));
  28.         array = array.concat(processAnimation(src, "crouch_big_cast",           false, character_name, animations, -16.0, "CastEvent", 26));
  29.         array = array.concat(processAnimation(src, "crouch_big_hit",            false, character_name, animations, -16.0, "", -1));
  30.         array = array.concat(processAnimation(src, "crouch_evade",                      false, character_name, animations, -16.0, "", -1));
  31.         array = array.concat(processAnimation(src, "crouch_hit",                        false, character_name, animations, -16.0, "", -1));
  32.         array = array.concat(processAnimation(src, "crouch_small_cast",                 false, character_name, animations, -16.0, "CastEvent", 29));
  33.         array = array.concat(processAnimation(src, "crouch_to_dead",            false, character_name, animations, -16.0, "", -1));
  34.         array = array.concat(processAnimation(src, "crouch_use_high",           false, character_name, animations, -16.0, "UseEvent", 11));
  35.         array = array.concat(processAnimation(src, "crouch_use_low",            false, character_name, animations, -16.0, "UseEvent", 9));
  36.         array = array.concat(processAnimation(src, "dead_to_crouch",            false, character_name, animations, -16.0, "", -1));
  37.         array = array.concat(processAnimation(src, "dead_to_stand",             false, character_name, animations, -16.0, "", -1));
  38.         array = array.concat(processAnimation(src, "die",                               false, character_name, animations, -16.0, "", -1));
  39.         array = array.concat(processAnimation(src, "evade",                             false, character_name, animations, -16.0, "", -1));
  40.         array = array.concat(processAnimation(src, "explore_to_combat",                 false, character_name, animations, -16.0, "", -1));
  41.         array = array.concat(processAnimation(src, "get_up",                            false, character_name, animations, -16.0, "", -1));
  42.         array = array.concat(processAnimation(src, "hit_big",                           false, character_name, animations, -16.0, "", -1));
  43.         array = array.concat(processAnimation(src, "hit_small",                         false, character_name, animations, -16.0, "", -1));
  44.         array = array.concat(processAnimation(src, "stand_to_crouch",           false, character_name, animations, -16.0, "", -1));
  45.         array = array.concat(processAnimation(src, "use_high",                  false, character_name, animations, -16.0, "UseEvent", 10));
  46.         array = array.concat(processAnimation(src, "use_low",                           false, character_name, animations, -16.0, "UseEvent", 22));
  47.  
  48.         saveAnimations(tgt, character_name, array, animations);
  49. }
  50.  
  51. //--------------------------------------------------------------------------
  52.  
  53. function createCharacterControl(anim_loc, tgt, name)
  54. {
  55.         var map_data = [
  56.        
  57.                 {stance:"Combat", tag:"CastBig",        anim:"cast_big"},
  58.                 {stance:"Combat", tag:"CastSmall", anim:"cast_small"},
  59.                 {stance:"Combat", tag:"HitBig",         anim:"hit_big"},
  60.                 {stance:"Combat", tag:"HitSmall",       anim:"hit_small"},     
  61.                 {stance:"Combat", tag:"UseHigh",        anim:"use_high"},
  62.                 {stance:"Combat", tag:"UseLow",         anim:"use_low"},
  63.  
  64.                 {stance:"Crouch", tag:"CastBig",        anim:"crouch_big_cast"},
  65.                 {stance:"Crouch", tag:"CastSmall", anim:"crouch_small_cast"},
  66.                 {stance:"Crouch", tag:"HitBig",         anim:"crouch_big_hit"},
  67.                 {stance:"Crouch", tag:"HitSmall",       anim:"crouch_hit"},
  68.                 {stance:"Crouch", tag:"UseHigh",        anim:"use_high"},
  69.                 {stance:"Crouch", tag:"UseLow",         anim:"use_low"},
  70.  
  71.                 {stance:"Explore", tag:"UseHigh",       anim:"crouch_use_high"},
  72.                 {stance:"Explore", tag:"UseLow",        anim:"crouch_use_low"}
  73.                
  74.         ];
  75.        
  76.         createControl("characters/animation_tags", anim_loc, tgt, name, map_data)
  77. }
  78.  
  79. //--------------------------------------------------------------------------
  80.  
  81. function createCharacterMotionControl(anim_loc, tgt, name)
  82. {
  83.         var transition_data = [
  84.                 {from:"Explore",        to:"Combat",            anim:"explore_to_combat"},
  85.                 {from:"Combat",         to:"Explore",           anim:"combat_to_explore"},
  86.                
  87.                 {from:"Explore",        to:"Crouch",            anim:"stand_to_crouch"},
  88.                 {from:"Combat",         to:"Crouch",            anim:"stand_to_crouch"},
  89.                
  90.                 {from:"Explore",        to:"KnockedOut",        anim:"die"},
  91.                 {from:"Combat",         to:"KnockedOut",        anim:"die"},
  92.                
  93.                 {from:"Crouch",         to:"Explore",           anim:"get_up"},
  94.                 {from:"KnockedOut", to:"Explore",               anim:"dead_to_stand"},
  95.                
  96.                 {from:"Crouch",         to:"Combat",            anim:"get_up"},
  97.                 {from:"KnockedOut", to:"Combat",                anim:"dead_to_stand"},
  98.  
  99.                 {from:"Crouch",         to:"KnockedOut",        anim:"crouch_to_dead"},
  100.                 {from:"KnockedOut", to:"Crouch",                anim:"dead_to_crouch"}
  101.         ];
  102.  
  103.         var stance_data = {
  104.                 exploreWalk:"explore_walk",
  105.                 exploreRun:"explore_walk",
  106.                 combatMove:"combat_walk",
  107.                 crouchMove:"crouch_walk",
  108.                 exploreIdle:"explore_idle",
  109.                 combatIdle:"combat_idle",
  110.                 crouchIdle:"crouch_idle",
  111.                 koIdle:"dead_idle"
  112.         };
  113.  
  114.         var move_data = {
  115.                 walk:1.4,
  116.                 run:2.8,
  117.                 combat:2.0,
  118.                 crouch:2.0
  119.         };
  120.  
  121.         createMotionControl(anim_loc, tgt, name, stance_data, transition_data, move_data);
  122. }
  123.  
  124. //--------------------------------------------------------------------------